OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_ | 5 #ifndef SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_ |
6 #define SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_ | 6 #define SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Updates the invalidator state to the given one and then notifies | 64 // Updates the invalidator state to the given one and then notifies |
65 // all handlers. Note that the order is important; handlers that | 65 // all handlers. Note that the order is important; handlers that |
66 // call GetInvalidatorState() when notified will see the new state. | 66 // call GetInvalidatorState() when notified will see the new state. |
67 void UpdateInvalidatorState(InvalidatorState state); | 67 void UpdateInvalidatorState(InvalidatorState state); |
68 | 68 |
69 // Returns the current invalidator state. When called from within | 69 // Returns the current invalidator state. When called from within |
70 // InvalidationHandler::OnInvalidatorStateChange(), this returns the | 70 // InvalidationHandler::OnInvalidatorStateChange(), this returns the |
71 // updated state. | 71 // updated state. |
72 InvalidatorState GetInvalidatorState() const; | 72 InvalidatorState GetInvalidatorState() const; |
73 | 73 |
| 74 // Gets a new map for the name of invalidator handlers and their |
| 75 // objects id. This is used by the InvalidatorLogger to be able |
| 76 // to display every registered handlers and its objectsIds. |
| 77 std::map<std::string, ObjectIdSet> GetSanitizedHandlersIdsMap(); |
| 78 |
74 bool IsHandlerRegisteredForTest(InvalidationHandler* handler) const; | 79 bool IsHandlerRegisteredForTest(InvalidationHandler* handler) const; |
75 | 80 |
76 // Needed for death tests. | 81 // Needed for death tests. |
77 void DetachFromThreadForTest(); | 82 void DetachFromThreadForTest(); |
78 | 83 |
79 private: | 84 private: |
80 typedef std::map<InvalidationHandler*, ObjectIdSet> HandlerIdsMap; | 85 typedef std::map<InvalidationHandler*, ObjectIdSet> HandlerIdsMap; |
81 | 86 |
82 base::ThreadChecker thread_checker_; | 87 base::ThreadChecker thread_checker_; |
83 ObserverList<InvalidationHandler> handlers_; | 88 ObserverList<InvalidationHandler> handlers_; |
84 HandlerIdsMap handler_to_ids_map_; | 89 HandlerIdsMap handler_to_ids_map_; |
85 InvalidatorState state_; | 90 InvalidatorState state_; |
86 | 91 |
87 DISALLOW_COPY_AND_ASSIGN(InvalidatorRegistrar); | 92 DISALLOW_COPY_AND_ASSIGN(InvalidatorRegistrar); |
88 }; | 93 }; |
89 | 94 |
90 } // namespace syncer | 95 } // namespace syncer |
91 | 96 |
92 #endif // SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_ | 97 #endif // SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_ |
OLD | NEW |