MessagePump's event loop doesn't wake up when idle-work is added to the queue

RESOLVED FIXED in Firefox 16

Status

()

Firefox for Android
General
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: kats, Assigned: kats)

Tracking

Trunk
Firefox 16
All
Android
Points:
---

Firefox Tracking Flags

(firefox16 fixed)

Details

Attachments

(1 attachment)

I often see delays of ~10 seconds between two ScreenshotRunnables running, even though gecko isn't doing anything else in between. It looks like calling MessageLoop::current()->PostIdleTask doesn't wake up the message pump that may be sleeping in NS_ProcessNextEvent. This means if a whole bunch of ScreenshotRunnables get queued up, they may not get run during actual idle periods, and may only trickle out as various background timers fire.

Another related problem is that the loop in MessagePump::Run should have a "continue" statement if DoIdleWork() returns true, so that it can process multiple pieces of idle work before going back to sleep.
Created attachment 635048 [details] [diff] [review]
Allow processing multiple pieces of idle work in a row

This fixes the second part of the problem (not processing more than one idle work in a row), and is sufficient for the screenshot code. However it would be good to also fix the other problem (that of queueing idle work not waking up the message pump).
Attachment #635048 - Flags: review?(blassey.bugs)
Attachment #635048 - Flags: review?(blassey.bugs) → review+
Pushed to try: https://tbpl.mozilla.org/?tree=Try&rev=7724a9f20832
Try run was pretty green, so landed on inbound:

https://hg.mozilla.org/integration/mozilla-inbound/rev/5bd5734369f7
status-firefox16: --- → fixed
OS: Linux → Android
Hardware: x86_64 → All
Target Milestone: --- → Firefox 16

Comment 4

5 years ago
https://hg.mozilla.org/mozilla-central/rev/5bd5734369f7
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.