Title: [218902] trunk/Source/WebKit2
Revision
218902
Author
cdu...@apple.com
Date
2017-06-28 16:22:29 -0700 (Wed, 28 Jun 2017)

Log Message

[iOS] Allow WKWebView clients to play audio in the background
https://bugs.webkit.org/show_bug.cgi?id=173932
<rdar://problem/32851547>

Reviewed by Ryosuke Niwa.

Allow WKWebView clients (such as MobileSafari) to play audio in the background
by taking a process assertion whenever a WebPage is audible.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateThrottleState):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (218901 => 218902)


--- trunk/Source/WebKit2/ChangeLog	2017-06-28 23:21:11 UTC (rev 218901)
+++ trunk/Source/WebKit2/ChangeLog	2017-06-28 23:22:29 UTC (rev 218902)
@@ -1,3 +1,17 @@
+2017-06-28  Chris Dumez  <cdu...@apple.com>
+
+        [iOS] Allow WKWebView clients to play audio in the background
+        https://bugs.webkit.org/show_bug.cgi?id=173932
+        <rdar://problem/32851547>
+
+        Reviewed by Ryosuke Niwa.
+
+        Allow WKWebView clients (such as MobileSafari) to play audio in the background
+        by taking a process assertion whenever a WebPage is audible.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::updateThrottleState):
+
 2017-06-28  Brent Fulgham  <bfulg...@apple.com>
 
         Teach ResourceLoadStatistics to recognize changes in the file system

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (218901 => 218902)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2017-06-28 23:21:11 UTC (rev 218901)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2017-06-28 23:22:29 UTC (rev 218902)
@@ -1528,7 +1528,8 @@
 
 #if PLATFORM(IOS)
     bool isCapturingMedia = m_activityState & ActivityState::IsCapturingMedia;
-    if (!isViewVisible() && !m_alwaysRunsAtForegroundPriority && !isCapturingMedia) {
+    bool isAudible = m_activityState & ActivityState::IsAudible;
+    if (!isViewVisible() && !m_alwaysRunsAtForegroundPriority && !isCapturingMedia && !isAudible) {
         if (m_activityToken) {
             RELEASE_LOG_IF_ALLOWED(ProcessSuspension, "%p - UIProcess is releasing a foreground assertion because the view is no longer visible", this);
             m_activityToken = nullptr;
@@ -1536,6 +1537,8 @@
     } else if (!m_activityToken) {
         if (isViewVisible())
             RELEASE_LOG_IF_ALLOWED(ProcessSuspension, "%p - UIProcess is taking a foreground assertion because the view is visible", this);
+        else if (isAudible)
+            RELEASE_LOG_IF_ALLOWED(ProcessSuspension, "%p - UIProcess is taking a foreground assertion because we are playing audio", this);
         else if (isCapturingMedia)
             RELEASE_LOG_IF_ALLOWED(ProcessSuspension, "%p - UIProcess is taking a foreground assertion because media capture is active", this);
         else
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to