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

Unified Diff: sync/notifier/non_blocking_invalidator.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/non_blocking_invalidator.h ('k') | sync/notifier/non_blocking_invalidator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/notifier/non_blocking_invalidator.cc
diff --git a/sync/notifier/non_blocking_invalidator.cc b/sync/notifier/non_blocking_invalidator.cc
index 1f68cb3d59cd0c9746d3cbd17a721876d7ede8b4..05744152e391c7dca8e89f580c7ede44f40f9c25 100644
--- a/sync/notifier/non_blocking_invalidator.cc
+++ b/sync/notifier/non_blocking_invalidator.cc
@@ -42,12 +42,10 @@ class NonBlockingInvalidator::Core
// InvalidationHandler implementation (all called on I/O thread by
// InvalidationNotifier).
- virtual void OnNotificationsEnabled() OVERRIDE;
- virtual void OnNotificationsDisabled(
- NotificationsDisabledReason reason) OVERRIDE;
- virtual void OnIncomingNotification(
+ virtual void OnInvalidatorStateChange(InvalidatorState reason) OVERRIDE;
+ virtual void OnIncomingInvalidation(
const ObjectIdStateMap& id_state_map,
- IncomingNotificationSource source) OVERRIDE;
+ IncomingInvalidationSource source) OVERRIDE;
private:
friend class
@@ -123,24 +121,18 @@ void NonBlockingInvalidator::Core::UpdateCredentials(const std::string& email,
invalidation_notifier_->UpdateCredentials(email, token);
}
-void NonBlockingInvalidator::Core::OnNotificationsEnabled() {
- DCHECK(network_task_runner_->BelongsToCurrentThread());
- delegate_observer_.Call(FROM_HERE,
- &InvalidationHandler::OnNotificationsEnabled);
-}
-
-void NonBlockingInvalidator::Core::OnNotificationsDisabled(
- NotificationsDisabledReason reason) {
+void NonBlockingInvalidator::Core::OnInvalidatorStateChange(
+ InvalidatorState reason) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
delegate_observer_.Call(
- FROM_HERE, &InvalidationHandler::OnNotificationsDisabled, reason);
+ FROM_HERE, &InvalidationHandler::OnInvalidatorStateChange, reason);
}
-void NonBlockingInvalidator::Core::OnIncomingNotification(
- const ObjectIdStateMap& id_state_map, IncomingNotificationSource source) {
+void NonBlockingInvalidator::Core::OnIncomingInvalidation(
+ const ObjectIdStateMap& id_state_map, IncomingInvalidationSource source) {
DCHECK(network_task_runner_->BelongsToCurrentThread());
delegate_observer_.Call(FROM_HERE,
- &InvalidationHandler::OnIncomingNotification,
+ &InvalidationHandler::OnIncomingInvalidation,
id_state_map,
source);
}
@@ -207,6 +199,11 @@ void NonBlockingInvalidator::UnregisterHandler(InvalidationHandler* handler) {
registrar_.UnregisterHandler(handler);
}
+InvalidatorState NonBlockingInvalidator::GetInvalidatorState() const {
+ DCHECK(parent_task_runner_->BelongsToCurrentThread());
+ return registrar_.GetInvalidatorState();
+}
+
void NonBlockingInvalidator::SetUniqueId(const std::string& unique_id) {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
if (!network_task_runner_->PostTask(
@@ -239,27 +236,21 @@ void NonBlockingInvalidator::UpdateCredentials(const std::string& email,
}
}
-void NonBlockingInvalidator::SendNotification(
+void NonBlockingInvalidator::SendInvalidation(
const ObjectIdStateMap& id_state_map) {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
- // InvalidationClient doesn't implement SendNotification(), so no
+ // InvalidationClient doesn't implement SendInvalidation(), so no
// need to forward on the call.
}
-void NonBlockingInvalidator::OnNotificationsEnabled() {
- DCHECK(parent_task_runner_->BelongsToCurrentThread());
- registrar_.EmitOnNotificationsEnabled();
-}
-
-void NonBlockingInvalidator::OnNotificationsDisabled(
- NotificationsDisabledReason reason) {
+void NonBlockingInvalidator::OnInvalidatorStateChange(InvalidatorState state) {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
- registrar_.EmitOnNotificationsDisabled(reason);
+ registrar_.UpdateInvalidatorState(state);
}
-void NonBlockingInvalidator::OnIncomingNotification(
+void NonBlockingInvalidator::OnIncomingInvalidation(
const ObjectIdStateMap& id_state_map,
- IncomingNotificationSource source) {
+ IncomingInvalidationSource source) {
DCHECK(parent_task_runner_->BelongsToCurrentThread());
registrar_.DispatchInvalidationsToHandlers(id_state_map, source);
}
« no previous file with comments | « sync/notifier/non_blocking_invalidator.h ('k') | sync/notifier/non_blocking_invalidator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698