Chromium Code Reviews| Index: sync/notifier/chrome_invalidation_client.cc |
| diff --git a/sync/notifier/chrome_invalidation_client.cc b/sync/notifier/chrome_invalidation_client.cc |
| index 8b9cd4fda6765a1429de57e1e0b30720ac7b4a59..d34dbf6f1c015fe09c74e9d8b7502fba370e71ce 100644 |
| --- a/sync/notifier/chrome_invalidation_client.cc |
| +++ b/sync/notifier/chrome_invalidation_client.cc |
| @@ -107,16 +107,15 @@ void ChromeInvalidationClient::RegisterIds(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_->SetRegisteredIds(registered_ids_); |
| + DoRegistrationUpdate(); |
| } |
| - // TODO(akalin): Clear invalidation versions for unregistered types. |
| } |
| void ChromeInvalidationClient::Ready( |
| invalidation::InvalidationClient* client) { |
| ticl_state_ = NO_NOTIFICATION_ERROR; |
| EmitStateChange(); |
| - registration_manager_->SetRegisteredIds(registered_ids_); |
| + DoRegistrationUpdate(); |
| } |
| void ChromeInvalidationClient::Invalidate( |
| @@ -273,6 +272,18 @@ void ChromeInvalidationClient::WriteState(const std::string& state) { |
| FROM_HERE, &InvalidationStateTracker::SetInvalidationState, state); |
| } |
| +void ChromeInvalidationClient::DoRegistrationUpdate() { |
| + DCHECK(CalledOnValidThread()); |
| + const ObjectIdSet& unregistered_ids = |
| + registration_manager_->SetRegisteredIds(registered_ids_); |
| + for (ObjectIdSet::const_iterator it = unregistered_ids.begin(); |
| + it != unregistered_ids.end(); |
| + ++it) { |
| + invalidation_state_tracker_.Call( |
|
akalin
2012/08/02 07:04:30
you trigger a post on another thread for each ID,
|
| + FROM_HERE, &InvalidationStateTracker::Forget, *it); |
| + } |
| +} |
| + |
| void ChromeInvalidationClient::Stop() { |
| DCHECK(CalledOnValidThread()); |
| if (!invalidation_client_.get()) { |