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

Unified Diff: sync/notifier/invalidation_notifier.cc

Issue 10824161: [Sync] Avoid unregistering object IDs on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use new API 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
Index: sync/notifier/invalidation_notifier.cc
diff --git a/sync/notifier/invalidation_notifier.cc b/sync/notifier/invalidation_notifier.cc
index 3a72f32fa61ace7acc53ca566d9ccfe210599e51..8c6871b7bb22aded9f837d5ba30ea13d83467ce8 100644
--- a/sync/notifier/invalidation_notifier.cc
+++ b/sync/notifier/invalidation_notifier.cc
@@ -34,10 +34,22 @@ InvalidationNotifier::~InvalidationNotifier() {
DCHECK(CalledOnValidThread());
}
+void InvalidationNotifier::RegisterHandler(SyncNotifierObserver* handler) {
+ DCHECK(CalledOnValidThread());
+ registrar_.RegisterHandler(handler);
+}
+
void InvalidationNotifier::UpdateRegisteredIds(SyncNotifierObserver* handler,
const ObjectIdSet& ids) {
DCHECK(CalledOnValidThread());
- invalidation_client_.RegisterIds(helper_.UpdateRegisteredIds(handler, ids));
+ registrar_.UpdateRegisteredIds(handler, ids);
+ const ObjectIdSet& all_registered_ids = registrar_.GetAllRegisteredIds();
+ invalidation_client_.RegisterIds(all_registered_ids);
msw 2012/08/09 05:20:26 nit: pass registrar_.GetAllRegisteredIds() and nix
akalin 2012/08/10 01:28:08 Done.
+}
+
+void InvalidationNotifier::UnregisterHandler(SyncNotifierObserver* handler) {
+ DCHECK(CalledOnValidThread());
+ registrar_.UnregisterHandler(handler);
}
void InvalidationNotifier::SetUniqueId(const std::string& unique_id) {
@@ -88,18 +100,18 @@ void InvalidationNotifier::SendNotification(ModelTypeSet changed_types) {
void InvalidationNotifier::OnInvalidate(const ObjectIdPayloadMap& id_payloads) {
DCHECK(CalledOnValidThread());
- helper_.DispatchInvalidationsToHandlers(id_payloads, REMOTE_NOTIFICATION);
+ registrar_.DispatchInvalidationsToHandlers(id_payloads, REMOTE_NOTIFICATION);
}
void InvalidationNotifier::OnNotificationsEnabled() {
DCHECK(CalledOnValidThread());
- helper_.EmitOnNotificationsEnabled();
+ registrar_.EmitOnNotificationsEnabled();
}
void InvalidationNotifier::OnNotificationsDisabled(
NotificationsDisabledReason reason) {
DCHECK(CalledOnValidThread());
- helper_.EmitOnNotificationsDisabled(reason);
+ registrar_.EmitOnNotificationsDisabled(reason);
}
} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698