Index: components/browser_sync/browser/profile_sync_service.cc |
diff --git a/components/browser_sync/browser/profile_sync_service.cc b/components/browser_sync/browser/profile_sync_service.cc |
index 7a57b2f5654bbf4a3e7eee4e2bc37a17e7e9eb21..3e5c4b471e53aaad5334a45b046d9ab4bde93e4d 100644 |
--- a/components/browser_sync/browser/profile_sync_service.cc |
+++ b/components/browser_sync/browser/profile_sync_service.cc |
@@ -381,7 +381,15 @@ void ProfileSyncService::Initialize() { |
base::Bind(&ProfileSyncService::OnMemoryPressure, |
sync_enabled_weak_factory_.GetWeakPtr()))); |
startup_controller_->Reset(GetRegisteredDataTypes()); |
- startup_controller_->TryStart(); |
+ |
+ // Auto-start means IsFirstSetupComplete gets set automatically, and the |
+ // first startup should be immediate, not deferred. |
+ if (start_behavior_ == AUTO_START && !IsFirstSetupComplete()) { |
+ SetFirstSetupComplete(); |
+ startup_controller_->TryStart(true); |
+ } else { |
+ startup_controller_->TryStart(false); |
+ } |
} |
void ProfileSyncService::StartSyncingWithServer() { |
@@ -626,7 +634,7 @@ void ProfileSyncService::OnGetTokenSuccess( |
if (HasSyncingBackend()) |
backend_->UpdateCredentials(GetCredentials()); |
else |
- startup_controller_->TryStart(); |
+ startup_controller_->TryStart(false); |
} |
void ProfileSyncService::OnGetTokenFailure( |
@@ -701,7 +709,7 @@ void ProfileSyncService::OnRefreshTokensLoaded() { |
if (HasSyncingBackend()) { |
RequestAccessToken(); |
} else { |
- startup_controller_->TryStart(); |
+ startup_controller_->TryStart(false); |
} |
} |
@@ -948,13 +956,8 @@ void ProfileSyncService::PostBackendInitialization() { |
UpdateLastSyncedTime(); |
} |
- // Auto-start means IsFirstSetupComplete gets set automatically. |
- if (start_behavior_ == AUTO_START && !IsFirstSetupComplete()) { |
- // This will trigger a configure if it completes setup. |
- SetFirstSetupComplete(); |
- } else if (CanConfigureDataTypes()) { |
+ if (CanConfigureDataTypes()) |
ConfigureDataTypeManager(); |
- } |
// Check for a cookie jar mismatch. |
std::vector<gaia::ListedAccount> accounts; |
@@ -1265,7 +1268,7 @@ void ProfileSyncService::OnActionableError(const SyncProtocolError& error) { |
break; |
case syncer::RESET_LOCAL_SYNC_DATA: |
ShutdownImpl(syncer::DISABLE_SYNC); |
- startup_controller_->TryStart(); |
+ startup_controller_->TryStart(false); |
break; |
default: |
NOTREACHED(); |
@@ -1317,7 +1320,7 @@ void ProfileSyncService::OnClearServerDataDone() { |
// Shutdown sync, delete the Directory, then restart, restoring the cached |
// nigori state. |
ShutdownImpl(syncer::DISABLE_SYNC); |
- startup_controller_->TryStart(); |
+ startup_controller_->TryStart(true); |
} |
void ProfileSyncService::OnConfigureDone( |
@@ -2064,7 +2067,7 @@ void ProfileSyncService::OnSyncManagedPrefChange(bool is_sync_managed) { |
StopImpl(CLEAR_DATA); |
} else { |
// Sync is no longer disabled by policy. Try starting it up if appropriate. |
- startup_controller_->TryStart(); |
+ startup_controller_->TryStart(true); |
} |
} |
@@ -2335,7 +2338,7 @@ void ProfileSyncService::RequestStart() { |
sync_prefs_.SetSyncRequested(true); |
NotifyObservers(); |
} |
- startup_controller_->TryStart(); |
+ startup_controller_->TryStart(true); |
} |
void ProfileSyncService::ReconfigureDatatypeManager() { |