| 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 void ProfileSyncService::EmitInvalidationForTest( |
| 476 const invalidation::ObjectId& id, |
| 477 const std::string& payload) { |
| 478 syncer::ObjectIdSet notify_ids; |
| 479 notify_ids.insert(id); |
| 480 |
| 481 const syncer::ObjectIdStateMap& id_state_map = |
| 482 ObjectIdSetToStateMap(notify_ids, payload); |
| 483 OnIncomingInvalidation(id_state_map, syncer::REMOTE_INVALIDATION); |
| 484 } |
| 485 |
| 475 void ProfileSyncService::Shutdown() { | 486 void ProfileSyncService::Shutdown() { |
| 476 ShutdownImpl(false); | 487 ShutdownImpl(false); |
| 477 } | 488 } |
| 478 | 489 |
| 479 void ProfileSyncService::ShutdownImpl(bool sync_disabled) { | 490 void ProfileSyncService::ShutdownImpl(bool sync_disabled) { |
| 480 // First, we spin down the backend and wait for it to stop syncing completely | 491 // 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 | 492 // 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 | 493 // applying changes to the sync db that wouldn't get applied via |
| 483 // ChangeProcessors, leading to back-from-the-dead bugs. | 494 // ChangeProcessors, leading to back-from-the-dead bugs. |
| 484 base::Time shutdown_start_time = base::Time::Now(); | 495 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. | 1821 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. |
| 1811 ProfileSyncService* old_this = this; | 1822 ProfileSyncService* old_this = this; |
| 1812 this->~ProfileSyncService(); | 1823 this->~ProfileSyncService(); |
| 1813 new(old_this) ProfileSyncService( | 1824 new(old_this) ProfileSyncService( |
| 1814 new ProfileSyncComponentsFactoryImpl(profile, | 1825 new ProfileSyncComponentsFactoryImpl(profile, |
| 1815 CommandLine::ForCurrentProcess()), | 1826 CommandLine::ForCurrentProcess()), |
| 1816 profile, | 1827 profile, |
| 1817 signin, | 1828 signin, |
| 1818 behavior); | 1829 behavior); |
| 1819 } | 1830 } |
| OLD | NEW |