From 69505deccedb458e39a3593888e50627467870fb Mon Sep 17 00:00:00 2001 From: estade Date: Wed, 20 May 2015 15:46:58 -0700 Subject: Change JSONReader::ReadToValue to return a scoped_ptr BUG=none Review URL: https://codereview.chromium.org/1124223012 Cr-Commit-Position: refs/heads/master@{#330823} --- extensions/browser/value_store/leveldb_value_store.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'extensions/browser/value_store') diff --git a/extensions/browser/value_store/leveldb_value_store.cc b/extensions/browser/value_store/leveldb_value_store.cc index 4b7d274..d29bc74 100644 --- a/extensions/browser/value_store/leveldb_value_store.cc +++ b/extensions/browser/value_store/leveldb_value_store.cc @@ -146,12 +146,13 @@ ValueStore::ReadResult LeveldbValueStore::Get() { scoped_ptr it(db_->NewIterator(options)); for (it->SeekToFirst(); it->Valid(); it->Next()) { std::string key = it->key().ToString(); - base::Value* value = json_reader.ReadToValue(it->value().ToString()); + scoped_ptr value = + json_reader.ReadToValue(it->value().ToString()); if (!value) { return MakeReadResult( Error::Create(CORRUPTION, kInvalidJson, util::NewKey(key))); } - settings->SetWithoutPathExpansion(key, value); + settings->SetWithoutPathExpansion(key, value.Pass()); } if (it->status().IsNotFound()) { @@ -357,11 +358,11 @@ scoped_ptr LeveldbValueStore::ReadFromDb( if (!s.ok()) return ToValueStoreError(s, util::NewKey(key)); - base::Value* value = base::JSONReader().ReadToValue(value_as_json); + scoped_ptr value = base::JSONReader().ReadToValue(value_as_json); if (!value) return Error::Create(CORRUPTION, kInvalidJson, util::NewKey(key)); - setting->reset(value); + *setting = value.Pass(); return util::NoError(); } -- cgit v1.1