Closed Bug 744527 Opened 12 years ago Closed 12 years ago

Idle service waits for 5000 seconds before checking for user activity when all observers are idle

Categories

(Core :: Widget, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla15

People

(Reporter: Irving, Assigned: Irving)

Details

Attachments

(1 file, 1 obsolete file)

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.
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.
Attachment #614106 - Flags: review?(netzen)
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.
Attachment #614106 - Flags: review?(netzen) → review+
Status: NEW → ASSIGNED
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/159d574be328
Flags: in-testsuite-
Keywords: checkin-needed
Target Milestone: --- → mozilla15
https://hg.mozilla.org/mozilla-central/rev/159d574be328
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
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.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: