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

Unified Diff: base/values.cc

Issue 2394163005: [Re-CL]Replace deprecated version of SetWithoutPathExpansion (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values.cc
diff --git a/base/values.cc b/base/values.cc
index 7c14e81beecc0a3d0ea868cd00d7ef82f0b40b47..2564e09ed1182f80abb76e5b494753db122e30e1 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -397,10 +397,11 @@ void DictionaryValue::Set(StringPiece path, std::unique_ptr<Value> in_value) {
delimiter_position = current_path.find('.')) {
// Assume that we're indexing into a dictionary.
StringPiece key = current_path.substr(0, delimiter_position);
- DictionaryValue* child_dictionary = NULL;
+ DictionaryValue* child_dictionary = nullptr;
if (!current_dictionary->GetDictionary(key, &child_dictionary)) {
child_dictionary = new DictionaryValue;
- current_dictionary->SetWithoutPathExpansion(key, child_dictionary);
+ current_dictionary->SetWithoutPathExpansion(
+ key, base::WrapUnique(child_dictionary));
}
current_dictionary = child_dictionary;
@@ -447,27 +448,30 @@ void DictionaryValue::SetWithoutPathExpansion(StringPiece key,
void DictionaryValue::SetBooleanWithoutPathExpansion(StringPiece path,
bool in_value) {
- SetWithoutPathExpansion(path, new FundamentalValue(in_value));
+ SetWithoutPathExpansion(path,
+ base::MakeUnique<base::FundamentalValue>(in_value));
}
void DictionaryValue::SetIntegerWithoutPathExpansion(StringPiece path,
int in_value) {
- SetWithoutPathExpansion(path, new FundamentalValue(in_value));
+ SetWithoutPathExpansion(path,
+ base::MakeUnique<base::FundamentalValue>(in_value));
}
void DictionaryValue::SetDoubleWithoutPathExpansion(StringPiece path,
double in_value) {
- SetWithoutPathExpansion(path, new FundamentalValue(in_value));
+ SetWithoutPathExpansion(path,
+ base::MakeUnique<base::FundamentalValue>(in_value));
}
void DictionaryValue::SetStringWithoutPathExpansion(StringPiece path,
StringPiece in_value) {
- SetWithoutPathExpansion(path, new StringValue(in_value));
+ SetWithoutPathExpansion(path, base::MakeUnique<base::StringValue>(in_value));
}
void DictionaryValue::SetStringWithoutPathExpansion(StringPiece path,
const string16& in_value) {
- SetWithoutPathExpansion(path, new StringValue(in_value));
+ SetWithoutPathExpansion(path, base::MakeUnique<base::StringValue>(in_value));
}
bool DictionaryValue::Get(StringPiece path,
@@ -795,7 +799,8 @@ void DictionaryValue::MergeDictionary(const DictionaryValue* dictionary) {
}
}
// All other cases: Make a copy and hook it up.
- SetWithoutPathExpansion(it.key(), merge_value->DeepCopy());
+ SetWithoutPathExpansion(it.key(),
+ base::WrapUnique(merge_value->DeepCopy()));
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698