#include "sync/internal_api/public/write_transaction.h"
#include "sync/syncable/directory.h"
#include "sync/syncable/mutable_entry.h"
+#include "url/gurl.h"
namespace syncer {
SyncBackupManager::~SyncBackupManager() {
}
-void SyncBackupManager::Init(
- const base::FilePath& database_location,
- const WeakHandle<JsEventHandler>& event_handler,
- const std::string& sync_server_and_path,
- int sync_server_port,
- bool use_ssl,
- scoped_ptr<HttpPostProviderFactory> post_factory,
- const std::vector<scoped_refptr<ModelSafeWorker> >& workers,
- ExtensionsActivity* extensions_activity,
- SyncManager::ChangeDelegate* change_delegate,
- const SyncCredentials& credentials,
- const std::string& invalidator_client_id,
- const std::string& restored_key_for_bootstrapping,
- const std::string& restored_keystore_key_for_bootstrapping,
- InternalComponentsFactory* internal_components_factory,
- Encryptor* encryptor,
- scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler,
- ReportUnrecoverableErrorFunction
- report_unrecoverable_error_function,
- CancelationSignal* cancelation_signal) {
+void SyncBackupManager::Init(InitArgs* args) {
if (SyncRollbackManagerBase::InitInternal(
- database_location,
- internal_components_factory,
- unrecoverable_error_handler.Pass(),
- report_unrecoverable_error_function)) {
+ args->database_location,
+ args->internal_components_factory.get(),
+ InternalComponentsFactory::STORAGE_ON_DISK_DEFERRED,
+ args->unrecoverable_error_handler.Pass(),
+ args->report_unrecoverable_error_function)) {
GetUserShare()->directory->CollectMetaHandleCounts(
&status_.num_entries_by_type, &status_.num_to_delete_entries_by_type);
}
void SyncBackupManager::SaveChanges() {
- if (initialized()) {
+ if (initialized())
NormalizeEntries();
- GetUserShare()->directory->SaveChanges();
- }
}
SyncStatus SyncBackupManager::GetDetailedStatus() const {
}
}
+void SyncBackupManager::ShutdownOnSyncThread(ShutdownReason reason) {
+ if (reason == SWITCH_MODE_SYNC) {
+ NormalizeEntries();
+ GetUserShare()->directory->SaveChanges();
+ }
+
+ SyncRollbackManagerBase::ShutdownOnSyncThread(reason);
+}
+
void SyncBackupManager::RegisterDirectoryTypeDebugInfoObserver(
syncer::TypeDebugInfoObserver* observer) {}