When the idle service has notified all observers that they system is idle, it sets a timer to wait for a fixed time before it re-checks for user activity and sends out a "back" notification as needed. Also, add NSPR logging so that users in debug builds can set NSPR_LOG_MODULES=idleService:<level> to get tracing information from the idle service.
Created attachment 614106 [details] [diff] [review] Fix idle service check interval to be 5 seconds, add PR_LOG tracing Fix calculation of next user activity poll, when all observers are idle - the previous code was multiplying MIN_IDLE_POLL_INTERVAL_MSEC * PR_USEC_PER_SEC (interval in milliseconds * microseconds per _second_). Also initialized the "last user activity time" to PR_NOW() at startup to get rid of some anomalous calculations during the first few calls, and removed some special cases that handled the value when it was initialized to 0 Should update documentation to describe how to enable the NSPR logging.
Comment on attachment 614106 [details] [diff] [review] Fix idle service check interval to be 5 seconds, add PR_LOG tracing Review of attachment 614106 [details] [diff] [review]: ----------------------------------------------------------------- Sorry for the delay, it looks great. Thanks for the patch. I'm not a widget peer, but I was previously delegated a patch for the same code so I'll go with it. nit: Please fix all of the PR_LOG( to be line length 80. I don't need to re-see it after the line length fixes and member->static global fix, you can just carry forward the r+. ::: widget/xpwidgets/nsIdleService.h @@ +228,5 @@ > > + /** > + * Log service handle > + */ > + PRLogModuleInfo *mLog; nit: Please move this to the .cpp and make it a static global instead as per the other logging code in /widget. Also you can surround it with #ifdef PR_LOGGING. I know it is a service so there is only 1 but might as well stay consistent with the other code.
Created attachment 618807 [details] [diff] [review] Fix idle service check interval to be 5 seconds, add PR_LOG tracing, v2 with nits picked Fix :bbondy's commends, email@example.com (see https://bugzilla.mozilla.org/show_bug.cgi?id=744527#c2)
Was this a regression? When updating Instantbird from Mozilla 11 to Mozilla 12 we stopped receiving "back" notifications when the user is no longer idle. Given the bug description here, it looks like this could be the fix I was looking for.
Seems like something from bug 720493, but the target milestone there is Mozilla 13, and I believe some of our nightly testers reproduced it on Mozilla 12 builds, so I'm not sure.