[MediaStream iOS] Hold process assertion while media capture is active
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Apr 2017 22:23:15 +0000 (22:23 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Apr 2017 22:23:15 +0000 (22:23 +0000)
commit9183cd6a72d8922fc87be774660a5e7e3eac47dd
tree4969766c3253c0911b108d1572fd7577a8285337
parent86daf60d9db1f13d16e74d183dcdade62ccbed40
[MediaStream iOS] Hold process assertion while media capture is active
https://bugs.webkit.org/show_bug.cgi?id=171017
<rdar://problem/31719177>

Reviewed by Dean Jackson.

Source/WebCore:

* page/ActivityState.h: Add IsCapturingMedia flag.

* page/Page.cpp:
(WebCore::Page::updateTimerThrottlingState): Enable timer throttling when capture is active
like we do when playing audio.
(WebCore::Page::setActivityState): Ditto.

* page/PerformanceMonitor.cpp:
(WebCore::PerformanceMonitor::updateProcessStateForMemoryPressure): A process is active when
capturing media, as it is when playing audio.

Source/WebKit2:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateActivityState): Update IsCapturingMedia when necessary.
(WebKit::WebPageProxy::updateThrottleState): Hold a token when capture is active.
(WebKit::WebPageProxy::setMuted): Capture state may change when the page is muted,
so pass IsCapturingMedia to activityStateDidChange.
(WebKit::WebPageProxy::isPlayingMediaDidChange): Ditto.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateThrottleState): Don't allow page suppression when capture
is active.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/page/ActivityState.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/PerformanceMonitor.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp