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; |
} |