Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: sync/notifier/invalidator_registrar.h

Issue 10916131: [Invalidations] Add GetInvalidatorState() to Invalidator{,Frontend} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix android Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/notifier/invalidator_factory_unittest.cc ('k') | sync/notifier/invalidator_registrar.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 // Returns the set of all IDs that are registered to some handler (even 49 // Returns the set of all IDs that are registered to some handler (even
50 // handlers that have been unregistered). 50 // handlers that have been unregistered).
51 ObjectIdSet GetAllRegisteredIds() const; 51 ObjectIdSet GetAllRegisteredIds() const;
52 52
53 // Sorts incoming invalidations into a bucket for each handler and then 53 // Sorts incoming invalidations into a bucket for each handler and then
54 // dispatches the batched invalidations to the corresponding handler. 54 // dispatches the batched invalidations to the corresponding handler.
55 // Invalidations for IDs with no corresponding handler are dropped, as are 55 // Invalidations for IDs with no corresponding handler are dropped, as are
56 // invalidations for handlers that are not added. 56 // invalidations for handlers that are not added.
57 void DispatchInvalidationsToHandlers(const ObjectIdStateMap& id_state_map, 57 void DispatchInvalidationsToHandlers(const ObjectIdStateMap& id_state_map,
58 IncomingNotificationSource source); 58 IncomingInvalidationSource source);
59 59
60 // Calls the given handler method for each handler that has registered IDs. 60 // Updates the invalidator state to the given one and then notifies
61 void EmitOnNotificationsEnabled(); 61 // all handlers. Note that the order is important; handlers that
62 void EmitOnNotificationsDisabled(NotificationsDisabledReason reason); 62 // call GetInvalidatorState() when notified will see the new state.
63 void UpdateInvalidatorState(InvalidatorState state);
64
65 // Returns the current invalidator state. When called from within
66 // InvalidationHandler::OnInvalidatorStateChange(), this returns the
67 // updated state.
68 InvalidatorState GetInvalidatorState() const;
63 69
64 bool IsHandlerRegisteredForTest(InvalidationHandler* handler) const; 70 bool IsHandlerRegisteredForTest(InvalidationHandler* handler) const;
65 71
66 // Needed for death tests. 72 // Needed for death tests.
67 void DetachFromThreadForTest(); 73 void DetachFromThreadForTest();
68 74
69 private: 75 private:
70 typedef std::map<invalidation::ObjectId, InvalidationHandler*, 76 typedef std::map<invalidation::ObjectId, InvalidationHandler*,
71 ObjectIdLessThan> 77 ObjectIdLessThan>
72 IdHandlerMap; 78 IdHandlerMap;
73 79
74 InvalidationHandler* ObjectIdToHandler(const invalidation::ObjectId& id); 80 InvalidationHandler* ObjectIdToHandler(const invalidation::ObjectId& id);
75 81
76 base::ThreadChecker thread_checker_; 82 base::ThreadChecker thread_checker_;
77 ObserverList<InvalidationHandler> handlers_; 83 ObserverList<InvalidationHandler> handlers_;
78 IdHandlerMap id_to_handler_map_; 84 IdHandlerMap id_to_handler_map_;
85 InvalidatorState state_;
79 86
80 DISALLOW_COPY_AND_ASSIGN(InvalidatorRegistrar); 87 DISALLOW_COPY_AND_ASSIGN(InvalidatorRegistrar);
81 }; 88 };
82 89
83 } // namespace syncer 90 } // namespace syncer
84 91
85 #endif // SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_ 92 #endif // SYNC_NOTIFIER_INVALIDATOR_REGISTRAR_H_
OLDNEW
« no previous file with comments | « sync/notifier/invalidator_factory_unittest.cc ('k') | sync/notifier/invalidator_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698