OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Interface to the invalidator, which is an object that receives | 5 // Interface to the invalidator, which is an object that receives |
6 // invalidations for registered object IDs. The corresponding | 6 // invalidations for registered object IDs. The corresponding |
7 // InvalidationHandler is notifier when such an event occurs. | 7 // InvalidationHandler is notifier when such an event occurs. |
8 | 8 |
9 #ifndef SYNC_NOTIFIER_INVALIDATOR_H_ | 9 #ifndef SYNC_NOTIFIER_INVALIDATOR_H_ |
10 #define SYNC_NOTIFIER_INVALIDATOR_H_ | 10 #define SYNC_NOTIFIER_INVALIDATOR_H_ |
(...skipping 30 matching lines...) Expand all Loading... |
41 // invalidator->UnregisterHandler(client_handler); | 41 // invalidator->UnregisterHandler(client_handler); |
42 // | 42 // |
43 // Note that there's no call to UpdateRegisteredIds() -- this is because the | 43 // Note that there's no call to UpdateRegisteredIds() -- this is because the |
44 // invalidation API persists registrations across browser restarts. | 44 // invalidation API persists registrations across browser restarts. |
45 // | 45 // |
46 // When permanently shutting down the client, e.g. when disabling the related | 46 // When permanently shutting down the client, e.g. when disabling the related |
47 // feature: | 47 // feature: |
48 // | 48 // |
49 // invalidator->UpdateRegisteredIds(client_handler, ObjectIdSet()); | 49 // invalidator->UpdateRegisteredIds(client_handler, ObjectIdSet()); |
50 // invalidator->UnregisterHandler(client_handler); | 50 // invalidator->UnregisterHandler(client_handler); |
| 51 // |
| 52 // It is an error to have registered handlers when an invalidator is |
| 53 // destroyed; clients must ensure that they unregister themselves |
| 54 // before then. |
51 | 55 |
52 // Starts sending notifications to |handler|. |handler| must not be NULL, | 56 // Starts sending notifications to |handler|. |handler| must not be NULL, |
53 // and it must not already be registered. | 57 // and it must not already be registered. |
54 virtual void RegisterHandler(InvalidationHandler* handler) = 0; | 58 virtual void RegisterHandler(InvalidationHandler* handler) = 0; |
55 | 59 |
56 // Updates the set of ObjectIds associated with |handler|. |handler| must | 60 // Updates the set of ObjectIds associated with |handler|. |handler| must |
57 // not be NULL, and must already be registered. An ID must be registered for | 61 // not be NULL, and must already be registered. An ID must be registered for |
58 // at most one handler. | 62 // at most one handler. |
59 virtual void UpdateRegisteredIds(InvalidationHandler* handler, | 63 virtual void UpdateRegisteredIds(InvalidationHandler* handler, |
60 const ObjectIdSet& ids) = 0; | 64 const ObjectIdSet& ids) = 0; |
(...skipping 27 matching lines...) Expand all Loading... |
88 // This is here only to support the old p2p notification implementation, | 92 // This is here only to support the old p2p notification implementation, |
89 // which is still used by sync integration tests. | 93 // which is still used by sync integration tests. |
90 // TODO(akalin): Remove this once we move the integration tests off p2p | 94 // TODO(akalin): Remove this once we move the integration tests off p2p |
91 // notifications. | 95 // notifications. |
92 virtual void SendInvalidation( | 96 virtual void SendInvalidation( |
93 const ObjectIdInvalidationMap& invalidation_map) = 0; | 97 const ObjectIdInvalidationMap& invalidation_map) = 0; |
94 }; | 98 }; |
95 } // namespace syncer | 99 } // namespace syncer |
96 | 100 |
97 #endif // SYNC_NOTIFIER_INVALIDATOR_H_ | 101 #endif // SYNC_NOTIFIER_INVALIDATOR_H_ |
OLD | NEW |