Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: chrome/browser/sync/profile_sync_service.cc

Issue 10167017: Fix some migration-related bugs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review changes Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/profile_sync_service.cc
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index 27e3e56c5779796467e6867e98bb9a811fe4d154..8d0d13f483d9377b9548e34ce2129f72016e9870 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -231,6 +231,11 @@ void ProfileSyncService::TryStart() {
}
}
+void ProfileSyncService::StartSyncingWithServer() {
+ if (backend_.get())
+ backend_->StartSyncingWithServer();
+}
+
void ProfileSyncService::RegisterAuthNotifications() {
TokenService* token_service = TokenServiceFactory::GetForProfile(profile_);
registrar_.Add(this,
@@ -1193,7 +1198,9 @@ void ProfileSyncService::ConfigureDataTypeManager() {
migrator_.reset(
new browser_sync::BackendMigrator(
profile_->GetDebugName(), GetUserShare(),
- this, data_type_manager_.get()));
+ this, data_type_manager_.get(),
+ base::Bind(&ProfileSyncService::StartSyncingWithServer,
+ base::Unretained(this))));
}
const syncable::ModelTypeSet types = GetPreferredDataTypes();
@@ -1457,10 +1464,15 @@ void ProfileSyncService::Observe(int type,
backend_->EnableEncryptEverything();
NotifyObservers();
- // In the old world, this would be a no-op. With new syncer thread,
- // this is the point where it is safe to switch from config-mode to
- // normal operation.
- backend_->StartSyncingWithServer();
+ if (migrator_.get() &&
+ migrator_->state() != browser_sync::BackendMigrator::IDLE) {
+ // Migration in progress. Let the migrator know we just finished
+ // configuring something. It will be up to the migrator to call
+ // StartSyncingWithServer() if migration is now finished.
+ migrator_->OnConfigureDone(*result);
+ } else {
+ StartSyncingWithServer();
+ }
break;
}
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/test/integration/migration_errors_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698