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

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

Issue 10824161: [Sync] Avoid unregistering object IDs on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Work around brittle unit test Created 8 years, 4 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
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/profile_sync_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ca3926fc6acb27490d83a7f577754ec6b2792c48..d18185fb20d35e134e01b0bd1555fcb57fa510b7 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -428,7 +428,8 @@ void ProfileSyncService::StartUp() {
// TODO(akalin): Fix this horribly non-intuitive behavior (see
// http://crbug.com/140354).
if (backend_.get()) {
- backend_->UpdateRegisteredInvalidationIds(all_registered_ids_);
+ backend_->UpdateRegisteredInvalidationIds(
+ notifier_registrar_.GetAllRegisteredIds());
}
if (!sync_global_error_.get()) {
@@ -441,17 +442,29 @@ void ProfileSyncService::StartUp() {
}
}
+void ProfileSyncService::RegisterInvalidationHandler(
+ syncer::SyncNotifierObserver* handler) {
+ notifier_registrar_.RegisterHandler(handler);
+}
+
void ProfileSyncService::UpdateRegisteredInvalidationIds(
syncer::SyncNotifierObserver* handler,
const syncer::ObjectIdSet& ids) {
- all_registered_ids_ = notifier_helper_.UpdateRegisteredIds(handler, ids);
+ notifier_registrar_.UpdateRegisteredIds(handler, ids);
+
// If |backend_| is NULL, its registered IDs will be updated when
// it's created and initialized.
if (backend_.get()) {
- backend_->UpdateRegisteredInvalidationIds(all_registered_ids_);
+ backend_->UpdateRegisteredInvalidationIds(
+ notifier_registrar_.GetAllRegisteredIds());
}
}
+void ProfileSyncService::UnregisterInvalidationHandler(
+ syncer::SyncNotifierObserver* handler) {
+ notifier_registrar_.UnregisterHandler(handler);
+}
+
void ProfileSyncService::Shutdown() {
ShutdownImpl(false);
}
@@ -464,7 +477,6 @@ void ProfileSyncService::ShutdownImpl(bool sync_disabled) {
base::Time shutdown_start_time = base::Time::Now();
if (backend_.get()) {
backend_->StopSyncingForShutdown();
- backend_->UpdateRegisteredInvalidationIds(syncer::ObjectIdSet());
}
// Stop all data type controllers, if needed. Note that until Stop
@@ -659,18 +671,18 @@ void ProfileSyncService::DisableBrokenDatatype(
}
void ProfileSyncService::OnNotificationsEnabled() {
- notifier_helper_.EmitOnNotificationsEnabled();
+ notifier_registrar_.EmitOnNotificationsEnabled();
}
void ProfileSyncService::OnNotificationsDisabled(
syncer::NotificationsDisabledReason reason) {
- notifier_helper_.EmitOnNotificationsDisabled(reason);
+ notifier_registrar_.EmitOnNotificationsDisabled(reason);
}
void ProfileSyncService::OnIncomingNotification(
const syncer::ObjectIdPayloadMap& id_payloads,
syncer::IncomingNotificationSource source) {
- notifier_helper_.DispatchInvalidationsToHandlers(id_payloads, source);
+ notifier_registrar_.DispatchInvalidationsToHandlers(id_payloads, source);
}
void ProfileSyncService::OnBackendInitialized(
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/profile_sync_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698