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

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

Issue 2816513002: Revert of Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Created 3 years, 8 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
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 <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 DCHECK(from_value.GetType() == base::Value::Type::LIST); 285 DCHECK(from_value.GetType() == base::Value::Type::LIST);
286 DCHECK(to_value.GetType() == base::Value::Type::LIST); 286 DCHECK(to_value.GetType() == base::Value::Type::LIST);
287 const base::ListValue& from_list_value = 287 const base::ListValue& from_list_value =
288 static_cast<const base::ListValue&>(from_value); 288 static_cast<const base::ListValue&>(from_value);
289 const base::ListValue& to_list_value = 289 const base::ListValue& to_list_value =
290 static_cast<const base::ListValue&>(to_value); 290 static_cast<const base::ListValue&>(to_value);
291 base::ListValue* result = to_list_value.DeepCopy(); 291 base::ListValue* result = to_list_value.DeepCopy();
292 292
293 for (const auto& value : from_list_value) { 293 for (const auto& value : from_list_value) {
294 result->AppendIfNotPresent(value.CreateDeepCopy()); 294 result->AppendIfNotPresent(value->CreateDeepCopy());
295 } 295 }
296 return result; 296 return result;
297 } 297 }
298 298
299 base::Value* PrefModelAssociator::MergeDictionaryValues( 299 base::Value* PrefModelAssociator::MergeDictionaryValues(
300 const base::Value& from_value, 300 const base::Value& from_value,
301 const base::Value& to_value) { 301 const base::Value& to_value) {
302 if (from_value.GetType() == base::Value::Type::NONE) 302 if (from_value.GetType() == base::Value::Type::NONE)
303 return to_value.DeepCopy(); 303 return to_value.DeepCopy();
304 if (to_value.GetType() == base::Value::Type::NONE) 304 if (to_value.GetType() == base::Value::Type::NONE)
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 bool from_sync) const { 524 bool from_sync) const {
525 auto observer_iter = synced_pref_observers_.find(path); 525 auto observer_iter = synced_pref_observers_.find(path);
526 if (observer_iter == synced_pref_observers_.end()) 526 if (observer_iter == synced_pref_observers_.end())
527 return; 527 return;
528 SyncedPrefObserverList* observers = observer_iter->second.get(); 528 SyncedPrefObserverList* observers = observer_iter->second.get();
529 for (auto& observer : *observers) 529 for (auto& observer : *observers)
530 observer.OnSyncedPrefChanged(path, from_sync); 530 observer.OnSyncedPrefChanged(path, from_sync);
531 } 531 }
532 532
533 } // namespace sync_preferences 533 } // namespace sync_preferences
OLDNEW
« no previous file with comments | « components/sync/test/fake_server/fake_server_verifier.cc ('k') | components/translate/core/browser/translate_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698