Open Bug 1355061 Opened 3 years ago Updated 2 years ago

Interacting with statusbar items in the menubar blocks the UI thread for several hundred ms

Categories

(Core :: Widget: Cocoa, defect, P2)

defect

Tracking

()

People

(Reporter: florian, Unassigned)

References

Details

(Keywords: perf, Whiteboard: [qf-] [tpi:+])

See this profile of clicking the microphone icon in the menubar: https://perfht.ml/2oR566A (I think the first 400ms of jank is clicking the microphone icon to show the popupmenu, and the second 400ms of jank is clicking a menu item).

If you need a test webrtc site to get the microphone icon to show up, you can use https://appr.tc/
Priority: -- → P2
Whiteboard: [qf] → [qf] [tpi:+]
Whiteboard: [qf] [tpi:+] → [qf:p1] [tpi:+]
Native menus use a nested event loop, whose RunLoopMode is such that it does not process our Gecko event loop CFRunLoopSource, so no Gecko events are being processed while these menus are open. We might be able to register our CFRunLoopSource with a differen RunLoopMode mask. I don't know how valuable that would be. It might also cause lots of regressions.
I think I agree with Markus.  I'm also not quite sure why this was marked as [qf:p1].  In my experience, OSX menu bar code can easily spend tens if not hundreds of milliseconds doing stuff regularly and there's not much that we can do about it.

I suggest we bump it down to [qf-].  Markus, do you agree?
Flags: needinfo?(mstange)
I think I was wrong about the nested event loops. The jank in this profile looks like it's coming from different sources.
The first piece of jank is compiling CoreImage shaders. This only needs to be done the first time such a popup is opened, and it's something we have no control over.
The second piece of jank is the blinking animation that is played if you click a menu item, and then the fade-out animation. The system chooses to block the main thread during those animations and there's nothing we can do about that.
Flags: needinfo?(mstange)
Whiteboard: [qf:p1] [tpi:+] → [qf] [tpi:+]
Whiteboard: [qf] [tpi:+] → [qf-] [tpi:+]
Keywords: perf
Here is a profile of the browser/base/content/test/webrtc/browser_devices_get_user_media.js test where this bug is the biggest source of jank: https://perfht.ml/2j3tKfU
You need to log in before you can comment on or make changes to this bug.