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 31385719335a3aacaa54ec10849783ad7ac2a408..8f07f316c2689c5366bd9fc46f0e00d10f60e7f6 100644 |
--- a/chrome/browser/sync/profile_sync_service.cc |
+++ b/chrome/browser/sync/profile_sync_service.cc |
@@ -145,7 +145,8 @@ ProfileSyncService::ProfileSyncService(ProfileSyncComponentsFactory* factory, |
auto_start_enabled_(start_behavior == AUTO_START), |
failed_datatypes_handler_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
configure_status_(DataTypeManager::UNKNOWN), |
- setup_in_progress_(false) { |
+ setup_in_progress_(false), |
+ invalidator_state_(syncer::DEFAULT_INVALIDATION_ERROR) { |
#if defined(OS_ANDROID) |
chrome::VersionInfo version_info; |
if (version_info.IsOfficialBuild()) { |
@@ -554,6 +555,9 @@ void ProfileSyncService::ShutdownImpl(bool sync_disabled) { |
expect_sync_configuration_aborted_ = false; |
is_auth_in_progress_ = false; |
backend_initialized_ = false; |
+ // NULL if we're called from Shutdown(). |
+ if (invalidator_registrar_.get()) |
+ UpdateInvalidatorRegistrarState(); |
cached_passphrase_.clear(); |
encryption_pending_ = false; |
encrypt_everything_ = false; |
@@ -697,7 +701,8 @@ void ProfileSyncService::DisableBrokenDatatype( |
void ProfileSyncService::OnInvalidatorStateChange( |
syncer::InvalidatorState state) { |
- invalidator_registrar_->UpdateInvalidatorState(state); |
+ invalidator_state_ = state; |
+ UpdateInvalidatorRegistrarState(); |
} |
void ProfileSyncService::OnIncomingInvalidation( |
@@ -749,6 +754,7 @@ void ProfileSyncService::OnBackendInitialized( |
} |
backend_initialized_ = true; |
+ UpdateInvalidatorRegistrarState(); |
sync_js_controller_.AttachJsBackend(js_backend); |
@@ -1828,6 +1834,13 @@ void ProfileSyncService::OnInternalUnrecoverableError( |
OnUnrecoverableErrorImpl(from_here, message, delete_sync_database); |
} |
+void ProfileSyncService::UpdateInvalidatorRegistrarState() { |
+ const syncer::InvalidatorState effective_state = |
+ backend_initialized_ ? |
+ invalidator_state_ : syncer::TRANSIENT_INVALIDATION_ERROR; |
+ invalidator_registrar_->UpdateInvalidatorState(effective_state); |
+} |
+ |
void ProfileSyncService::ResetForTest() { |
Profile* profile = profile_; |
SigninManager* signin = SigninManagerFactory::GetForProfile(profile); |