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.
<rdar://problem/23753931>
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.
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.
Created attachment 267060 [details] Patch and manual test
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.
(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().
Committed r193885: <http://trac.webkit.org/changeset/193885>