summaryrefslogtreecommitdiffstats
path: root/extensions/browser/value_store
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 /extensions/browser/value_store
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 'extensions/browser/value_store')
-rw-r--r--extensions/browser/value_store/leveldb_value_store.cc2
-rw-r--r--extensions/browser/value_store/value_store_change.cc2
-rw-r--r--extensions/browser/value_store/value_store_unittest.cc5
3 files changed, 4 insertions, 5 deletions
diff --git a/extensions/browser/value_store/leveldb_value_store.cc b/extensions/browser/value_store/leveldb_value_store.cc
index ad8076d..4b7d274 100644
--- a/extensions/browser/value_store/leveldb_value_store.cc
+++ b/extensions/browser/value_store/leveldb_value_store.cc
@@ -389,7 +389,7 @@ scoped_ptr<ValueStore::Error> LeveldbValueStore::AddToBatch(
if (write_new_value) {
std::string value_as_json;
- if (!base::JSONWriter::Write(&value, &value_as_json))
+ if (!base::JSONWriter::Write(value, &value_as_json))
return Error::Create(OTHER_ERROR, kCannotSerialize, util::NewKey(key));
batch->Put(key, value_as_json);
}
diff --git a/extensions/browser/value_store/value_store_change.cc b/extensions/browser/value_store/value_store_change.cc
index 822c9b9..904ec82 100644
--- a/extensions/browser/value_store/value_store_change.cc
+++ b/extensions/browser/value_store/value_store_change.cc
@@ -23,7 +23,7 @@ std::string ValueStoreChange::ToJson(
changes_value.SetWithoutPathExpansion(it->key(), change_value);
}
std::string json;
- base::JSONWriter::Write(&changes_value, &json);
+ base::JSONWriter::Write(changes_value, &json);
return json;
}
diff --git a/extensions/browser/value_store/value_store_unittest.cc b/extensions/browser/value_store/value_store_unittest.cc
index 4293459..c2ecbab 100644
--- a/extensions/browser/value_store/value_store_unittest.cc
+++ b/extensions/browser/value_store/value_store_unittest.cc
@@ -18,9 +18,8 @@ const ValueStore::WriteOptions DEFAULTS = ValueStore::DEFAULTS;
// Gets the pretty-printed JSON for a value.
std::string GetJSON(const base::Value& value) {
std::string json;
- base::JSONWriter::WriteWithOptions(&value,
- base::JSONWriter::OPTIONS_PRETTY_PRINT,
- &json);
+ base::JSONWriter::WriteWithOptions(
+ value, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json);
return json;
}