From cf73fb737f62d0c728406007b6509311a65eeab8 Mon Sep 17 00:00:00 2001 From: Zhuo Lu Date: Mon, 20 Nov 2017 16:29:16 -0800 Subject: [PATCH] Small optimization --- atom/browser/ui/cocoa/atom_menu_controller.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/atom/browser/ui/cocoa/atom_menu_controller.mm b/atom/browser/ui/cocoa/atom_menu_controller.mm index 9355a61f02da..edb1594ffbf8 100644 --- a/atom/browser/ui/cocoa/atom_menu_controller.mm +++ b/atom/browser/ui/cocoa/atom_menu_controller.mm @@ -189,7 +189,6 @@ NSMenu* swapMenu_; fromModel:(atom::AtomMenuModel*)model { base::string16 label16 = model->GetLabelAt(index); NSString* label = l10n_util::FixUpWindowsStyleLabel(label16); - base::string16 role = model->GetRoleAt(index); base::scoped_nsobject item( [[NSMenuItem alloc] initWithTitle:label @@ -201,6 +200,7 @@ NSMenu* swapMenu_; if (model->GetIconAt(index, &icon) && !icon.IsEmpty()) [item setImage:icon.ToNSImage()]; + base::string16 role = model->GetRoleAt(index); atom::AtomMenuModel::ItemType type = model->GetTypeAt(index); if (type == atom::AtomMenuModel::TYPE_SUBMENU) { // Recursively build a submenu from the sub-model at this index. @@ -244,7 +244,6 @@ NSMenu* swapMenu_; } // Set menu item's role. - base::string16 role = model->GetRoleAt(index); [item setTarget:self]; if (!role.empty()) { for (const Role& pair : kRolesMap) {