Closed
Bug 842149
Opened 13 years ago
Closed 13 years ago
nsIdleService polls too often if an idle listener removes itself
Categories
(Core :: Widget, defect)
Core
Widget
Tracking
()
RESOLVED
FIXED
mozilla22
People
(Reporter: Irving, Assigned: Irving)
Details
Attachments
(1 file)
|
6.95 KB,
patch
|
justin.lebar+bug
:
review+
|
Details | Diff | Splinter Review |
On platforms that support polling for how long the system has been idle (OS/2, GTK, Windows, Qt, OS/X), when a handler that is currently in the idle state deregisters itself from the idle service, the idle service doesn't change its "mAnyObserverIdle" flag.
This can lead to the idle service polling the OS for idle status every five seconds, to detect the idle -> user back transition, even though there is no handler waiting for that transition.
| Assignee | ||
Comment 1•13 years ago
|
||
This takes the approach of counting the number of idle observers. The alternative approach would be to scan the observer list looking for remaining observers in idle mode, when one is removed.
Attachment #714957 -
Flags: review?(justin.lebar+bug)
Comment 2•13 years ago
|
||
Gosh, we really need to rewrite this whole file.
Comment 3•13 years ago
|
||
> // Find the entry and remove it, if it was the last entry, we just let the
> // existing timer run to completion (there might be a new registration in a
> // little while.
> IdleListenerComparator c;
>- if (mArrayListeners.RemoveElement(listener, c)) {
>+ nsTArray<IdleListener>::index_type element = mArrayListeners.IndexOf(listener, 0, c);
Nit: This is an index, so please don't call it |element|.
r=me, I guess. It would take me all day to verify that this patch actually works, but it's hard to imagine how this would make things any worse...
Updated•13 years ago
|
Attachment #714957 -
Flags: review?(justin.lebar+bug) → review+
Comment 4•13 years ago
|
||
At the risk of stating the obvious, please keep an eye out for regressions after landing this; we don't have a great track record with modifying the idle service.
| Assignee | ||
Comment 5•13 years ago
|
||
Inbound with nit fixed: https://hg.mozilla.org/integration/mozilla-inbound/rev/601c2d37c2bc
Comment 6•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
You need to log in
before you can comment on or make changes to this bug.
Description
•