Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 | 465 |
| 466 void ProfileSyncService::UnregisterInvalidationHandler( | 466 void ProfileSyncService::UnregisterInvalidationHandler( |
| 467 syncer::InvalidationHandler* handler) { | 467 syncer::InvalidationHandler* handler) { |
| 468 invalidator_registrar_.UnregisterHandler(handler); | 468 invalidator_registrar_.UnregisterHandler(handler); |
| 469 } | 469 } |
| 470 | 470 |
| 471 syncer::InvalidatorState ProfileSyncService::GetInvalidatorState() const { | 471 syncer::InvalidatorState ProfileSyncService::GetInvalidatorState() const { |
| 472 return invalidator_registrar_.GetInvalidatorState(); | 472 return invalidator_registrar_.GetInvalidatorState(); |
| 473 } | 473 } |
| 474 | 474 |
| 475 // Test method for system test to allow a test to send in an invalidation. | |
|
akalin
2012/09/17 23:20:14
this comment doesn't say much, either. I think yo
| |
| 476 void ProfileSyncService::SendInvalidationForTest( | |
| 477 const invalidation::ObjectId& id, | |
| 478 const std::string& payload) { | |
| 479 // insert the object into the list of IDs to notify | |
|
akalin
2012/09/17 23:20:14
this comment doesn't say much
| |
| 480 syncer::ObjectIdSet notify_ids; | |
| 481 notify_ids.insert(id); | |
| 482 | |
| 483 // Build an object state map, and use it to forward the call to | |
|
akalin
2012/09/17 23:20:14
i don't know if this says muchmore, either
| |
| 484 // registered clients such as PushMessagingHandler::OnIncomingNotification | |
| 485 // as if this came from the server. | |
| 486 const syncer::ObjectIdStateMap& id_state_map = | |
| 487 ObjectIdSetToStateMap(notify_ids, payload); | |
| 488 OnIncomingInvalidation(id_state_map, syncer::REMOTE_INVALIDATION); | |
| 489 } | |
| 490 | |
| 475 void ProfileSyncService::Shutdown() { | 491 void ProfileSyncService::Shutdown() { |
| 476 ShutdownImpl(false); | 492 ShutdownImpl(false); |
| 477 } | 493 } |
| 478 | 494 |
| 479 void ProfileSyncService::ShutdownImpl(bool sync_disabled) { | 495 void ProfileSyncService::ShutdownImpl(bool sync_disabled) { |
| 480 // First, we spin down the backend and wait for it to stop syncing completely | 496 // First, we spin down the backend and wait for it to stop syncing completely |
| 481 // before we Stop the data type manager. This is to avoid a late sync cycle | 497 // before we Stop the data type manager. This is to avoid a late sync cycle |
| 482 // applying changes to the sync db that wouldn't get applied via | 498 // applying changes to the sync db that wouldn't get applied via |
| 483 // ChangeProcessors, leading to back-from-the-dead bugs. | 499 // ChangeProcessors, leading to back-from-the-dead bugs. |
| 484 base::Time shutdown_start_time = base::Time::Now(); | 500 base::Time shutdown_start_time = base::Time::Now(); |
| (...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1810 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. | 1826 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. |
| 1811 ProfileSyncService* old_this = this; | 1827 ProfileSyncService* old_this = this; |
| 1812 this->~ProfileSyncService(); | 1828 this->~ProfileSyncService(); |
| 1813 new(old_this) ProfileSyncService( | 1829 new(old_this) ProfileSyncService( |
| 1814 new ProfileSyncComponentsFactoryImpl(profile, | 1830 new ProfileSyncComponentsFactoryImpl(profile, |
| 1815 CommandLine::ForCurrentProcess()), | 1831 CommandLine::ForCurrentProcess()), |
| 1816 profile, | 1832 profile, |
| 1817 signin, | 1833 signin, |
| 1818 behavior); | 1834 behavior); |
| 1819 } | 1835 } |
| OLD | NEW |