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

Unified Diff: sync/notifier/invalidator_registrar.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/notifier/invalidator_registrar.h ('k') | sync/notifier/invalidator_registrar_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/notifier/invalidator_registrar.cc
diff --git a/sync/notifier/invalidator_registrar.cc b/sync/notifier/invalidator_registrar.cc
index 03b401a3505661e1bd760b77462754b9ff1a3e3f..65cb3180e14ffac293bea043dab8e21014aa286c 100644
--- a/sync/notifier/invalidator_registrar.cc
+++ b/sync/notifier/invalidator_registrar.cc
@@ -11,7 +11,8 @@
namespace syncer {
-InvalidatorRegistrar::InvalidatorRegistrar() {}
+InvalidatorRegistrar::InvalidatorRegistrar()
+ : state_(DEFAULT_INVALIDATION_ERROR) {}
InvalidatorRegistrar::~InvalidatorRegistrar() {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -88,7 +89,7 @@ ObjectIdSet InvalidatorRegistrar::GetAllRegisteredIds() const {
void InvalidatorRegistrar::DispatchInvalidationsToHandlers(
const ObjectIdStateMap& id_state_map,
- IncomingNotificationSource source) {
+ IncomingInvalidationSource source) {
DCHECK(thread_checker_.CalledOnValidThread());
// If we have no handlers, there's nothing to do.
if (!handlers_.might_have_observers()) {
@@ -111,20 +112,20 @@ void InvalidatorRegistrar::DispatchInvalidationsToHandlers(
while ((handler = it.GetNext()) != NULL) {
DispatchMap::const_iterator dispatch_it = dispatch_map.find(handler);
if (dispatch_it != dispatch_map.end())
- handler->OnIncomingNotification(dispatch_it->second, source);
+ handler->OnIncomingInvalidation(dispatch_it->second, source);
}
}
-void InvalidatorRegistrar::EmitOnNotificationsEnabled() {
+void InvalidatorRegistrar::UpdateInvalidatorState(InvalidatorState state) {
DCHECK(thread_checker_.CalledOnValidThread());
- FOR_EACH_OBSERVER(InvalidationHandler, handlers_, OnNotificationsEnabled());
+ state_ = state;
+ FOR_EACH_OBSERVER(InvalidationHandler, handlers_,
+ OnInvalidatorStateChange(state));
}
-void InvalidatorRegistrar::EmitOnNotificationsDisabled(
- NotificationsDisabledReason reason) {
+InvalidatorState InvalidatorRegistrar::GetInvalidatorState() const {
DCHECK(thread_checker_.CalledOnValidThread());
- FOR_EACH_OBSERVER(InvalidationHandler, handlers_,
- OnNotificationsDisabled(reason));
+ return state_;
}
bool InvalidatorRegistrar::IsHandlerRegisteredForTest(
« no previous file with comments | « sync/notifier/invalidator_registrar.h ('k') | sync/notifier/invalidator_registrar_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698