Last Comment Bug 744527 - Idle service waits for 5000 seconds before checking for user activity when all observers are idle
: Idle service waits for 5000 seconds before checking for user activity when al...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Widget (show other bugs)
: Trunk
: x86 Mac OS X
: -- normal (vote)
: mozilla15
Assigned To: :Irving Reid (No longer working on Firefox)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-11 12:16 PDT by :Irving Reid (No longer working on Firefox)
Modified: 2012-06-19 10:29 PDT (History)
6 users (show)
ryanvm: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Fix idle service check interval to be 5 seconds, add PR_LOG tracing (12.38 KB, patch)
2012-04-11 12:30 PDT, :Irving Reid (No longer working on Firefox)
netzen: review+
Details | Diff | Splinter Review
Fix idle service check interval to be 5 seconds, add PR_LOG tracing, v2 with nits picked (12.18 KB, patch)
2012-04-26 14:31 PDT, :Irving Reid (No longer working on Firefox)
irving: review+
Details | Diff | Splinter Review

Description :Irving Reid (No longer working on Firefox) 2012-04-11 12:16:37 PDT
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.
Comment 1 :Irving Reid (No longer working on Firefox) 2012-04-11 12:30:53 PDT
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 2 Brian R. Bondy [:bbondy] 2012-04-16 09:01:57 PDT
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.
Comment 3 :Irving Reid (No longer working on Firefox) 2012-04-26 14:31:10 PDT
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, r=netzen@gmail.com (see https://bugzilla.mozilla.org/show_bug.cgi?id=744527#c2)
Comment 4 Ryan VanderMeulen [:RyanVM] 2012-04-26 16:22:23 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/159d574be328
Comment 5 :Ms2ger (⌚ UTC+1/+2) 2012-04-27 06:55:28 PDT
https://hg.mozilla.org/mozilla-central/rev/159d574be328
Comment 6 Florian Quèze [:florian] [:flo] 2012-06-19 10:23:44 PDT
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.
Comment 7 Florian Quèze [:florian] [:flo] 2012-06-19 10:29:43 PDT
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.

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