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

Unified Diff: base/values.cc

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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 | « base/values.h ('k') | base/version.cc » ('j') | 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 4534d27dff59a29ac2bf5f4028918a8659a7319b..5374d6c620e5c85acbdc2cf19fde63665f2d02f7 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -482,27 +482,29 @@ void DictionaryValue::SetStringWithoutPathExpansion(
SetWithoutPathExpansion(path, new StringValue(in_value));
}
-bool DictionaryValue::Get(const std::string& path,
- const Value** out_value) const {
+bool DictionaryValue::Get(StringPiece path, const Value** out_value) const {
DCHECK(IsStringUTF8(path));
- std::string current_path(path);
+ StringPiece current_path(path);
const DictionaryValue* current_dictionary = this;
for (size_t delimiter_position = current_path.find('.');
delimiter_position != std::string::npos;
delimiter_position = current_path.find('.')) {
const DictionaryValue* child_dictionary = NULL;
- if (!current_dictionary->GetDictionary(
- current_path.substr(0, delimiter_position), &child_dictionary))
+ if (!current_dictionary->GetDictionaryWithoutPathExpansion(
+ current_path.substr(0, delimiter_position).as_string(),
+ &child_dictionary)) {
return false;
+ }
current_dictionary = child_dictionary;
- current_path.erase(0, delimiter_position + 1);
+ current_path = current_path.substr(delimiter_position + 1);
}
- return current_dictionary->GetWithoutPathExpansion(current_path, out_value);
+ return current_dictionary->GetWithoutPathExpansion(current_path.as_string(),
+ out_value);
}
-bool DictionaryValue::Get(const std::string& path, Value** out_value) {
+bool DictionaryValue::Get(StringPiece path, Value** out_value) {
return static_cast<const DictionaryValue&>(*this).Get(
path,
const_cast<const Value**>(out_value));
@@ -588,7 +590,7 @@ bool DictionaryValue::GetBinary(const std::string& path,
const_cast<const BinaryValue**>(out_value));
}
-bool DictionaryValue::GetDictionary(const std::string& path,
+bool DictionaryValue::GetDictionary(StringPiece path,
const DictionaryValue** out_value) const {
const Value* value;
bool result = Get(path, &value);
@@ -601,7 +603,7 @@ bool DictionaryValue::GetDictionary(const std::string& path,
return true;
}
-bool DictionaryValue::GetDictionary(const std::string& path,
+bool DictionaryValue::GetDictionary(StringPiece path,
DictionaryValue** out_value) {
return static_cast<const DictionaryValue&>(*this).GetDictionary(
path,
« no previous file with comments | « base/values.h ('k') | base/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698