Chromium Code Reviews| 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 af0299b953503f2c7c69d2580da708f882a4aaea..3ec5f28806fe22c50656f37fd191d8eded379281 100644 |
| --- a/chrome/browser/sync/profile_sync_service.cc |
| +++ b/chrome/browser/sync/profile_sync_service.cc |
| @@ -422,6 +422,14 @@ void ProfileSyncService::StartUp() { |
| // be there. |
| InitializeBackend(!HasSyncSetupCompleted()); |
| + // |backend_| may end up being NULL here in tests (in synchronous |
| + // |initialization mode). |
|
tim (not reviewing)
2012/08/01 21:52:52
What would it take to get rid of synchronous initi
akalin
2012/08/02 08:05:43
Actually, it might be easy now. I think I put tha
|
| + // |
| + // TODO(akalin): Fix this horribly non-intuitive behavior. |
| + if (backend_.get()) { |
| + backend_->UpdateRegisteredIds(all_registered_ids_); |
| + } |
| + |
| if (!sync_global_error_.get()) { |
| #if !defined(OS_ANDROID) |
| sync_global_error_.reset(new SyncGlobalError(this, signin())); |
| @@ -432,6 +440,17 @@ void ProfileSyncService::StartUp() { |
| } |
| } |
| +void ProfileSyncService::UpdateRegisteredIds( |
| + syncer::SyncNotifierObserver* handler, |
| + const syncer::ObjectIdSet& ids) { |
| + all_registered_ids_ = notifier_helper_.UpdateRegisteredIds(handler, ids); |
| + // If |backend_| is NULL, its registered IDs will be updated when |
| + // it's created and initialized. |
| + if (backend_.get()) { |
| + backend_->UpdateRegisteredIds(all_registered_ids_); |
| + } |
| +} |
| + |
| void ProfileSyncService::Shutdown() { |
| ShutdownImpl(false); |
| } |
| @@ -442,8 +461,10 @@ void ProfileSyncService::ShutdownImpl(bool sync_disabled) { |
| // applying changes to the sync db that wouldn't get applied via |
| // ChangeProcessors, leading to back-from-the-dead bugs. |
| base::Time shutdown_start_time = base::Time::Now(); |
| - if (backend_.get()) |
| + if (backend_.get()) { |
| backend_->StopSyncingForShutdown(); |
| + backend_->UpdateRegisteredIds(syncer::ObjectIdSet()); |
| + } |
| // Stop all data type controllers, if needed. Note that until Stop |
| // completes, it is possible in theory to have a ChangeProcessor apply a |
| @@ -636,6 +657,21 @@ void ProfileSyncService::DisableBrokenDatatype( |
| weak_factory_.GetWeakPtr())); |
| } |
| +void ProfileSyncService::OnNotificationsEnabled() { |
| + notifier_helper_.EmitOnNotificationsEnabled(); |
| +} |
| + |
| +void ProfileSyncService::OnNotificationsDisabled( |
| + syncer::NotificationsDisabledReason reason) { |
| + notifier_helper_.EmitOnNotificationsDisabled(reason); |
| +} |
| + |
| +void ProfileSyncService::OnIncomingNotification( |
| + const syncer::ObjectIdPayloadMap& id_payloads, |
| + syncer::IncomingNotificationSource source) { |
| + notifier_helper_.DispatchInvalidationsToHandlers(id_payloads, source); |
| +} |
| + |
| void ProfileSyncService::OnBackendInitialized( |
| const syncer::WeakHandle<syncer::JsBackend>& js_backend, bool success) { |
| is_first_time_sync_configure_ = !HasSyncSetupCompleted(); |