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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 } | 535 } |
536 | 536 |
537 void ProfileSyncService::EmitInvalidationForTest( | 537 void ProfileSyncService::EmitInvalidationForTest( |
538 const invalidation::ObjectId& id, | 538 const invalidation::ObjectId& id, |
539 const std::string& payload) { | 539 const std::string& payload) { |
540 syncer::ObjectIdSet notify_ids; | 540 syncer::ObjectIdSet notify_ids; |
541 notify_ids.insert(id); | 541 notify_ids.insert(id); |
542 | 542 |
543 const syncer::ObjectIdInvalidationMap& invalidation_map = | 543 const syncer::ObjectIdInvalidationMap& invalidation_map = |
544 ObjectIdSetToInvalidationMap(notify_ids, payload); | 544 ObjectIdSetToInvalidationMap(notify_ids, payload); |
545 OnIncomingInvalidation(invalidation_map, syncer::REMOTE_INVALIDATION); | 545 OnIncomingInvalidation(invalidation_map); |
546 } | 546 } |
547 | 547 |
548 void ProfileSyncService::Shutdown() { | 548 void ProfileSyncService::Shutdown() { |
549 DCHECK(invalidator_registrar_.get()); | 549 DCHECK(invalidator_registrar_.get()); |
550 // Reset |invalidator_registrar_| first so that ShutdownImpl cannot | 550 // Reset |invalidator_registrar_| first so that ShutdownImpl cannot |
551 // use it. | 551 // use it. |
552 invalidator_registrar_.reset(); | 552 invalidator_registrar_.reset(); |
553 | 553 |
554 if (signin_) | 554 if (signin_) |
555 signin_->signin_global_error()->RemoveProvider(this); | 555 signin_->signin_global_error()->RemoveProvider(this); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 weak_factory_.GetWeakPtr())); | 745 weak_factory_.GetWeakPtr())); |
746 } | 746 } |
747 | 747 |
748 void ProfileSyncService::OnInvalidatorStateChange( | 748 void ProfileSyncService::OnInvalidatorStateChange( |
749 syncer::InvalidatorState state) { | 749 syncer::InvalidatorState state) { |
750 invalidator_state_ = state; | 750 invalidator_state_ = state; |
751 UpdateInvalidatorRegistrarState(); | 751 UpdateInvalidatorRegistrarState(); |
752 } | 752 } |
753 | 753 |
754 void ProfileSyncService::OnIncomingInvalidation( | 754 void ProfileSyncService::OnIncomingInvalidation( |
755 const syncer::ObjectIdInvalidationMap& invalidation_map, | 755 const syncer::ObjectIdInvalidationMap& invalidation_map) { |
756 syncer::IncomingInvalidationSource source) { | 756 invalidator_registrar_->DispatchInvalidationsToHandlers(invalidation_map); |
757 invalidator_registrar_->DispatchInvalidationsToHandlers(invalidation_map, | |
758 source); | |
759 } | 757 } |
760 | 758 |
761 void ProfileSyncService::OnBackendInitialized( | 759 void ProfileSyncService::OnBackendInitialized( |
762 const syncer::WeakHandle<syncer::JsBackend>& js_backend, | 760 const syncer::WeakHandle<syncer::JsBackend>& js_backend, |
763 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& | 761 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |
764 debug_info_listener, | 762 debug_info_listener, |
765 bool success) { | 763 bool success) { |
766 is_first_time_sync_configure_ = !HasSyncSetupCompleted(); | 764 is_first_time_sync_configure_ = !HasSyncSetupCompleted(); |
767 | 765 |
768 if (is_first_time_sync_configure_) { | 766 if (is_first_time_sync_configure_) { |
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. | 1958 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. |
1961 ProfileSyncService* old_this = this; | 1959 ProfileSyncService* old_this = this; |
1962 this->~ProfileSyncService(); | 1960 this->~ProfileSyncService(); |
1963 new(old_this) ProfileSyncService( | 1961 new(old_this) ProfileSyncService( |
1964 new ProfileSyncComponentsFactoryImpl(profile, | 1962 new ProfileSyncComponentsFactoryImpl(profile, |
1965 CommandLine::ForCurrentProcess()), | 1963 CommandLine::ForCurrentProcess()), |
1966 profile, | 1964 profile, |
1967 signin, | 1965 signin, |
1968 behavior); | 1966 behavior); |
1969 } | 1967 } |
OLD | NEW |