diff options
author | estade <estade@chromium.org> | 2015-05-20 15:46:58 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-20 22:47:07 +0000 |
commit | 69505deccedb458e39a3593888e50627467870fb (patch) | |
tree | 26daf20256e472dc78f215d9cad913cccf3780f7 /extensions/browser/value_store | |
parent | 678b1e5a2bce8aff7b1099c001687061fc031e84 (diff) | |
download | chromium_src-69505deccedb458e39a3593888e50627467870fb.zip chromium_src-69505deccedb458e39a3593888e50627467870fb.tar.gz chromium_src-69505deccedb458e39a3593888e50627467870fb.tar.bz2 |
Change JSONReader::ReadToValue to return a scoped_ptr
BUG=none
Review URL: https://codereview.chromium.org/1124223012
Cr-Commit-Position: refs/heads/master@{#330823}
Diffstat (limited to 'extensions/browser/value_store')
-rw-r--r-- | extensions/browser/value_store/leveldb_value_store.cc | 9 |
1 files changed, 5 insertions, 4 deletions
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<leveldb::Iterator> 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<base::Value> 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<ValueStore::Error> LeveldbValueStore::ReadFromDb( if (!s.ok()) return ToValueStoreError(s, util::NewKey(key)); - base::Value* value = base::JSONReader().ReadToValue(value_as_json); + scoped_ptr<base::Value> 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(); } |