The default bug view has changed. See this FAQ.

OS Idle API active to brief idle to active notification bug fix

RESOLVED FIXED in mozilla16

Status

()

Core
DOM
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: bsurender, Assigned: bsurender)

Tracking

Trunk
mozilla16
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
Created attachment 640123 [details] [diff] [review]
WIP active to active bug fix. waiting for try results.

Bug fix for case below:

When the user is active and then becomes idle, idle observers are notified. But if the user becomes active again before some or all idle observers are notified then active notifications need not be sent to those idle observers. 

Changeset uploaded to try at https://tbpl.mozilla.org/?tree=Try&rev=1924f96218bc

Will request a review once the try results are correct.
(Assignee)

Updated

5 years ago
Attachment #640123 - Flags: review?(jst)
(Assignee)

Comment 1

5 years ago
Clean green for the most part.
Oranges and purples were re-run and are now green.

https://tbpl.mozilla.org/?tree=Try&rev=1924f96218bc
Summary: WIP OS Idle API active to brief idle to active notification bug fix → OS Idle API active to brief idle to active notification bug fix
Comment on attachment 640123 [details] [diff] [review]
WIP active to active bug fix. waiting for try results.

+nsGlobalWindow::NotifyIdleObserver(IdleObserverHolder* aIdleObserverHolder,
                                    bool aCallOnidle)
 {
+  MOZ_ASSERT(aIdleObserverHolder);
+  aIdleObserverHolder->mPrevNotificationIdle = aCallOnidle ? true : false;

No need to check the boolean aCallOnidle here, just assign it directly.

- In nsGlobalWindow::HandleIdleObserverCallback():

+  IdleObserverHolder* idleObserver =
+    &(mIdleObservers.ElementAt(mIdleCallbackIndex));
+  NotifyIdleObserver(idleObserver, true);

Make idleObserver be a reference here and drop the extra parentheses. Pass the address of idleObserver to NotifyIdleObserver(). That way you don't take the address of a return value, which just looks a bit odd (it works, but using a reference here is IMO cleaner). Alternatively you could even make NotifyIdleObserver() take a reference instead of a pointer, assuming you always have an observer holder to pass in, which you must since you assert it's never null.

- In nsGlobalWindow::HandleIdleActiveEvent()

+    IdleObserverHolder* idleObserver = &(iter.GetNext());

Same deal, use a reference, pass the address of the reference below.

- In nsGlobalWindow::RegisterIdleObserver(nsI

+    IdleObserverHolder* idleObserver =
+      &(mIdleObservers.ElementAt(insertAtIndex));

Same here, Use a reference

- In nsGlobalWindow.h:

   IdleObserverHolder(const IdleObserverHolder& aOtherIdleObserver)
-    : mIdleObserver(aOtherIdleObserver.mIdleObserver), mTimeInS(aOtherIdleObserver.mTimeInS)
+    : mIdleObserver(aOtherIdleObserver.mIdleObserver), mTimeInS(aOtherIdleObserver.mTimeInS), 
+      mPrevNotificationIdle(aOtherIdleObserver.mPrevNotificationIdle)

Maybe rename "aOtherIdleObserver" here to simply "aOther" (fairly common practice in copy constructors)? Saves on typing, makes this easier to read...

r=jst with that!
Attachment #640123 - Flags: review?(jst) → review+
(Assignee)

Comment 3

5 years ago
Created attachment 642106 [details] [diff] [review]
OS idle api active to briefly idle to active notification fix.
Attachment #640123 - Attachment is obsolete: true
Attachment #642106 - Flags: checkin?(jst)
http://hg.mozilla.org/integration/mozilla-inbound/rev/23225d8cc529
https://hg.mozilla.org/mozilla-central/rev/23225d8cc529
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Attachment #642106 - Flags: checkin?(jst)
You need to log in before you can comment on or make changes to this bug.