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

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

Issue 2809023003: Reland of Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Created 3 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
« no previous file with comments | « chrome/browser/extensions/install_signer.cc ('k') | chrome/browser/extensions/policy_handlers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/menu_manager.cc
diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc
index dc1abda3af58c2b0a44833209da90d3ea32761af..7bfaf2d878036e95e6b304c81feb3af05259602f 100644
--- a/chrome/browser/extensions/menu_manager.cc
+++ b/chrome/browser/extensions/menu_manager.cc
@@ -625,7 +625,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());
@@ -664,8 +663,14 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context,
webview_guest->view_instance_id());
}
- base::DictionaryValue* raw_properties = properties.get();
+ auto args = base::MakeUnique<base::ListValue>();
+ 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.
« no previous file with comments | « chrome/browser/extensions/install_signer.cc ('k') | chrome/browser/extensions/policy_handlers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698