| 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 SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_ | 5 #ifndef COMPONENTS_INVALIDATION_INVALIDATOR_REGISTRAR_H_ |
| 6 #define SYNC_NOTIFIER_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" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 13 #include "sync/base/sync_export.h" | 13 #include "components/invalidation/invalidation_export.h" |
| 14 #include "sync/notifier/invalidation_handler.h" | 14 #include "sync/notifier/invalidation_handler.h" |
| 15 #include "sync/notifier/invalidation_util.h" | 15 #include "sync/notifier/invalidation_util.h" |
| 16 | 16 |
| 17 namespace invalidation { | 17 namespace invalidation { |
| 18 class ObjectId; | 18 class ObjectId; |
| 19 } // namespace invalidation | 19 } // namespace invalidation |
| 20 | 20 |
| 21 namespace syncer { | 21 namespace syncer { |
| 22 | 22 |
| 23 class ObjectIdInvalidationMap; | 23 class ObjectIdInvalidationMap; |
| 24 | 24 |
| 25 // A helper class for implementations of the Invalidator interface. It helps | 25 // A helper class for implementations of the Invalidator interface. It helps |
| 26 // keep track of registered handlers and which object ID registrations are | 26 // keep track of registered handlers and which object ID registrations are |
| 27 // associated with which handlers, so implementors can just reuse the logic | 27 // associated with which handlers, so implementors can just reuse the logic |
| 28 // here to dispatch invalidations and other interesting notifications. | 28 // here to dispatch invalidations and other interesting notifications. |
| 29 class SYNC_EXPORT InvalidatorRegistrar { | 29 class INVALIDATION_EXPORT InvalidatorRegistrar { |
| 30 public: | 30 public: |
| 31 InvalidatorRegistrar(); | 31 InvalidatorRegistrar(); |
| 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 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 base::ThreadChecker thread_checker_; | 87 base::ThreadChecker thread_checker_; |
| 88 ObserverList<InvalidationHandler> handlers_; | 88 ObserverList<InvalidationHandler> 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 // SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_ | 97 #endif // COMPONENTS_INVALIDATION_INVALIDATOR_REGISTRAR_H_ |
| OLD | NEW |