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

Unified Diff: chrome/browser/cocoa/wrench_menu_controller.mm

Issue 3014021: [Mac] Use |-performSelector:withDelay:| to execute commands from the Wrench menu. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/wrench_menu_controller.mm
diff --git a/chrome/browser/cocoa/wrench_menu_controller.mm b/chrome/browser/cocoa/wrench_menu_controller.mm
index 80ceed9df73c6e6447e88ea167945ce68fe49ddc..d408e1fa7dc6a8bae1e0dd7a707de72af9db63c6 100644
--- a/chrome/browser/cocoa/wrench_menu_controller.mm
+++ b/chrome/browser/cocoa/wrench_menu_controller.mm
@@ -15,6 +15,7 @@
@interface WrenchMenuController (Private)
- (WrenchMenuModel*)wrenchMenuModel;
- (void)adjustPositioning;
+- (void)dispatchCommandInternal:(NSNumber*)tag;
@end
@implementation WrenchMenuController
@@ -97,7 +98,17 @@
// TODO(rsesek): It'd be great if the zoom buttons didn't have to close the
// menu. See http://crbug.com/48679 for more info.
[menu_ cancelTracking];
- [self wrenchMenuModel]->ExecuteCommand(tag);
+ // Executing certain commands from the nested run loop of the menu can lead
+ // to wonky behavior. To avoid this, schedule the dispatch on the outermost
Nico 2010/07/21 15:15:56 s/ior/ior (e.g. http://crbug.com/$BUG)/
+ // run loop.
+ [self performSelector:@selector(dispatchCommandInternal:)
+ withObject:[NSNumber numberWithInt:tag]
+ afterDelay:0.0];
+}
+
+// Used to perform the actual dispatch on the outermost runloop.
+- (void)dispatchCommandInternal:(NSNumber*)tag {
+ [self wrenchMenuModel]->ExecuteCommand([tag intValue]);
}
- (WrenchMenuModel*)wrenchMenuModel {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698