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

Unified Diff: base/message_loop/message_pump_mac.mm

Issue 2852233002: Mac[Views]: Make native menus more responsive by pumping private runloop modes. (Closed)
Patch Set: respond to comments Created 3 years, 7 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 | chrome/browser/ui/cocoa/extensions/browser_action_button_interactive_uitest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_pump_mac.mm
diff --git a/base/message_loop/message_pump_mac.mm b/base/message_loop/message_pump_mac.mm
index 82d9f1e818b18c07af4b3ec2ac5e785de43af61d..370e351ec9cd449c9c281da177dedf0db8aac7c0 100644
--- a/base/message_loop/message_pump_mac.mm
+++ b/base/message_loop/message_pump_mac.mm
@@ -25,38 +25,57 @@ namespace base {
namespace {
+// AppKit RunLoop modes observed to potentially run tasks posted to Chrome's
+// main thread task runner. Some are internal to AppKit but must be observed to
+// keep Chrome's UI responsive. Others that may be interesting, but are not
+// watched:
+// - com.apple.hitoolbox.windows.transitionmode
+// - com.apple.hitoolbox.windows.flushmode
+const CFStringRef kAllModes[] = {
+ kCFRunLoopCommonModes,
+
+ // Mode that only sees Chrome work sources.
+ kMessageLoopExclusiveRunLoopMode,
+
+ // Process work when NSMenus are fading out.
+ CFSTR("com.apple.hitoolbox.windows.windowfadingmode"),
+
+ // Process work when AppKit is highlighting an item on the main menubar.
+ CFSTR("NSUnhighlightMenuRunLoopMode"),
+};
+
void CFRunLoopAddSourceToAllModes(CFRunLoopRef rl, CFRunLoopSourceRef source) {
- CFRunLoopAddSource(rl, source, kCFRunLoopCommonModes);
- CFRunLoopAddSource(rl, source, kMessageLoopExclusiveRunLoopMode);
+ for (const CFStringRef& mode : kAllModes)
+ CFRunLoopAddSource(rl, source, mode);
}
void CFRunLoopRemoveSourceFromAllModes(CFRunLoopRef rl,
CFRunLoopSourceRef source) {
- CFRunLoopRemoveSource(rl, source, kCFRunLoopCommonModes);
- CFRunLoopRemoveSource(rl, source, kMessageLoopExclusiveRunLoopMode);
+ for (const CFStringRef& mode : kAllModes)
+ CFRunLoopRemoveSource(rl, source, mode);
}
void CFRunLoopAddTimerToAllModes(CFRunLoopRef rl, CFRunLoopTimerRef timer) {
- CFRunLoopAddTimer(rl, timer, kCFRunLoopCommonModes);
- CFRunLoopAddTimer(rl, timer, kMessageLoopExclusiveRunLoopMode);
+ for (const CFStringRef& mode : kAllModes)
+ CFRunLoopAddTimer(rl, timer, mode);
}
void CFRunLoopRemoveTimerFromAllModes(CFRunLoopRef rl,
CFRunLoopTimerRef timer) {
- CFRunLoopRemoveTimer(rl, timer, kCFRunLoopCommonModes);
- CFRunLoopRemoveTimer(rl, timer, kMessageLoopExclusiveRunLoopMode);
+ for (const CFStringRef& mode : kAllModes)
+ CFRunLoopRemoveTimer(rl, timer, mode);
}
void CFRunLoopAddObserverToAllModes(CFRunLoopRef rl,
CFRunLoopObserverRef observer) {
- CFRunLoopAddObserver(rl, observer, kCFRunLoopCommonModes);
- CFRunLoopAddObserver(rl, observer, kMessageLoopExclusiveRunLoopMode);
+ for (const CFStringRef& mode : kAllModes)
+ CFRunLoopAddObserver(rl, observer, mode);
}
void CFRunLoopRemoveObserverFromAllModes(CFRunLoopRef rl,
CFRunLoopObserverRef observer) {
- CFRunLoopRemoveObserver(rl, observer, kCFRunLoopCommonModes);
- CFRunLoopRemoveObserver(rl, observer, kMessageLoopExclusiveRunLoopMode);
+ for (const CFStringRef& mode : kAllModes)
+ CFRunLoopRemoveObserver(rl, observer, mode);
}
void NoOp(void* info) {
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/extensions/browser_action_button_interactive_uitest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698