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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 syncer::InvalidatorState ProfileSyncService::GetInvalidatorState() const { | 472 syncer::InvalidatorState ProfileSyncService::GetInvalidatorState() const { |
473 return invalidator_registrar_.GetInvalidatorState(); | 473 return invalidator_registrar_.GetInvalidatorState(); |
474 } | 474 } |
475 | 475 |
476 void ProfileSyncService::EmitInvalidationForTest( | 476 void ProfileSyncService::EmitInvalidationForTest( |
477 const invalidation::ObjectId& id, | 477 const invalidation::ObjectId& id, |
478 const std::string& payload) { | 478 const std::string& payload) { |
479 syncer::ObjectIdSet notify_ids; | 479 syncer::ObjectIdSet notify_ids; |
480 notify_ids.insert(id); | 480 notify_ids.insert(id); |
481 | 481 |
482 const syncer::ObjectIdStateMap& id_state_map = | 482 const syncer::ObjectIdInvalidationMap& invalidation_map = |
483 ObjectIdSetToStateMap(notify_ids, payload); | 483 ObjectIdSetToInvalidationMap(notify_ids, payload); |
484 OnIncomingInvalidation(id_state_map, syncer::REMOTE_INVALIDATION); | 484 OnIncomingInvalidation(invalidation_map, syncer::REMOTE_INVALIDATION); |
485 } | 485 } |
486 | 486 |
487 void ProfileSyncService::Shutdown() { | 487 void ProfileSyncService::Shutdown() { |
488 ShutdownImpl(false); | 488 ShutdownImpl(false); |
489 } | 489 } |
490 | 490 |
491 void ProfileSyncService::ShutdownImpl(bool sync_disabled) { | 491 void ProfileSyncService::ShutdownImpl(bool sync_disabled) { |
492 // First, we spin down the backend and wait for it to stop syncing completely | 492 // First, we spin down the backend and wait for it to stop syncing completely |
493 // before we Stop the data type manager. This is to avoid a late sync cycle | 493 // before we Stop the data type manager. This is to avoid a late sync cycle |
494 // applying changes to the sync db that wouldn't get applied via | 494 // applying changes to the sync db that wouldn't get applied via |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 base::Bind(&ProfileSyncService::ReconfigureDatatypeManager, | 675 base::Bind(&ProfileSyncService::ReconfigureDatatypeManager, |
676 weak_factory_.GetWeakPtr())); | 676 weak_factory_.GetWeakPtr())); |
677 } | 677 } |
678 | 678 |
679 void ProfileSyncService::OnInvalidatorStateChange( | 679 void ProfileSyncService::OnInvalidatorStateChange( |
680 syncer::InvalidatorState state) { | 680 syncer::InvalidatorState state) { |
681 invalidator_registrar_.UpdateInvalidatorState(state); | 681 invalidator_registrar_.UpdateInvalidatorState(state); |
682 } | 682 } |
683 | 683 |
684 void ProfileSyncService::OnIncomingInvalidation( | 684 void ProfileSyncService::OnIncomingInvalidation( |
685 const syncer::ObjectIdStateMap& id_state_map, | 685 const syncer::ObjectIdInvalidationMap& invalidation_map, |
686 syncer::IncomingInvalidationSource source) { | 686 syncer::IncomingInvalidationSource source) { |
687 invalidator_registrar_.DispatchInvalidationsToHandlers(id_state_map, source); | 687 invalidator_registrar_.DispatchInvalidationsToHandlers(invalidation_map, |
| 688 source); |
688 } | 689 } |
689 | 690 |
690 void ProfileSyncService::OnBackendInitialized( | 691 void ProfileSyncService::OnBackendInitialized( |
691 const syncer::WeakHandle<syncer::JsBackend>& js_backend, bool success) { | 692 const syncer::WeakHandle<syncer::JsBackend>& js_backend, bool success) { |
692 is_first_time_sync_configure_ = !HasSyncSetupCompleted(); | 693 is_first_time_sync_configure_ = !HasSyncSetupCompleted(); |
693 | 694 |
694 if (is_first_time_sync_configure_) { | 695 if (is_first_time_sync_configure_) { |
695 UMA_HISTOGRAM_BOOLEAN("Sync.BackendInitializeFirstTimeSuccess", success); | 696 UMA_HISTOGRAM_BOOLEAN("Sync.BackendInitializeFirstTimeSuccess", success); |
696 } else { | 697 } else { |
697 UMA_HISTOGRAM_BOOLEAN("Sync.BackendInitializeRestoreSuccess", success); | 698 UMA_HISTOGRAM_BOOLEAN("Sync.BackendInitializeRestoreSuccess", success); |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. | 1823 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. |
1823 ProfileSyncService* old_this = this; | 1824 ProfileSyncService* old_this = this; |
1824 this->~ProfileSyncService(); | 1825 this->~ProfileSyncService(); |
1825 new(old_this) ProfileSyncService( | 1826 new(old_this) ProfileSyncService( |
1826 new ProfileSyncComponentsFactoryImpl(profile, | 1827 new ProfileSyncComponentsFactoryImpl(profile, |
1827 CommandLine::ForCurrentProcess()), | 1828 CommandLine::ForCurrentProcess()), |
1828 profile, | 1829 profile, |
1829 signin, | 1830 signin, |
1830 behavior); | 1831 behavior); |
1831 } | 1832 } |
OLD | NEW |