Closed Bug 1157908 Opened 6 years ago Closed 6 years ago
Lower the priority of Gecko thread Looper messages
Right now, for every loop of the main Gecko thread event loop, we pump the Looper message loop once. This effectively gives Looper messages the same priority as Gecko events. Considering we only need to process Looper messages in rare cases, I think we are pumping the message loop unnecessarily. Moving the PumpMessageLoop call to nsAppShell::ProcessNextNativeEvent would reduce unnecessary calls.
Call pumpMessageLoop only when we don't have other events, rather than with every iteration of the event loop. I don't think it will have that big of an effect, but it's nice to have.
Attachment #8596834 - Flags: review?(snorp)
I also took some time to optimize pumpMessageLoop a bit. Before, C++ was calling pumpMessageLoop in Java through JNI, but pumpMessageLoop has to go back and call getNextMessageFromQueue in C++ through JNI again. This patch makes us cache the necessary Java references in AndroidBridge, so that we only have to cross the JNI boundary once.
Attachment #8596837 - Flags: review?(snorp)
Comment on attachment 8596834 [details] [diff] [review] Give Gecko thread Looper low priority (v1) Review of attachment 8596834 [details] [diff] [review]: ----------------------------------------------------------------- I think Flash was (is) the only thing that ever used the Looper on the Gecko thread, but this seems fine.
Attachment #8596834 - Flags: review?(snorp) → review+
Attachment #8596837 - Flags: review?(snorp) → review+
Backed out for various Android test failures. https://hg.mozilla.org/integration/mozilla-inbound/rev/6d0fb655e2e6 https://treeherder.mozilla.org/logviewer.html#?job_id=9281105&repo=mozilla-inbound was permafailing since this landed. There were failures in other chunks that looked related as well.
Various IPC crashes on debug builds too. Basically, make sure it's very green on Try before attempting to land again :)
Added AndroidBridge null-check.
You need to log in before you can comment on or make changes to this bug.