Bug 151840 - [iOS] Suspend and resume device motion and device orientation updates when page is hidden and visible, respectively
Summary: [iOS] Suspend and resume device motion and device orientation updates when pa...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Local Build
Hardware: iPhone / iPad iOS 9.0
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar, PlatformOnly
Depends on:
Blocks:
 
Reported: 2015-12-03 17:40 PST by Daniel Bates
Modified: 2016-06-01 15:59 PDT (History)
10 users (show)

See Also:


Attachments
Patch and manual test (10.64 KB, patch)
2015-12-07 15:19 PST, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch and manual test (11.34 KB, patch)
2015-12-09 18:37 PST, Daniel Bates
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2015-12-03 17:40:42 PST
As we do in Legacy WebKit, in WebKit2 we should suspend active DOM objects when the a page is in the background or the app leaves the foreground.
Comment 1 Daniel Bates 2015-12-03 17:46:23 PST
<rdar://problem/23753931>
Comment 2 Daniel Bates 2015-12-07 15:19:31 PST
Created attachment 266817 [details]
Patch and manual test

This patch teach WebKit2 to call to the iOS-specific Frame::setTimersPaused() machinery. Ideally we should unify the iOS-specific Frame::setTimersPaused() machinery with the platform-independent Frame::{suspend, resume}ActiveDOMObjectsAndAnimations()-logic and then make use of the latter logic in WebKit2.
Comment 3 Daniel Bates 2015-12-09 18:34:14 PST
After talking with Brent Fulgham and Sam Weinig today (12/09) it seems sufficient to suspend device motion and device orientation updates for now. In the future we may want to consider being more aggressive and suspending and resuming DOM timers when a page is hidden and made visible, respectively.
Comment 4 Daniel Bates 2015-12-09 18:37:27 PST
Created attachment 267060 [details]
Patch and manual test
Comment 5 Simon Fraser (smfr) 2015-12-09 18:43:19 PST
Comment on attachment 267060 [details]
Patch and manual test

View in context: https://bugs.webkit.org/attachment.cgi?id=267060&action=review

> Source/WebCore/page/Page.cpp:1311
> +    syslog(LOG_WARNING, "## Page::setIsVisibleInternal; isVisible: %d", isVisible);

I don't think you want to commit that.

> Source/WebCore/page/Page.h:398
> +    void suspendDeviceMotionAndOrientationUpdates();
> +    void resumeDeviceMotionAndOrientationUpdates();

I don't see anyone calling these.
Comment 6 Daniel Bates 2015-12-09 18:47:36 PST
(In reply to comment #5)
> Comment on attachment 267060 [details]
> Patch and manual test
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=267060&action=review
> 
> > Source/WebCore/page/Page.cpp:1311
> > +    syslog(LOG_WARNING, "## Page::setIsVisibleInternal; isVisible: %d", isVisible);
> 
> I don't think you want to commit that.
> 

Will remove before landing.

> > Source/WebCore/page/Page.h:398
> > +    void suspendDeviceMotionAndOrientationUpdates();
> > +    void resumeDeviceMotionAndOrientationUpdates();
> 
> I don't see anyone calling these.

These are called by Page::setIsVisibleInternal().
Comment 7 Daniel Bates 2015-12-09 18:53:34 PST
Committed r193885: <http://trac.webkit.org/changeset/193885>