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

Unified Diff: chrome/browser/extensions/api/storage/syncable_settings_storage.cc

Issue 21030009: Make element removal methods in DictionaryValue and ListValue take scoped_ptr's as outparams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 7 years, 4 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: chrome/browser/extensions/api/storage/syncable_settings_storage.cc
diff --git a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
index 66fd94fc247c5e4596211bb8e5a9ff9591377d09..b2f5742883005b903e3db9b099824d3e3d282325 100644
--- a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
+++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
@@ -182,10 +182,8 @@ syncer::SyncError SyncableSettingsStorage::OverwriteLocalSettingsWithSync(
SettingSyncDataList changes;
for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd(); it.Advance()) {
- Value* orphaned_sync_value = NULL;
- if (new_sync_state->RemoveWithoutPathExpansion(
- it.key(), &orphaned_sync_value)) {
- scoped_ptr<Value> sync_value(orphaned_sync_value);
+ scoped_ptr<Value> sync_value;
+ if (new_sync_state->RemoveWithoutPathExpansion(it.key(), &sync_value)) {
if (sync_value->Equals(&it.value())) {
// Sync and local values are the same, no changes to send.
} else {
@@ -212,14 +210,14 @@ syncer::SyncError SyncableSettingsStorage::OverwriteLocalSettingsWithSync(
while (!new_sync_state->empty()) {
base::DictionaryValue::Iterator first_entry(*new_sync_state);
std::string key = first_entry.key();
- Value* value = NULL;
+ scoped_ptr<Value> value;
CHECK(new_sync_state->RemoveWithoutPathExpansion(key, &value));
changes.push_back(
SettingSyncData(
syncer::SyncChange::ACTION_ADD,
extension_id_,
key,
- make_scoped_ptr(value)));
+ value.Pass()));
}
if (changes.empty())

Powered by Google App Engine
This is Rietveld 408576698