| 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. |
| 476 void ProfileSyncService::SendInvalidationForTest( |
| 477 const invalidation::ObjectId objId, |
| 478 const std::string& payload) { |
| 479 // insert the object into the list of IDs to notify |
| 480 syncer::ObjectIdSet notify_ids; |
| 481 notify_ids.insert(objId); |
| 482 |
| 483 // Build an object state map, and use it to forward the call to |
| 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 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1814 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. | 1830 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. |
| 1815 ProfileSyncService* old_this = this; | 1831 ProfileSyncService* old_this = this; |
| 1816 this->~ProfileSyncService(); | 1832 this->~ProfileSyncService(); |
| 1817 new(old_this) ProfileSyncService( | 1833 new(old_this) ProfileSyncService( |
| 1818 new ProfileSyncComponentsFactoryImpl(profile, | 1834 new ProfileSyncComponentsFactoryImpl(profile, |
| 1819 CommandLine::ForCurrentProcess()), | 1835 CommandLine::ForCurrentProcess()), |
| 1820 profile, | 1836 profile, |
| 1821 signin, | 1837 signin, |
| 1822 behavior); | 1838 behavior); |
| 1823 } | 1839 } |
| OLD | NEW |