Bug 151840

Summary: [iOS] Suspend and resume device motion and device orientation updates when page is hidden and visible, respectively
Product: WebKit Reporter: Daniel Bates <dbates>
Component: WebKit2Assignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, bfulgham, cdumez, commit-queue, ddkilzer, dino, esprehn+autocc, kangil.han, sam, simon.fraser
Priority: P2 Keywords: InRadar, PlatformOnly
Version: WebKit Local Build   
Hardware: iPhone / iPad   
OS: iOS 9.0   
Attachments:
Description Flags
Patch and manual test
none
Patch and manual test simon.fraser: review+

Daniel Bates
Reported 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.
Attachments
Patch and manual test (10.64 KB, patch)
2015-12-07 15:19 PST, Daniel Bates
no flags
Patch and manual test (11.34 KB, patch)
2015-12-09 18:37 PST, Daniel Bates
simon.fraser: review+
Daniel Bates
Comment 1 2015-12-03 17:46:23 PST
Daniel Bates
Comment 2 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.
Daniel Bates
Comment 3 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.
Daniel Bates
Comment 4 2015-12-09 18:37:27 PST
Created attachment 267060 [details] Patch and manual test
Simon Fraser (smfr)
Comment 5 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.
Daniel Bates
Comment 6 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().
Daniel Bates
Comment 7 2015-12-09 18:53:34 PST
Note You need to log in before you can comment on or make changes to this bug.