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

Unified Diff: sync/notifier/chrome_invalidation_client.cc

Issue 10824140: Add InvalidationStateTracker::Forget() to erase an entry from storage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix sync_client target 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/chrome_invalidation_client.h ('k') | sync/notifier/fake_invalidation_state_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/notifier/chrome_invalidation_client.cc
diff --git a/sync/notifier/chrome_invalidation_client.cc b/sync/notifier/chrome_invalidation_client.cc
index e2f406d7760f4d16003fce73b442046b1544af31..938f7e679bb922c711acc1b4957eb4ca14a5182f 100644
--- a/sync/notifier/chrome_invalidation_client.cc
+++ b/sync/notifier/chrome_invalidation_client.cc
@@ -109,9 +109,8 @@ void ChromeInvalidationClient::UpdateRegisteredIds(const ObjectIdSet& ids) {
// working XMPP connection (as observed by us), so check it instead
// of GetState() (see http://crbug.com/139424).
if (ticl_state_ == NO_NOTIFICATION_ERROR && registration_manager_.get()) {
- registration_manager_->UpdateRegisteredIds(registered_ids_);
+ DoRegistrationUpdate();
}
- // TODO(akalin): Clear invalidation versions for unregistered types.
}
void ChromeInvalidationClient::Ready(
@@ -120,7 +119,7 @@ void ChromeInvalidationClient::Ready(
DCHECK_EQ(client, invalidation_client_.get());
ticl_state_ = NO_NOTIFICATION_ERROR;
EmitStateChange();
- registration_manager_->UpdateRegisteredIds(registered_ids_);
+ DoRegistrationUpdate();
}
void ChromeInvalidationClient::Invalidate(
@@ -244,10 +243,14 @@ void ChromeInvalidationClient::InformRegistrationFailure(
// |registration_manager_| handle the registration backoff policy.
registration_manager_->MarkRegistrationLost(object_id);
} else {
- // Non-transient failures are permanent, so block any future
- // registration requests for |model_type|. (This happens if the
- // server doesn't recognize the data type, which could happen for
- // brand-new data types.)
+ // Non-transient failures require an action to resolve. This could happen
+ // because:
+ // - the server doesn't yet recognize the data type, which could happen for
+ // brand-new data types.
+ // - the user has changed his password and hasn't updated it yet locally.
+ // Either way, block future registration attempts for |object_id|. However,
+ // we don't forget any saved invalidation state since we may use it once the
+ // error is addressed.
registration_manager_->DisableId(object_id);
}
}
@@ -285,6 +288,14 @@ void ChromeInvalidationClient::WriteState(const std::string& state) {
FROM_HERE, &InvalidationStateTracker::SetInvalidationState, state);
}
+void ChromeInvalidationClient::DoRegistrationUpdate() {
+ DCHECK(CalledOnValidThread());
+ const ObjectIdSet& unregistered_ids =
+ registration_manager_->UpdateRegisteredIds(registered_ids_);
+ invalidation_state_tracker_.Call(
+ FROM_HERE, &InvalidationStateTracker::Forget, unregistered_ids);
+}
+
void ChromeInvalidationClient::StopForTest() {
DCHECK(CalledOnValidThread());
Stop();
« no previous file with comments | « sync/notifier/chrome_invalidation_client.h ('k') | sync/notifier/fake_invalidation_state_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698