OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_INVALIDATION_INVALIDATOR_REGISTRAR_H_ | 5 #ifndef COMPONENTS_INVALIDATION_INVALIDATOR_REGISTRAR_H_ |
6 #define COMPONENTS_INVALIDATION_INVALIDATOR_REGISTRAR_H_ | 6 #define COMPONENTS_INVALIDATION_INVALIDATOR_REGISTRAR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 // It is an error to have registered handlers on destruction. | 33 // It is an error to have registered handlers on destruction. |
34 ~InvalidatorRegistrar(); | 34 ~InvalidatorRegistrar(); |
35 | 35 |
36 // Starts sending notifications to |handler|. |handler| must not be NULL, | 36 // Starts sending notifications to |handler|. |handler| must not be NULL, |
37 // and it must already be registered. | 37 // and it must already be registered. |
38 void RegisterHandler(InvalidationHandler* handler); | 38 void RegisterHandler(InvalidationHandler* handler); |
39 | 39 |
40 // Updates the set of ObjectIds associated with |handler|. |handler| must | 40 // Updates the set of ObjectIds associated with |handler|. |handler| must |
41 // not be NULL, and must already be registered. An ID must be registered for | 41 // not be NULL, and must already be registered. An ID must be registered for |
42 // at most one handler. | 42 // at most one handler. If ID is already registered function returns false. |
43 void UpdateRegisteredIds(InvalidationHandler* handler, | 43 bool UpdateRegisteredIds(InvalidationHandler* handler, |
44 const ObjectIdSet& ids); | 44 const ObjectIdSet& ids) WARN_UNUSED_RESULT; |
45 | 45 |
46 // Stops sending notifications to |handler|. |handler| must not be NULL, and | 46 // Stops sending notifications to |handler|. |handler| must not be NULL, and |
47 // it must already be registered. Note that this doesn't unregister the IDs | 47 // it must already be registered. Note that this doesn't unregister the IDs |
48 // associated with |handler|. | 48 // associated with |handler|. |
49 void UnregisterHandler(InvalidationHandler* handler); | 49 void UnregisterHandler(InvalidationHandler* handler); |
50 | 50 |
51 ObjectIdSet GetRegisteredIds(InvalidationHandler* handler) const; | 51 ObjectIdSet GetRegisteredIds(InvalidationHandler* handler) const; |
52 | 52 |
53 // Returns the set of all IDs that are registered to some handler (even | 53 // Returns the set of all IDs that are registered to some handler (even |
54 // handlers that have been unregistered). | 54 // handlers that have been unregistered). |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 ObserverList<InvalidationHandler, true> handlers_; | 88 ObserverList<InvalidationHandler, true> handlers_; |
89 HandlerIdsMap handler_to_ids_map_; | 89 HandlerIdsMap handler_to_ids_map_; |
90 InvalidatorState state_; | 90 InvalidatorState state_; |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(InvalidatorRegistrar); | 92 DISALLOW_COPY_AND_ASSIGN(InvalidatorRegistrar); |
93 }; | 93 }; |
94 | 94 |
95 } // namespace syncer | 95 } // namespace syncer |
96 | 96 |
97 #endif // COMPONENTS_INVALIDATION_INVALIDATOR_REGISTRAR_H_ | 97 #endif // COMPONENTS_INVALIDATION_INVALIDATOR_REGISTRAR_H_ |
OLD | NEW |