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

Unified Diff: extensions/browser/value_store/leveldb_value_store.cc

Issue 1940133002: Use std::unique_ptr to transfer base::Value ownership in extensions::ValueStoreChange (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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
Index: extensions/browser/value_store/leveldb_value_store.cc
diff --git a/extensions/browser/value_store/leveldb_value_store.cc b/extensions/browser/value_store/leveldb_value_store.cc
index 8ab753e4c8c784c697a4d4d25fe8cbe150245713..3a63af2e1ddf8f3419af4e79269141331e89a429 100644
--- a/extensions/browser/value_store/leveldb_value_store.cc
+++ b/extensions/browser/value_store/leveldb_value_store.cc
@@ -193,7 +193,7 @@ ValueStore::WriteResult LeveldbValueStore::Remove(
return MakeWriteResult(status);
if (old_value) {
- changes->push_back(ValueStoreChange(key, old_value.release(), NULL));
+ changes->push_back(ValueStoreChange(key, std::move(old_value), nullptr));
batch.Delete(key);
}
}
@@ -220,7 +220,8 @@ ValueStore::WriteResult LeveldbValueStore::Clear() {
std::string next_key = base::DictionaryValue::Iterator(whole_db).key();
std::unique_ptr<base::Value> next_value;
whole_db.RemoveWithoutPathExpansion(next_key, &next_value);
- changes->push_back(ValueStoreChange(next_key, next_value.release(), NULL));
+ changes->push_back(
+ ValueStoreChange(next_key, std::move(next_value), nullptr));
}
DeleteDbFile();
@@ -280,7 +281,7 @@ ValueStore::Status LeveldbValueStore::AddToBatch(
return status;
if (!old_value || !old_value->Equals(&value)) {
changes->push_back(
- ValueStoreChange(key, old_value.release(), value.DeepCopy()));
+ ValueStoreChange(key, std::move(old_value), value.CreateDeepCopy()));
} else {
write_new_value = false;
}

Powered by Google App Engine
This is Rietveld 408576698