OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "chrome/browser/invalidation/ticl_invalidation_service.h" | 5 #include "chrome/browser/invalidation/ticl_invalidation_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/invalidation/gcm_network_channel_delegate_impl.h" | 10 #include "chrome/browser/invalidation/gcm_network_channel_delegate_impl.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 syncer::InvalidationHandler* handler, | 118 syncer::InvalidationHandler* handler, |
119 const syncer::ObjectIdSet& ids) { | 119 const syncer::ObjectIdSet& ids) { |
120 DCHECK(CalledOnValidThread()); | 120 DCHECK(CalledOnValidThread()); |
121 DVLOG(2) << "Registering ids: " << ids.size(); | 121 DVLOG(2) << "Registering ids: " << ids.size(); |
122 invalidator_registrar_->UpdateRegisteredIds(handler, ids); | 122 invalidator_registrar_->UpdateRegisteredIds(handler, ids); |
123 if (invalidator_) { | 123 if (invalidator_) { |
124 invalidator_->UpdateRegisteredIds( | 124 invalidator_->UpdateRegisteredIds( |
125 this, | 125 this, |
126 invalidator_registrar_->GetAllRegisteredIds()); | 126 invalidator_registrar_->GetAllRegisteredIds()); |
127 } | 127 } |
| 128 |
| 129 // Log this update ids call |
| 130 logger_.OnUpdateIds(invalidator_registrar_->GetSanitizedHandlersIdsMap()); |
128 } | 131 } |
129 | 132 |
130 void TiclInvalidationService::UnregisterInvalidationHandler( | 133 void TiclInvalidationService::UnregisterInvalidationHandler( |
131 syncer::InvalidationHandler* handler) { | 134 syncer::InvalidationHandler* handler) { |
132 DCHECK(CalledOnValidThread()); | 135 DCHECK(CalledOnValidThread()); |
133 DVLOG(2) << "Unregistering"; | 136 DVLOG(2) << "Unregistering"; |
134 invalidator_registrar_->UnregisterHandler(handler); | 137 invalidator_registrar_->UnregisterHandler(handler); |
135 if (invalidator_) { | 138 if (invalidator_) { |
136 invalidator_->UpdateRegisteredIds( | 139 invalidator_->UpdateRegisteredIds( |
137 this, | 140 this, |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 logger_.OnStateChange(state); | 279 logger_.OnStateChange(state); |
277 } | 280 } |
278 | 281 |
279 void TiclInvalidationService::OnIncomingInvalidation( | 282 void TiclInvalidationService::OnIncomingInvalidation( |
280 const syncer::ObjectIdInvalidationMap& invalidation_map) { | 283 const syncer::ObjectIdInvalidationMap& invalidation_map) { |
281 invalidator_registrar_->DispatchInvalidationsToHandlers(invalidation_map); | 284 invalidator_registrar_->DispatchInvalidationsToHandlers(invalidation_map); |
282 | 285 |
283 logger_.OnInvalidation(invalidation_map); | 286 logger_.OnInvalidation(invalidation_map); |
284 } | 287 } |
285 | 288 |
| 289 std::string TiclInvalidationService::GetOwnerName() const { return "TICL"; } |
| 290 |
286 void TiclInvalidationService::Shutdown() { | 291 void TiclInvalidationService::Shutdown() { |
287 DCHECK(CalledOnValidThread()); | 292 DCHECK(CalledOnValidThread()); |
288 oauth2_token_service_->RemoveObserver(this); | 293 oauth2_token_service_->RemoveObserver(this); |
289 if (IsStarted()) { | 294 if (IsStarted()) { |
290 StopInvalidator(); | 295 StopInvalidator(); |
291 } | 296 } |
292 invalidator_storage_.reset(); | 297 invalidator_storage_.reset(); |
293 invalidator_registrar_.reset(); | 298 invalidator_registrar_.reset(); |
294 } | 299 } |
295 | 300 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } | 414 } |
410 | 415 |
411 // This service always expects to have a valid invalidator storage. | 416 // This service always expects to have a valid invalidator storage. |
412 // So we must not only clear the old one, but also start a new one. | 417 // So we must not only clear the old one, but also start a new one. |
413 invalidator_storage_->Clear(); | 418 invalidator_storage_->Clear(); |
414 invalidator_storage_.reset(new InvalidatorStorage(profile_->GetPrefs())); | 419 invalidator_storage_.reset(new InvalidatorStorage(profile_->GetPrefs())); |
415 invalidator_storage_->SetInvalidatorClientId(GenerateInvalidatorClientId()); | 420 invalidator_storage_->SetInvalidatorClientId(GenerateInvalidatorClientId()); |
416 } | 421 } |
417 | 422 |
418 } // namespace invalidation | 423 } // namespace invalidation |
OLD | NEW |