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

Unified Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.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/declarative_webrequest/webrequest_condition_attribute_unittest.cc
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc
index dfe8d31ca7d128544dd61089546049b3e52e0567..68123b992a1b172c649f91de811dd5d38d3138fa 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc
@@ -348,6 +348,7 @@ scoped_ptr<DictionaryValue> GetDictionaryFromArray(
const std::string* value = array[i+1];
if (dictionary->HasKey(*name)) {
Value* entry = NULL;
+ scoped_ptr<Value> entry_owned;
ListValue* list = NULL;
if (!dictionary->GetWithoutPathExpansion(*name, &entry))
return scoped_ptr<DictionaryValue>();
@@ -355,8 +356,8 @@ scoped_ptr<DictionaryValue> GetDictionaryFromArray(
case Value::TYPE_STRING: // Replace the present string with a list.
list = new ListValue;
// Ignoring return value, we already verified the entry is there.
- dictionary->RemoveWithoutPathExpansion(*name, &entry);
- list->Append(entry);
+ dictionary->RemoveWithoutPathExpansion(*name, &entry_owned);
+ list->Append(entry_owned.release());
list->Append(Value::CreateStringValue(*value));
dictionary->SetWithoutPathExpansion(*name, list);
break;
« no previous file with comments | « chrome/browser/drive/fake_drive_service.cc ('k') | chrome/browser/extensions/api/storage/syncable_settings_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698