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() { } |
}; |