<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[280731] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/280731">280731</a></dd>
<dt>Author</dt> <dd>youenn@apple.com</dd>
<dt>Date</dt> <dd>2021-08-06 12:04:17 -0700 (Fri, 06 Aug 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>WebKit::SampleBufferDisplayLayer needs to handle GPUProcess crash
https://bugs.webkit.org/show_bug.cgi?id=228824
<rdar://problem/81564477>

Reviewed by Eric Carlson.

Source/WebCore:

Manually tested.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferDisplayLayerStatusDidChange):
Recreate a new layer if the previous one failed.

Source/WebKit:

Make WebKit::SampleBufferDisplayLayer listen to GPUProcess connection being closed.
When that happens, notify its client that it failed.

* WebProcess/GPU/GPUProcessConnection.cpp:
* WebProcess/GPU/GPUProcessConnection.h:
* WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
* WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp:
(WebKit::SampleBufferDisplayLayer::create):
(WebKit::SampleBufferDisplayLayer::SampleBufferDisplayLayer):
(WebKit::SampleBufferDisplayLayer::~SampleBufferDisplayLayer):
(WebKit::SampleBufferDisplayLayer::setDidFail):
(WebKit::SampleBufferDisplayLayer::gpuProcessConnectionDidClose):
* WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h:
* WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp:
(WebKit::SampleBufferDisplayLayerManager::createLayer):
* WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationSampleBufferDisplayLayerh">trunk/Source/WebCore/platform/graphics/avfoundation/SampleBufferDisplayLayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcLocalSampleBufferDisplayLayermm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaStreamAVFObjCh">trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaStreamAVFObjCmm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitGPUProcesswebrtcRemoteSampleBufferDisplayLayercpp">trunk/Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp</a></li>
<li><a href="#trunkSourceWebKitGPUProcesswebrtcRemoteSampleBufferDisplayLayerh">trunk/Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUGPUProcessConnectioncpp">trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUGPUProcessConnectionh">trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUmediaRemoteMediaPlayerManagercpp">trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUwebrtcSampleBufferDisplayLayercpp">trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUwebrtcSampleBufferDisplayLayerh">trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUwebrtcSampleBufferDisplayLayerManagercpp">trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUwebrtcSampleBufferDisplayLayerManagerh">trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebCore/ChangeLog      2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2021-08-06  Youenn Fablet  <youenn@apple.com>
+
+        WebKit::SampleBufferDisplayLayer needs to handle GPUProcess crash
+        https://bugs.webkit.org/show_bug.cgi?id=228824
+        <rdar://problem/81564477>
+
+        Reviewed by Eric Carlson.
+
+        Manually tested.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferDisplayLayerStatusDidChange):
+        Recreate a new layer if the previous one failed.
+
</ins><span class="cx"> 2021-08-06  Andres Gonzalez  <andresg_22@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Crash at WebKit::WebPage::requestTextRecognition caused by accessibility invocation.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationSampleBufferDisplayLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/SampleBufferDisplayLayer.h (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/SampleBufferDisplayLayer.h   2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/SampleBufferDisplayLayer.h      2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx">     class Client : public CanMakeWeakPtr<Client> {
</span><span class="cx">     public:
</span><span class="cx">         virtual ~Client() = default;
</span><del>-        virtual void sampleBufferDisplayLayerStatusDidChange(SampleBufferDisplayLayer&) = 0;
</del><ins>+        virtual void sampleBufferDisplayLayerStatusDidFail() = 0;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT static std::unique_ptr<SampleBufferDisplayLayer> create(Client&);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcLocalSampleBufferDisplayLayermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm        2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm   2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -207,11 +207,8 @@
</span><span class="cx"> void LocalSampleBufferDisplayLayer::layerStatusDidChange()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><del>-    if (m_sampleBufferDisplayLayer.get().status != AVQueuedSampleBufferRenderingStatusRendering)
-        return;
-    if (!m_client)
-        return;
-    m_client->sampleBufferDisplayLayerStatusDidChange(*this);
</del><ins>+    if (m_client && m_sampleBufferDisplayLayer.get().status == AVQueuedSampleBufferRenderingStatusFailed)
+        m_client->sampleBufferDisplayLayerStatusDidFail();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void LocalSampleBufferDisplayLayer::layerErrorDidChange()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaStreamAVFObjCh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h  2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h     2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -263,7 +263,7 @@
</span><span class="cx">     std::unique_ptr<VideoLayerManagerObjC> m_videoLayerManager;
</span><span class="cx"> 
</span><span class="cx">     // SampleBufferDisplayLayer::Client
</span><del>-    void sampleBufferDisplayLayerStatusDidChange(SampleBufferDisplayLayer&) final;
</del><ins>+    void sampleBufferDisplayLayerStatusDidFail() final;
</ins><span class="cx"> 
</span><span class="cx">     RetainPtr<WebRootSampleBufferBoundsChangeListener> m_boundsChangeListener;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaStreamAVFObjCmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm 2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm    2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -336,8 +336,10 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferDisplayLayerStatusDidChange(SampleBufferDisplayLayer&)
</del><ins>+void MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferDisplayLayerStatusDidFail()
</ins><span class="cx"> {
</span><ins>+    destroyLayers();
+    updateLayersAsNeeded();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive()
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebKit/ChangeLog       2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2021-08-06  Youenn Fablet  <youenn@apple.com>
+
+        WebKit::SampleBufferDisplayLayer needs to handle GPUProcess crash
+        https://bugs.webkit.org/show_bug.cgi?id=228824
+        <rdar://problem/81564477>
+
+        Reviewed by Eric Carlson.
+
+        Make WebKit::SampleBufferDisplayLayer listen to GPUProcess connection being closed.
+        When that happens, notify its client that it failed.
+
+        * WebProcess/GPU/GPUProcessConnection.cpp:
+        * WebProcess/GPU/GPUProcessConnection.h:
+        * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
+        * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp:
+        (WebKit::SampleBufferDisplayLayer::create):
+        (WebKit::SampleBufferDisplayLayer::SampleBufferDisplayLayer):
+        (WebKit::SampleBufferDisplayLayer::~SampleBufferDisplayLayer):
+        (WebKit::SampleBufferDisplayLayer::setDidFail):
+        (WebKit::SampleBufferDisplayLayer::gpuProcessConnectionDidClose):
+        * WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h:
+        * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp:
+        (WebKit::SampleBufferDisplayLayerManager::createLayer):
+        * WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.h:
+
</ins><span class="cx"> 2021-08-06  Peng Liu  <peng.liu6@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [macOS] Clean up Feature Flags related code
</span></span></pre></div>
<a id="trunkSourceWebKitGPUProcesswebrtcRemoteSampleBufferDisplayLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp 2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp    2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -142,7 +142,7 @@
</span><span class="cx">     return m_connection.ptr();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteSampleBufferDisplayLayer::sampleBufferDisplayLayerStatusDidChange(WebCore::SampleBufferDisplayLayer&)
</del><ins>+void RemoteSampleBufferDisplayLayer::sampleBufferDisplayLayerStatusDidFail()
</ins><span class="cx"> {
</span><span class="cx">     send(Messages::SampleBufferDisplayLayer::SetDidFail { m_sampleBufferDisplayLayer->didFail() });
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitGPUProcesswebrtcRemoteSampleBufferDisplayLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h   2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h      2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -80,7 +80,7 @@
</span><span class="cx">     uint64_t messageSenderDestinationID() const final { return m_identifier.toUInt64(); }
</span><span class="cx"> 
</span><span class="cx">     // WebCore::SampleBufferDisplayLayer::Client
</span><del>-    void sampleBufferDisplayLayerStatusDidChange(WebCore::SampleBufferDisplayLayer&) final;
</del><ins>+    void sampleBufferDisplayLayerStatusDidFail() final;
</ins><span class="cx"> 
</span><span class="cx">     SampleBufferDisplayLayerIdentifier m_identifier;
</span><span class="cx">     Ref<IPC::Connection> m_connection;
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUGPUProcessConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp      2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp 2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> #include "RemoteMediaEngineConfigurationFactory.h"
</span><span class="cx"> #include "RemoteMediaPlayerManager.h"
</span><span class="cx"> #include "RemoteRemoteCommandListenerMessages.h"
</span><ins>+#include "SampleBufferDisplayLayerManager.h"
</ins><span class="cx"> #include "SampleBufferDisplayLayerMessages.h"
</span><span class="cx"> #include "SourceBufferPrivateRemoteMessages.h"
</span><span class="cx"> #include "WebCoreArgumentCoders.h"
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUGPUProcessConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.h (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.h        2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.h   2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> #include "Connection.h"
</span><span class="cx"> #include "MediaOverridesForTesting.h"
</span><span class="cx"> #include "MessageReceiverMap.h"
</span><del>-#include "SampleBufferDisplayLayerManager.h"
</del><span class="cx"> #include "SharedMemory.h"
</span><span class="cx"> #include <WebCore/AudioSession.h>
</span><span class="cx"> #include <WebCore/PlatformMediaSession.h>
</span><span class="lines">@@ -52,6 +51,7 @@
</span><span class="cx"> 
</span><span class="cx"> class RemoteAudioSourceProviderManager;
</span><span class="cx"> class RemoteMediaPlayerManager;
</span><ins>+class SampleBufferDisplayLayerManager;
</ins><span class="cx"> class WebPage;
</span><span class="cx"> struct OverrideScreenDataForTesting;
</span><span class="cx"> struct WebPageCreationParameters;
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUmediaRemoteMediaPlayerManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp    2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp       2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include "RemoteMediaPlayerMIMETypeCache.h"
</span><span class="cx"> #include "RemoteMediaPlayerManagerProxyMessages.h"
</span><span class="cx"> #include "RemoteMediaPlayerProxyConfiguration.h"
</span><ins>+#include "SampleBufferDisplayLayerManager.h"
</ins><span class="cx"> #include "WebProcess.h"
</span><span class="cx"> #include "WebProcessCreationParameters.h"
</span><span class="cx"> #include <WebCore/MediaPlayer.h>
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUwebrtcSampleBufferDisplayLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp   2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp      2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -42,12 +42,12 @@
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><del>-std::unique_ptr<SampleBufferDisplayLayer> SampleBufferDisplayLayer::create(SampleBufferDisplayLayerManager& manager, Client& client)
</del><ins>+std::unique_ptr<SampleBufferDisplayLayer> SampleBufferDisplayLayer::create(SampleBufferDisplayLayerManager& manager, WebCore::SampleBufferDisplayLayer::Client& client)
</ins><span class="cx"> {
</span><span class="cx">     return std::unique_ptr<SampleBufferDisplayLayer>(new SampleBufferDisplayLayer(manager, client));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SampleBufferDisplayLayer::SampleBufferDisplayLayer(SampleBufferDisplayLayerManager& manager, Client& client)
</del><ins>+SampleBufferDisplayLayer::SampleBufferDisplayLayer(SampleBufferDisplayLayerManager& manager, WebCore::SampleBufferDisplayLayer::Client& client)
</ins><span class="cx">     : WebCore::SampleBufferDisplayLayer(client)
</span><span class="cx">     , m_manager(makeWeakPtr(manager))
</span><span class="cx">     , m_connection(WebProcess::singleton().ensureGPUProcessConnection().connection())
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx">     , m_identifier(SampleBufferDisplayLayerIdentifier::generate())
</span><span class="cx"> {
</span><span class="cx">     manager.addLayer(*this);
</span><ins>+    WebProcess::singleton().ensureGPUProcessConnection().addClient(*this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SampleBufferDisplayLayer::initialize(bool hideRootLayer, IntSize size, CompletionHandler<void(bool)>&& callback)
</span><span class="lines">@@ -77,6 +78,7 @@
</span><span class="cx"> 
</span><span class="cx"> SampleBufferDisplayLayer::~SampleBufferDisplayLayer()
</span><span class="cx"> {
</span><ins>+    WebProcess::singleton().ensureGPUProcessConnection().removeClient(*this);
</ins><span class="cx">     m_connection->send(Messages::RemoteSampleBufferDisplayLayerManager::ReleaseLayer { m_identifier }, 0);
</span><span class="cx">     if (m_manager)
</span><span class="cx">         m_manager->removeLayer(*this);
</span><span class="lines">@@ -147,6 +149,13 @@
</span><span class="cx">     m_didFail = value;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void SampleBufferDisplayLayer::gpuProcessConnectionDidClose(GPUProcessConnection&)
+{
+    m_didFail = true;
+    if (m_client)
+        m_client->sampleBufferDisplayLayerStatusDidFail();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUwebrtcSampleBufferDisplayLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h     2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayer.h        2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA) && ENABLE(GPU_PROCESS) && ENABLE(MEDIA_STREAM)
</span><span class="cx"> 
</span><ins>+#include "GPUProcessConnection.h"
</ins><span class="cx"> #include "MessageReceiver.h"
</span><span class="cx"> #include "SampleBufferDisplayLayerIdentifier.h"
</span><span class="cx"> #include <WebCore/SampleBufferDisplayLayer.h>
</span><span class="lines">@@ -36,9 +37,9 @@
</span><span class="cx"> 
</span><span class="cx"> class SampleBufferDisplayLayerManager;
</span><span class="cx"> 
</span><del>-class SampleBufferDisplayLayer final : public WebCore::SampleBufferDisplayLayer, public IPC::MessageReceiver {
</del><ins>+class SampleBufferDisplayLayer final : public WebCore::SampleBufferDisplayLayer, public IPC::MessageReceiver, public GPUProcessConnection::Client {
</ins><span class="cx"> public:
</span><del>-    static std::unique_ptr<SampleBufferDisplayLayer> create(SampleBufferDisplayLayerManager&, Client&);
</del><ins>+    static std::unique_ptr<SampleBufferDisplayLayer> create(SampleBufferDisplayLayerManager&, WebCore::SampleBufferDisplayLayer::Client&);
</ins><span class="cx">     ~SampleBufferDisplayLayer();
</span><span class="cx"> 
</span><span class="cx">     SampleBufferDisplayLayerIdentifier identifier() const { return m_identifier; }
</span><span class="lines">@@ -45,8 +46,11 @@
</span><span class="cx"> 
</span><span class="cx">     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
</span><span class="cx"> 
</span><ins>+    using GPUProcessConnection::Client::weakPtrFactory;
+    using WeakValueType = GPUProcessConnection::Client::WeakValueType;
+
</ins><span class="cx"> private:
</span><del>-    SampleBufferDisplayLayer(SampleBufferDisplayLayerManager&, Client&);
</del><ins>+    SampleBufferDisplayLayer(SampleBufferDisplayLayerManager&, WebCore::SampleBufferDisplayLayer::Client&);
</ins><span class="cx"> 
</span><span class="cx">     // WebCore::SampleBufferDisplayLayer
</span><span class="cx">     void initialize(bool hideRootLayer, WebCore::IntSize, CompletionHandler<void(bool)>&&) final;
</span><span class="lines">@@ -65,6 +69,9 @@
</span><span class="cx">     void clearEnqueuedSamples() final;
</span><span class="cx">     PlatformLayer* rootLayer() final;
</span><span class="cx"> 
</span><ins>+    // GPUProcessConnection::Client
+    void gpuProcessConnectionDidClose(GPUProcessConnection&) final;
+
</ins><span class="cx">     void setDidFail(bool);
</span><span class="cx"> 
</span><span class="cx">     WeakPtr<SampleBufferDisplayLayerManager> m_manager;
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUwebrtcSampleBufferDisplayLayerManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp    2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.cpp       2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx">         layer->didReceiveMessage(connection, decoder);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr<WebCore::SampleBufferDisplayLayer> SampleBufferDisplayLayerManager::createLayer(SampleBufferDisplayLayer::Client& client)
</del><ins>+std::unique_ptr<WebCore::SampleBufferDisplayLayer> SampleBufferDisplayLayerManager::createLayer(WebCore::SampleBufferDisplayLayer::Client& client)
</ins><span class="cx"> {
</span><span class="cx">     auto layer = SampleBufferDisplayLayer::create(*this, client);
</span><span class="cx">     if (!layer)
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUwebrtcSampleBufferDisplayLayerManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.h (280730 => 280731)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.h      2021-08-06 19:02:32 UTC (rev 280730)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayerManager.h 2021-08-06 19:04:17 UTC (rev 280731)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx">     void removeLayer(SampleBufferDisplayLayer&);
</span><span class="cx"> 
</span><span class="cx">     void didReceiveLayerMessage(IPC::Connection&, IPC::Decoder&);
</span><del>-    std::unique_ptr<WebCore::SampleBufferDisplayLayer> createLayer(SampleBufferDisplayLayer::Client&);
</del><ins>+    std::unique_ptr<WebCore::SampleBufferDisplayLayer> createLayer(WebCore::SampleBufferDisplayLayer::Client&);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     HashMap<SampleBufferDisplayLayerIdentifier, WeakPtr<SampleBufferDisplayLayer>> m_layers;
</span></span></pre>
</div>
</div>

</body>
</html>