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

Unified Diff: chrome/browser/sync/invalidation_frontend.h

Issue 10916131: [Invalidations] Add GetInvalidatorState() to Invalidator{,Frontend} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix android Created 8 years, 3 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/glue/sync_backend_host_unittest.cc ('k') | chrome/browser/sync/profile_sync_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/invalidation_frontend.h
diff --git a/chrome/browser/sync/invalidation_frontend.h b/chrome/browser/sync/invalidation_frontend.h
index 87d6a97ab7aaca44a2b17404208a8c73fbb29870..3076b6138b97e9f75ceaa9c9c18c8169264eb4c2 100644
--- a/chrome/browser/sync/invalidation_frontend.h
+++ b/chrome/browser/sync/invalidation_frontend.h
@@ -13,6 +13,43 @@ class InvalidationHandler;
// Interface for classes that handle invalidation registrations and send out
// invalidations to register handlers.
+//
+// Invalidation clients should follow the pattern below:
+//
+// When starting the client:
+//
+// frontend->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):
+//
+// frontend->UpdateRegisteredInvalidationIds(client_handler, client_ids);
+//
+// When shutting down the client for browser shutdown:
+//
+// frontend->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:
+//
+// frontend->UpdateRegisteredInvalidationIds(client_handler, ObjectIdSet());
+// frontend->UnregisterInvalidationHandler(client_handler);
+//
+// If an invalidation handler cares about the invalidator state, it should also
+// do the following when starting the client:
+//
+// invalidator_state = frontend->GetInvalidatorState();
+//
+// It can also do the above in OnInvalidatorStateChange(), or it can use the
+// argument to OnInvalidatorStateChange().
+//
+// 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.
class InvalidationFrontend {
public:
// Starts sending notifications to |handler|. |handler| must not be NULL,
@@ -39,6 +76,11 @@ class InvalidationFrontend {
virtual void UnregisterInvalidationHandler(
syncer::InvalidationHandler* handler) = 0;
+ // Returns the current invalidator state. When called from within
+ // InvalidationHandler::OnInvalidatorStateChange(), this must return
+ // the updated state.
+ virtual syncer::InvalidatorState GetInvalidatorState() const = 0;
+
protected:
virtual ~InvalidationFrontend() { }
};
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_unittest.cc ('k') | chrome/browser/sync/profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698