Title: [260172] trunk/Source
Revision
260172
Author
jer.no...@apple.com
Date
2020-04-15 22:53:41 -0700 (Wed, 15 Apr 2020)

Log Message

REGRESSION (r260102): ASSERTION FAILED: m_arbitrators.contains(proxy) in WebKit::SharedArbitrator::endRoutingArbitrationForArbitrator
https://bugs.webkit.org/show_bug.cgi?id=210589
<rdar://problem/61844208>

Reviewed by Eric Carlson.

Source/WebCore:

Track whether the session successfully entered routing arbitration and only call
leaveRoutingAbritration() if entering was sucessful.

* platform/audio/mac/AudioSessionMac.mm:
(WebCore::AudioSession::setCategory):

Source/WebKit:

Protect against an assertion in the SharedArbitrator in case where a WebProcess is terminated before it can call
endRoutingArbitration().

* UIProcess/Media/AudioSessionRoutingArbitratorProxy.cpp:
(WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate):
* UIProcess/Media/AudioSessionRoutingArbitratorProxy.h:
* UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
(WebKit::SharedArbitrator::isInRoutingArbitrationForArbitrator):
(WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator):
(WebKit::SharedArbitrator::endRoutingArbitrationForArbitrator):
(WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (260171 => 260172)


--- trunk/Source/WebCore/ChangeLog	2020-04-16 05:22:35 UTC (rev 260171)
+++ trunk/Source/WebCore/ChangeLog	2020-04-16 05:53:41 UTC (rev 260172)
@@ -1,3 +1,17 @@
+2020-04-15  Jer Noble  <jer.no...@apple.com>
+
+        REGRESSION (r260102): ASSERTION FAILED: m_arbitrators.contains(proxy) in WebKit::SharedArbitrator::endRoutingArbitrationForArbitrator
+        https://bugs.webkit.org/show_bug.cgi?id=210589
+        <rdar://problem/61844208>
+
+        Reviewed by Eric Carlson.
+
+        Track whether the session successfully entered routing arbitration and only call
+        leaveRoutingAbritration() if entering was sucessful.
+
+        * platform/audio/mac/AudioSessionMac.mm:
+        (WebCore::AudioSession::setCategory):
+
 2020-04-15  Simon Fraser  <simon.fra...@apple.com>
 
         [Async overflow scroll] background-attachment:fixed needs to disable async overflow scrolling

Modified: trunk/Source/WebCore/platform/audio/mac/AudioSessionMac.mm (260171 => 260172)


--- trunk/Source/WebCore/platform/audio/mac/AudioSessionMac.mm	2020-04-16 05:22:35 UTC (rev 260171)
+++ trunk/Source/WebCore/platform/audio/mac/AudioSessionMac.mm	2020-04-16 05:53:41 UTC (rev 260172)
@@ -65,6 +65,7 @@
     bool setupArbitrationOngoing { false };
 #endif
     AudioSession::CategoryType m_categoryOverride;
+    bool inRoutingArbitration { false };
 };
 
 AudioSession::AudioSession()
@@ -98,8 +99,10 @@
     if (!m_routingArbitrationClient)
         return;
 
-    if (m_private->category != None)
+    if (m_private->inRoutingArbitration) {
+        m_private->inRoutingArbitration = false;
         m_routingArbitrationClient->leaveRoutingAbritration();
+    }
 
     m_private->category = category;
     if (m_private->category == None)
@@ -115,6 +118,8 @@
             return;
         }
 
+        m_private->inRoutingArbitration = true;
+
         // FIXME: Do we need to reset sample rate and buffer size for the new default device?
         if (defaultRouteChanged == DefaultRouteChanged::Yes)
             LOG(Media, "AudioSession::setCategory() - defaultRouteChanged!");

Modified: trunk/Source/WebKit/ChangeLog (260171 => 260172)


--- trunk/Source/WebKit/ChangeLog	2020-04-16 05:22:35 UTC (rev 260171)
+++ trunk/Source/WebKit/ChangeLog	2020-04-16 05:53:41 UTC (rev 260172)
@@ -1,3 +1,25 @@
+2020-04-15  Jer Noble  <jer.no...@apple.com>
+
+        REGRESSION (r260102): ASSERTION FAILED: m_arbitrators.contains(proxy) in WebKit::SharedArbitrator::endRoutingArbitrationForArbitrator
+        https://bugs.webkit.org/show_bug.cgi?id=210589
+        <rdar://problem/61844208>
+
+        Reviewed by Eric Carlson.
+
+        Protect against an assertion in the SharedArbitrator in case where a WebProcess is terminated before it can call
+        endRoutingArbitration().
+
+        * UIProcess/Media/AudioSessionRoutingArbitratorProxy.cpp:
+        (WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate):
+        * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h:
+        * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
+        (WebKit::SharedArbitrator::isInRoutingArbitrationForArbitrator):
+        (WebKit::SharedArbitrator::beginRoutingArbitrationForArbitrator):
+        (WebKit::SharedArbitrator::endRoutingArbitrationForArbitrator):
+        (WebKit::AudioSessionRoutingArbitratorProxy::processDidTerminate):
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
+
 2020-04-15  Tim Horton  <timothy_hor...@apple.com>
 
         REGRESSION (r258337): Crash when right clicking on link that uses the system UI font with optimizeLegibility on Mojave

Modified: trunk/Source/WebKit/UIProcess/Media/AudioSessionRoutingArbitratorProxy.cpp (260171 => 260172)


--- trunk/Source/WebKit/UIProcess/Media/AudioSessionRoutingArbitratorProxy.cpp	2020-04-16 05:22:35 UTC (rev 260171)
+++ trunk/Source/WebKit/UIProcess/Media/AudioSessionRoutingArbitratorProxy.cpp	2020-04-16 05:53:41 UTC (rev 260172)
@@ -43,6 +43,11 @@
     notImplemented();
 }
 
+void AudioSessionRoutingArbitratorProxy::processDidTerminate()
+{
+    notImplemented();
+}
+
 void AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory(WebCore::AudioSession::CategoryType, ArbitrationCallback&& callback)
 {
     notImplemented();

Modified: trunk/Source/WebKit/UIProcess/Media/AudioSessionRoutingArbitratorProxy.h (260171 => 260172)


--- trunk/Source/WebKit/UIProcess/Media/AudioSessionRoutingArbitratorProxy.h	2020-04-16 05:22:35 UTC (rev 260171)
+++ trunk/Source/WebKit/UIProcess/Media/AudioSessionRoutingArbitratorProxy.h	2020-04-16 05:53:41 UTC (rev 260172)
@@ -43,6 +43,7 @@
     AudioSessionRoutingArbitratorProxy(WebProcessProxy&);
     virtual ~AudioSessionRoutingArbitratorProxy();
 
+    void processDidTerminate();
     WebCore::AudioSession::CategoryType category() const { return m_category; }
 
     static uint64_t destinationId() { return 1; }

Modified: trunk/Source/WebKit/UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm (260171 => 260172)


--- trunk/Source/WebKit/UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm	2020-04-16 05:22:35 UTC (rev 260171)
+++ trunk/Source/WebKit/UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm	2020-04-16 05:53:41 UTC (rev 260172)
@@ -49,6 +49,7 @@
     using DefaultRouteChanged = AudioSessionRoutingArbitrationClient::DefaultRouteChanged;
     using ArbitrationCallback = AudioSessionRoutingArbitratorProxy::ArbitrationCallback;
 
+    bool isInRoutingArbitrationForArbitrator(AudioSessionRoutingArbitratorProxy&);
     void beginRoutingArbitrationForArbitrator(AudioSessionRoutingArbitratorProxy&, ArbitrationCallback&&);
     void endRoutingArbitrationForArbitrator(AudioSessionRoutingArbitratorProxy&);
 
@@ -65,9 +66,14 @@
     return instance;
 }
 
+bool SharedArbitrator::isInRoutingArbitrationForArbitrator(AudioSessionRoutingArbitratorProxy& proxy)
+{
+    return m_arbitrators.contains(proxy);
+}
+
 void SharedArbitrator::beginRoutingArbitrationForArbitrator(AudioSessionRoutingArbitratorProxy& proxy, ArbitrationCallback&& callback)
 {
-    ASSERT(!m_arbitrators.contains(proxy));
+    ASSERT(!isInRoutingArbitrationForArbitrator(proxy));
     m_arbitrators.add(proxy);
 
     if (m_setupArbitrationOngoing) {
@@ -125,7 +131,7 @@
 
 void SharedArbitrator::endRoutingArbitrationForArbitrator(AudioSessionRoutingArbitratorProxy& proxy)
 {
-    ASSERT(m_arbitrators.contains(proxy));
+    ASSERT(isInRoutingArbitrationForArbitrator(proxy));
     m_arbitrators.remove(proxy);
 
     if (!m_arbitrators.computesEmpty())
@@ -150,6 +156,12 @@
     m_process.removeMessageReceiver(Messages::AudioSessionRoutingArbitratorProxy::messageReceiverName(), destinationId());
 }
 
+void AudioSessionRoutingArbitratorProxy::processDidTerminate()
+{
+    if (SharedArbitrator::sharedInstance().isInRoutingArbitrationForArbitrator(*this))
+        SharedArbitrator::sharedInstance().endRoutingArbitrationForArbitrator(*this);
+}
+
 void AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory(WebCore::AudioSession::CategoryType category, ArbitrationCallback&& callback)
 {
     m_category = category;

Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (260171 => 260172)


--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp	2020-04-16 05:22:35 UTC (rev 260171)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp	2020-04-16 05:53:41 UTC (rev 260172)
@@ -830,6 +830,10 @@
     }
 #endif
 
+#if ENABLE(ROUTING_ARBITRATION)
+    m_routingArbitrator->processDidTerminate();
+#endif
+
     for (auto& page : pages)
         page->processDidTerminate(ProcessTerminationReason::Crash);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to