Last Comment Bug 766696 - MessagePump's event loop doesn't wake up when idle-work is added to the queue
: MessagePump's event loop doesn't wake up when idle-work is added to the queue
Status: RESOLVED FIXED
:
Product: Firefox for Android
Classification: Client Software
Component: General (show other bugs)
: Trunk
: All Android
: -- normal (vote)
: Firefox 16
Assigned To: Kartikaya Gupta (email:kats@mozilla.com)
:
: Sebastian Kaspari (:sebastian)
Mentors:
Depends on:
Blocks: 766643
  Show dependency treegraph
 
Reported: 2012-06-20 13:43 PDT by Kartikaya Gupta (email:kats@mozilla.com)
Modified: 2012-06-22 03:47 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
fixed


Attachments
Allow processing multiple pieces of idle work in a row (707 bytes, patch)
2012-06-20 13:46 PDT, Kartikaya Gupta (email:kats@mozilla.com)
blassey.bugs: review+
Details | Diff | Splinter Review

Description Kartikaya Gupta (email:kats@mozilla.com) 2012-06-20 13:43:14 PDT
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.
Comment 1 Kartikaya Gupta (email:kats@mozilla.com) 2012-06-20 13:46:08 PDT
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).
Comment 2 Kartikaya Gupta (email:kats@mozilla.com) 2012-06-20 19:08:09 PDT
Pushed to try: https://tbpl.mozilla.org/?tree=Try&rev=7724a9f20832
Comment 3 Kartikaya Gupta (email:kats@mozilla.com) 2012-06-21 07:47:50 PDT
Try run was pretty green, so landed on inbound:

https://hg.mozilla.org/integration/mozilla-inbound/rev/5bd5734369f7
Comment 4 Ed Morley [:emorley] 2012-06-22 03:47:36 PDT
https://hg.mozilla.org/mozilla-central/rev/5bd5734369f7

Note You need to log in before you can comment on or make changes to this bug.