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

Unified Diff: chrome/browser/extensions/menu_manager.cc

Issue 2740143002: Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Fix Android Compilation Error Created 3 years, 9 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/menu_manager.cc
diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc
index 11acf54ca5d1458c8ee8c4ea7ee8248ce2157998..4f021eb6ad16bada7a3e8200ccc59c8ef470ecbe 100644
--- a/chrome/browser/extensions/menu_manager.cc
+++ b/chrome/browser/extensions/menu_manager.cc
@@ -626,7 +626,6 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context,
if (item->type() == MenuItem::RADIO)
RadioItemSelected(item);
- std::unique_ptr<base::ListValue> args(new base::ListValue());
std::unique_ptr<base::DictionaryValue> properties(
new base::DictionaryValue());
@@ -665,8 +664,14 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context,
webview_guest->view_instance_id());
}
- base::DictionaryValue* raw_properties = properties.get();
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
Devlin 2017/03/30 22:44:59 nit: prefer base::MakeUnique<>.
jdoerrie 2017/04/07 13:56:17 Done.
+ args->Reserve(2);
args->Append(std::move(properties));
+ // |properties| is invalidated at this time, which is why |args| needs to be
+ // queried for the pointer. The obtained pointer is guaranteed to stay valid
+ // even after further Appends, because enough storage was reserved above.
+ base::DictionaryValue* raw_properties = nullptr;
+ args->GetDictionary(0, &raw_properties);
// Add the tab info to the argument list.
// No tab info in a platform app.

Powered by Google App Engine
This is Rietveld 408576698