summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/profile_sync_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/sync/profile_sync_service.h')
-rw-r--r--chrome/browser/sync/profile_sync_service.h58
1 files changed, 48 insertions, 10 deletions
diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h
index 3e3e14c..6e8ea6e 100644
--- a/chrome/browser/sync/profile_sync_service.h
+++ b/chrome/browser/sync/profile_sync_service.h
@@ -38,7 +38,7 @@
#include "sync/internal_api/public/util/experiments.h"
#include "sync/internal_api/public/util/unrecoverable_error_handler.h"
#include "sync/js/sync_js_controller.h"
-#include "sync/notifier/sync_notifier_helper.h"
+#include "sync/notifier/sync_notifier_registrar.h"
class Profile;
class ProfileSyncComponentsFactory;
@@ -552,15 +552,56 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
// been cleared yet. Virtual for testing purposes.
virtual bool waiting_for_auth() const;
- // Updates the set of ObjectIds associated with a given |handler|.
- // Passing an empty ObjectIdSet will unregister |handler|.
- // There should be at most one handler registered per object id.
+ // Invalidation clients should follow the pattern below:
//
- // The handler -> registered ids map is persisted across restarts of
- // sync.
+ // When starting the client:
+ //
+ // pss->RegisterInvalidationHandler(client_handler);
+ //
+ // When the set of IDs to register changes for the client during its lifetime
+ // (i.e., between calls to RegisterInvalidationHandler(client_handler) and
+ // UnregisterInvalidationHandler(client_handler):
+ //
+ // pss->UpdateRegisteredInvalidationIds(client_handler, client_ids);
+ //
+ // When shutting down the client for browser shutdown:
+ //
+ // pss->UnregisterInvalidationHandler(client_handler);
+ //
+ // Note that there's no call to UpdateRegisteredIds() -- this is because the
+ // invalidation API persists registrations across browser restarts.
+ //
+ // When permanently shutting down the client, e.g. when disabling the related
+ // feature:
+ //
+ // pss->UpdateRegisteredInvalidationIds(client_handler, ObjectIdSet());
+ // pss->UnregisterInvalidationHandler(client_handler);
+
+ // NOTE(akalin): Invalidations that come in during browser shutdown may get
+ // dropped. This won't matter once we have an Acknowledge API, though: see
+ // http://crbug.com/78462 and http://crbug.com/124149.
+
+ // Starts sending notifications to |handler|. |handler| must not be NULL,
+ // and it must already be registered.
+ //
+ // Handler registrations are persisted across restarts of sync.
+ void RegisterInvalidationHandler(syncer::SyncNotifierObserver* handler);
+
+ // Updates the set of ObjectIds associated with |handler|. |handler| must
+ // not be NULL, and must already be registered. An ID must be registered for
+ // at most one handler.
+ //
+ // Registered IDs are persisted across restarts of sync.
void UpdateRegisteredInvalidationIds(syncer::SyncNotifierObserver* handler,
const syncer::ObjectIdSet& ids);
+ // Stops sending notifications to |handler|. |handler| must not be NULL, and
+ // it must already be registered. Note that this doesn't unregister the IDs
+ // associated with |handler|.
+ //
+ // Handler registrations are persisted across restarts of sync.
+ void UnregisterInvalidationHandler(syncer::SyncNotifierObserver* handler);
+
// ProfileKeyedService implementation.
virtual void Shutdown() OVERRIDE;
@@ -835,11 +876,8 @@ class ProfileSyncService : public browser_sync::SyncFrontend,
// Factory the backend will use to build the SyncManager.
syncer::SyncManagerFactory sync_manager_factory_;
- // The set of all registered IDs.
- syncer::ObjectIdSet all_registered_ids_;
-
// Dispatches invalidations to handlers.
- syncer::SyncNotifierHelper notifier_helper_;
+ syncer::SyncNotifierRegistrar notifier_registrar_;
DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
};