Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: components/sync_preferences/pref_model_associator.cc

Issue 2912853002: Replace deprecated base::NonThreadSafe in components/sync_preferences in favor of SequenceChecker. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/sync_preferences/pref_model_associator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/sync_preferences/pref_model_associator.h" 5 #include "components/sync_preferences/pref_model_associator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } // namespace 56 } // namespace
57 57
58 PrefModelAssociator::PrefModelAssociator( 58 PrefModelAssociator::PrefModelAssociator(
59 const PrefModelAssociatorClient* client, 59 const PrefModelAssociatorClient* client,
60 syncer::ModelType type) 60 syncer::ModelType type)
61 : models_associated_(false), 61 : models_associated_(false),
62 processing_syncer_changes_(false), 62 processing_syncer_changes_(false),
63 pref_service_(NULL), 63 pref_service_(NULL),
64 type_(type), 64 type_(type),
65 client_(client) { 65 client_(client) {
66 DCHECK(CalledOnValidThread()); 66 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
67 DCHECK(type_ == PREFERENCES || type_ == PRIORITY_PREFERENCES); 67 DCHECK(type_ == PREFERENCES || type_ == PRIORITY_PREFERENCES);
68 } 68 }
69 69
70 PrefModelAssociator::~PrefModelAssociator() { 70 PrefModelAssociator::~PrefModelAssociator() {
71 DCHECK(CalledOnValidThread()); 71 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
72 pref_service_ = NULL; 72 pref_service_ = NULL;
73 73
74 synced_pref_observers_.clear(); 74 synced_pref_observers_.clear();
75 } 75 }
76 76
77 void PrefModelAssociator::InitPrefAndAssociate( 77 void PrefModelAssociator::InitPrefAndAssociate(
78 const syncer::SyncData& sync_pref, 78 const syncer::SyncData& sync_pref,
79 const std::string& pref_name, 79 const std::string& pref_name,
80 syncer::SyncChangeList* sync_changes) { 80 syncer::SyncChangeList* sync_changes) {
81 const base::Value* user_pref_value = 81 const base::Value* user_pref_value =
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 else 159 else
160 callback.Run(); 160 callback.Run();
161 } 161 }
162 162
163 syncer::SyncMergeResult PrefModelAssociator::MergeDataAndStartSyncing( 163 syncer::SyncMergeResult PrefModelAssociator::MergeDataAndStartSyncing(
164 syncer::ModelType type, 164 syncer::ModelType type,
165 const syncer::SyncDataList& initial_sync_data, 165 const syncer::SyncDataList& initial_sync_data,
166 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor, 166 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
167 std::unique_ptr<syncer::SyncErrorFactory> sync_error_factory) { 167 std::unique_ptr<syncer::SyncErrorFactory> sync_error_factory) {
168 DCHECK_EQ(type_, type); 168 DCHECK_EQ(type_, type);
169 DCHECK(CalledOnValidThread()); 169 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
170 DCHECK(pref_service_); 170 DCHECK(pref_service_);
171 DCHECK(!sync_processor_.get()); 171 DCHECK(!sync_processor_.get());
172 DCHECK(sync_processor.get()); 172 DCHECK(sync_processor.get());
173 DCHECK(sync_error_factory.get()); 173 DCHECK(sync_error_factory.get());
174 syncer::SyncMergeResult merge_result(type); 174 syncer::SyncMergeResult merge_result(type);
175 sync_processor_ = std::move(sync_processor); 175 sync_processor_ = std::move(sync_processor);
176 sync_error_factory_ = std::move(sync_error_factory); 176 sync_error_factory_ = std::move(sync_error_factory);
177 177
178 syncer::SyncChangeList new_changes; 178 syncer::SyncChangeList new_changes;
179 std::set<std::string> remaining_preferences = registered_preferences_; 179 std::set<std::string> remaining_preferences = registered_preferences_;
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 bool from_sync) const { 531 bool from_sync) const {
532 auto observer_iter = synced_pref_observers_.find(path); 532 auto observer_iter = synced_pref_observers_.find(path);
533 if (observer_iter == synced_pref_observers_.end()) 533 if (observer_iter == synced_pref_observers_.end())
534 return; 534 return;
535 SyncedPrefObserverList* observers = observer_iter->second.get(); 535 SyncedPrefObserverList* observers = observer_iter->second.get();
536 for (auto& observer : *observers) 536 for (auto& observer : *observers)
537 observer.OnSyncedPrefChanged(path, from_sync); 537 observer.OnSyncedPrefChanged(path, from_sync);
538 } 538 }
539 539
540 } // namespace sync_preferences 540 } // namespace sync_preferences
OLDNEW
« no previous file with comments | « components/sync_preferences/pref_model_associator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698