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

Unified Diff: services/preferences/tracked/dictionary_hash_store_contents.cc

Issue 2911033002: Remove raw base::DictionaryValue::Set (Closed)
Patch Set: Proper Windows Fix 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 side-by-side diff with in-line comments
Download patch
Index: services/preferences/tracked/dictionary_hash_store_contents.cc
diff --git a/services/preferences/tracked/dictionary_hash_store_contents.cc b/services/preferences/tracked/dictionary_hash_store_contents.cc
index 3cef69b05a18768197e0f29cb2ee0dfa26b76aa9..2901657e7c62d10e5b1b91e22464cdfeda521c4b 100644
--- a/services/preferences/tracked/dictionary_hash_store_contents.cc
+++ b/services/preferences/tracked/dictionary_hash_store_contents.cc
@@ -7,6 +7,7 @@
#include "base/callback.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/persistent_pref_store.h"
@@ -94,7 +95,7 @@ void DictionaryHashStoreContents::SetSplitMac(const std::string& path,
void DictionaryHashStoreContents::ImportEntry(const std::string& path,
const base::Value* in_value) {
base::DictionaryValue* macs_dict = GetMutableContents(true);
- macs_dict->Set(path, in_value->DeepCopy());
+ macs_dict->Set(path, base::MakeUnique<base::Value>(*in_value));
}
bool DictionaryHashStoreContents::RemoveEntry(const std::string& path) {
@@ -126,8 +127,8 @@ base::DictionaryValue* DictionaryHashStoreContents::GetMutableContents(
base::DictionaryValue* macs_dict = NULL;
storage_->GetDictionary(kPreferenceMACs, &macs_dict);
if (!macs_dict && create_if_null) {
- macs_dict = new base::DictionaryValue;
- storage_->Set(kPreferenceMACs, macs_dict);
+ macs_dict = storage_->SetDictionary(
+ kPreferenceMACs, base::MakeUnique<base::DictionaryValue>());
}
return macs_dict;
}
« no previous file with comments | « rlz/chromeos/lib/rlz_value_store_chromeos.cc ('k') | services/preferences/tracked/pref_hash_calculator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698