summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authorestade <estade@chromium.org>2015-05-15 18:02:34 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-16 01:02:46 +0000
commit8d04646294767ea1f3a7da596547b465d50cb4d1 (patch)
tree6bd6194b6fe2ac226114f9125570bd605e9b6d42 /dbus
parentf39e5aff5aae8451a7ef190a2fc822bf80c4e30d (diff)
downloadchromium_src-8d04646294767ea1f3a7da596547b465d50cb4d1.zip
chromium_src-8d04646294767ea1f3a7da596547b465d50cb4d1.tar.gz
chromium_src-8d04646294767ea1f3a7da596547b465d50cb4d1.tar.bz2
Convert JsonWriter::Write to taking a const ref for the in-param
Clearer API; flushes out a lot of unnecessary heap allocations. depends on https://codereview.chromium.org/1129083003/ BUG=none Review URL: https://codereview.chromium.org/1131113004 Cr-Commit-Position: refs/heads/master@{#330255}
Diffstat (limited to 'dbus')
-rw-r--r--dbus/values_util.cc4
-rw-r--r--dbus/values_util_unittest.cc6
2 files changed, 4 insertions, 6 deletions
diff --git a/dbus/values_util.cc b/dbus/values_util.cc
index c27c272..c162878 100644
--- a/dbus/values_util.cc
+++ b/dbus/values_util.cc
@@ -48,10 +48,10 @@ bool PopDictionaryEntries(MessageReader* reader,
} else {
// If the type of keys is not STRING, convert it to string.
scoped_ptr<base::Value> key(PopDataAsValue(&entry_reader));
- if (!key.get())
+ if (!key)
return false;
// Use JSONWriter to convert an arbitrary value to a string.
- base::JSONWriter::Write(key.get(), &key_string);
+ base::JSONWriter::Write(*key, &key_string);
}
// Get the value and set the key-value pair.
base::Value* value = PopDataAsValue(&entry_reader);
diff --git a/dbus/values_util_unittest.cc b/dbus/values_util_unittest.cc
index 27ec2d0..6abc56a 100644
--- a/dbus/values_util_unittest.cc
+++ b/dbus/values_util_unittest.cc
@@ -377,11 +377,9 @@ TEST(ValuesUtilTest, PopDoubleToIntDictionary) {
// Create the expected value.
base::DictionaryValue dictionary_value;
for (size_t i = 0; i != values.size(); ++i) {
- scoped_ptr<base::Value> key_value(new base::FundamentalValue(keys[i]));
std::string key_string;
- base::JSONWriter::Write(key_value.get(), &key_string);
- dictionary_value.SetWithoutPathExpansion(
- key_string, new base::FundamentalValue(values[i]));
+ base::JSONWriter::Write(base::FundamentalValue(keys[i]), &key_string);
+ dictionary_value.SetIntegerWithoutPathExpansion(key_string, values[i]);
}
// Pop a dictionary.