<!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>[287288] trunk/Source/WebKit</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/287288">287288</a></dd>
<dt>Author</dt> <dd>Hironori.Fujii@sony.com</dd>
<dt>Date</dt> <dd>2021-12-20 16:33:43 -0800 (Mon, 20 Dec 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>WC variant RemoteGraphicsContextGL::platformLayer() should be removed
https://bugs.webkit.org/show_bug.cgi?id=233756
<rdar://problem/86261919>

Reviewed by Kimmo Kinnunen.

WinCairo is using TextureMapperGCGLPlatformLayer as the WebGL
PlatformLayer at the moment, that is using only a single output
buffer. And, WinCairo doesn't transfer the WebGL output buffer
cross-process boundary even in GPU process mode. Based on these
assumptions, <a href="http://trac.webkit.org/projects/webkit/changeset/285099">r285099</a> added platformLayer() method to
RemoteGraphicsContextGL to get a PlatformLayer and pass it to the
compositor in GPU process.

However, this is not appropriate. The output buffer identifier
should be transferred to web process by using the completion
handler of RemoteGraphicsContextGL::PrepareForDisplay message.
Then, the identifier will be passed back to GPU process.

Added WCContentBufferManager to manage the WebGL output buffer
identifiers. However, because TextureMapperGCGLPlatformLayer has
only a single output buffer, the maximum number of identifiers is
one for each PlatformLayer now.

* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::didClose):
(WebKit::GPUConnectionToWebProcess::releaseWCLayerTreeHost):
(WebKit::GPUConnectionToWebProcess::findRemoteGraphicsContextGL): Deleted.
* GPUProcess/GPUConnectionToWebProcess.h:
* GPUProcess/graphics/RemoteGraphicsContextGL.h:
* GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
* GPUProcess/graphics/RemoteGraphicsContextGLWin.cpp:
(WebKit::RemoteGraphicsContextGLWin::prepareForDisplay):
(WebKit::RemoteGraphicsContextGL::prepareForDisplay): Deleted.
(WebKit::RemoteGraphicsContextGL::platformLayer const): Deleted.
* GPUProcess/graphics/wc/RemoteWCLayerTreeHost.cpp:
(WebKit::RemoteWCLayerTreeHost::RemoteWCLayerTreeHost):
(WebKit::RemoteWCLayerTreeHost::update):
* GPUProcess/graphics/wc/RemoteWCLayerTreeHost.h:
* GPUProcess/graphics/wc/WCContentBuffer.h: Added.
* GPUProcess/graphics/wc/WCContentBufferManager.cpp: Added.
(WebKit::WCContentBufferManager::ProcessInfo::ProcessInfo):
(WebKit::WCContentBufferManager::ProcessInfo::acquireContentBufferIdentifier):
(WebKit::WCContentBufferManager::ProcessInfo::releaseContentBufferIdentifier):
(WebKit::WCContentBufferManager::ProcessInfo::removeContentBuffer):
(WebKit::WCContentBufferManager::singleton):
(WebKit::WCContentBufferManager::acquireContentBufferIdentifier):
(WebKit::WCContentBufferManager::releaseContentBufferIdentifier):
(WebKit::WCContentBufferManager::removeContentBuffer):
(WebKit::WCContentBufferManager::removeAllContentBuffersForProcess):
* GPUProcess/graphics/wc/WCContentBufferManager.h: Added.
* GPUProcess/graphics/wc/WCScene.cpp:
(WebKit::WCScene::WCScene):
(WebKit::WCScene::update):
* GPUProcess/graphics/wc/WCScene.h:
* PlatformWin.cmake:
* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(conditions_for_header):
* Shared/wc/WCContentBufferIdentifier.h: Added.
* WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp:
* WebProcess/GPU/graphics/wc/WCPlatformLayerGCGL.h:
(WebKit::WCPlatformLayerGCGL::takeContentBufferIdentifiers):
(WebKit::WCPlatformLayerGCGL::addContentBufferIdentifier):
(WebKit::WCPlatformLayerGCGL::WCPlatformLayerGCGL): Deleted.
(WebKit::WCPlatformLayerGCGL::graphicsContextGLIdentifier): Deleted.
* WebProcess/WebPage/wc/GraphicsLayerWC.cpp:
(WebKit::GraphicsLayerWC::setContentsNeedsDisplay):
(WebKit::GraphicsLayerWC::flushCompositingStateForThisLayerOnly):
* WebProcess/WebPage/wc/WCUpateInfo.h:
(WebKit::WCLayerUpateInfo::encode const):
(WebKit::WCLayerUpateInfo::decode):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitGPUProcessGPUConnectionToWebProcesscpp">trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKitGPUProcessGPUConnectionToWebProcessh">trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h</a></li>
<li><a href="#trunkSourceWebKitGPUProcessgraphicsRemoteGraphicsContextGLh">trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h</a></li>
<li><a href="#trunkSourceWebKitGPUProcessgraphicsRemoteGraphicsContextGLmessagesin">trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in</a></li>
<li><a href="#trunkSourceWebKitGPUProcessgraphicsRemoteGraphicsContextGLWincpp">trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLWin.cpp</a></li>
<li><a href="#trunkSourceWebKitGPUProcessgraphicswcRemoteWCLayerTreeHostcpp">trunk/Source/WebKit/GPUProcess/graphics/wc/RemoteWCLayerTreeHost.cpp</a></li>
<li><a href="#trunkSourceWebKitGPUProcessgraphicswcRemoteWCLayerTreeHosth">trunk/Source/WebKit/GPUProcess/graphics/wc/RemoteWCLayerTreeHost.h</a></li>
<li><a href="#trunkSourceWebKitGPUProcessgraphicswcWCScenecpp">trunk/Source/WebKit/GPUProcess/graphics/wc/WCScene.cpp</a></li>
<li><a href="#trunkSourceWebKitGPUProcessgraphicswcWCSceneh">trunk/Source/WebKit/GPUProcess/graphics/wc/WCScene.h</a></li>
<li><a href="#trunkSourceWebKitPlatformWincmake">trunk/Source/WebKit/PlatformWin.cmake</a></li>
<li><a href="#trunkSourceWebKitScriptswebkitmessagespy">trunk/Source/WebKit/Scripts/webkit/messages.py</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUgraphicswcRemoteGraphicsContextGLProxyWCcpp">trunk/Source/WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUgraphicswcWCPlatformLayerGCGLh">trunk/Source/WebKit/WebProcess/GPU/graphics/wc/WCPlatformLayerGCGL.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPagewcGraphicsLayerWCcpp">trunk/Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPagewcWCUpateInfoh">trunk/Source/WebKit/WebProcess/WebPage/wc/WCUpateInfo.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitGPUProcessgraphicswcWCContentBufferh">trunk/Source/WebKit/GPUProcess/graphics/wc/WCContentBuffer.h</a></li>
<li><a href="#trunkSourceWebKitGPUProcessgraphicswcWCContentBufferManagercpp">trunk/Source/WebKit/GPUProcess/graphics/wc/WCContentBufferManager.cpp</a></li>
<li><a href="#trunkSourceWebKitGPUProcessgraphicswcWCContentBufferManagerh">trunk/Source/WebKit/GPUProcess/graphics/wc/WCContentBufferManager.h</a></li>
<li>trunk/Source/WebKit/Shared/wc/</li>
<li><a href="#trunkSourceWebKitSharedwcWCContentBufferIdentifierh">trunk/Source/WebKit/Shared/wc/WCContentBufferIdentifier.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/ChangeLog       2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -1,3 +1,78 @@
</span><ins>+2021-12-20  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        WC variant RemoteGraphicsContextGL::platformLayer() should be removed
+        https://bugs.webkit.org/show_bug.cgi?id=233756
+        <rdar://problem/86261919>
+
+        Reviewed by Kimmo Kinnunen.
+
+        WinCairo is using TextureMapperGCGLPlatformLayer as the WebGL
+        PlatformLayer at the moment, that is using only a single output
+        buffer. And, WinCairo doesn't transfer the WebGL output buffer
+        cross-process boundary even in GPU process mode. Based on these
+        assumptions, r285099 added platformLayer() method to
+        RemoteGraphicsContextGL to get a PlatformLayer and pass it to the
+        compositor in GPU process.
+
+        However, this is not appropriate. The output buffer identifier
+        should be transferred to web process by using the completion
+        handler of RemoteGraphicsContextGL::PrepareForDisplay message.
+        Then, the identifier will be passed back to GPU process.
+
+        Added WCContentBufferManager to manage the WebGL output buffer
+        identifiers. However, because TextureMapperGCGLPlatformLayer has
+        only a single output buffer, the maximum number of identifiers is
+        one for each PlatformLayer now.
+
+        * GPUProcess/GPUConnectionToWebProcess.cpp:
+        (WebKit::GPUConnectionToWebProcess::didClose):
+        (WebKit::GPUConnectionToWebProcess::releaseWCLayerTreeHost):
+        (WebKit::GPUConnectionToWebProcess::findRemoteGraphicsContextGL): Deleted.
+        * GPUProcess/GPUConnectionToWebProcess.h:
+        * GPUProcess/graphics/RemoteGraphicsContextGL.h:
+        * GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
+        * GPUProcess/graphics/RemoteGraphicsContextGLWin.cpp:
+        (WebKit::RemoteGraphicsContextGLWin::prepareForDisplay):
+        (WebKit::RemoteGraphicsContextGL::prepareForDisplay): Deleted.
+        (WebKit::RemoteGraphicsContextGL::platformLayer const): Deleted.
+        * GPUProcess/graphics/wc/RemoteWCLayerTreeHost.cpp:
+        (WebKit::RemoteWCLayerTreeHost::RemoteWCLayerTreeHost):
+        (WebKit::RemoteWCLayerTreeHost::update):
+        * GPUProcess/graphics/wc/RemoteWCLayerTreeHost.h:
+        * GPUProcess/graphics/wc/WCContentBuffer.h: Added.
+        * GPUProcess/graphics/wc/WCContentBufferManager.cpp: Added.
+        (WebKit::WCContentBufferManager::ProcessInfo::ProcessInfo):
+        (WebKit::WCContentBufferManager::ProcessInfo::acquireContentBufferIdentifier):
+        (WebKit::WCContentBufferManager::ProcessInfo::releaseContentBufferIdentifier):
+        (WebKit::WCContentBufferManager::ProcessInfo::removeContentBuffer):
+        (WebKit::WCContentBufferManager::singleton):
+        (WebKit::WCContentBufferManager::acquireContentBufferIdentifier):
+        (WebKit::WCContentBufferManager::releaseContentBufferIdentifier):
+        (WebKit::WCContentBufferManager::removeContentBuffer):
+        (WebKit::WCContentBufferManager::removeAllContentBuffersForProcess):
+        * GPUProcess/graphics/wc/WCContentBufferManager.h: Added.
+        * GPUProcess/graphics/wc/WCScene.cpp:
+        (WebKit::WCScene::WCScene):
+        (WebKit::WCScene::update):
+        * GPUProcess/graphics/wc/WCScene.h:
+        * PlatformWin.cmake:
+        * Scripts/webkit/messages.py:
+        (types_that_cannot_be_forward_declared):
+        (conditions_for_header):
+        * Shared/wc/WCContentBufferIdentifier.h: Added.
+        * WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp:
+        * WebProcess/GPU/graphics/wc/WCPlatformLayerGCGL.h:
+        (WebKit::WCPlatformLayerGCGL::takeContentBufferIdentifiers):
+        (WebKit::WCPlatformLayerGCGL::addContentBufferIdentifier):
+        (WebKit::WCPlatformLayerGCGL::WCPlatformLayerGCGL): Deleted.
+        (WebKit::WCPlatformLayerGCGL::graphicsContextGLIdentifier): Deleted.
+        * WebProcess/WebPage/wc/GraphicsLayerWC.cpp:
+        (WebKit::GraphicsLayerWC::setContentsNeedsDisplay):
+        (WebKit::GraphicsLayerWC::flushCompositingStateForThisLayerOnly):
+        * WebProcess/WebPage/wc/WCUpateInfo.h:
+        (WebKit::WCLayerUpateInfo::encode const):
+        (WebKit::WCLayerUpateInfo::decode):
+
</ins><span class="cx"> 2021-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Add some missing API availability macros around some WebXR SPI
</span></span></pre></div>
<a id="trunkSourceWebKitGPUProcessGPUConnectionToWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp     2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp        2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -146,6 +146,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(GRAPHICS_LAYER_WC)
</span><span class="cx"> #include "RemoteWCLayerTreeHost.h"
</span><ins>+#include "WCContentBufferManager.h"
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -303,6 +304,11 @@
</span><span class="cx">     // RemoteGraphicsContextsGL objects are unneeded after connection closes.
</span><span class="cx">     m_remoteGraphicsContextGLMap.clear();
</span><span class="cx"> #endif
</span><ins>+#if USE(GRAPHICS_LAYER_WC)
+    remoteGraphicsContextGLStreamWorkQueue().dispatch([webProcessIdentifier = m_webProcessIdentifier] {
+        WCContentBufferManager::singleton().removeAllContentBuffersForProcess(webProcessIdentifier);
+    });
+#endif
</ins><span class="cx"> 
</span><span class="cx">     gpuProcess().connectionToWebProcessClosed(connection);
</span><span class="cx">     gpuProcess().removeGPUConnectionToWebProcess(*this); // May destroy |this|.
</span><span class="lines">@@ -359,12 +365,6 @@
</span><span class="cx"> {
</span><span class="cx">     m_remoteWCLayerTreeHostMap.remove(identifier);
</span><span class="cx"> }
</span><del>-
-RefPtr<RemoteGraphicsContextGL> GPUConnectionToWebProcess::findRemoteGraphicsContextGL(GraphicsContextGLIdentifier identifier)
-{
-    ASSERT(RunLoop::isMain());
-    return m_remoteGraphicsContextGLMap.get(identifier);
-}
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> bool GPUConnectionToWebProcess::allowsExitUnderMemoryPressure() const
</span></span></pre></div>
<a id="trunkSourceWebKitGPUProcessGPUConnectionToWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h       2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h  2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -175,10 +175,6 @@
</span><span class="cx">     RemoteImageDecoderAVFProxy& imageDecoderAVFProxy();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if USE(GRAPHICS_LAYER_WC)
-    RefPtr<RemoteGraphicsContextGL> findRemoteGraphicsContextGL(GraphicsContextGLIdentifier);
-#endif
-
</del><span class="cx">     void updateSupportedRemoteCommands();
</span><span class="cx"> 
</span><span class="cx">     bool allowsExitUnderMemoryPressure() const;
</span></span></pre></div>
<a id="trunkSourceWebKitGPUProcessgraphicsRemoteGraphicsContextGLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h        2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h   2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -50,6 +50,10 @@
</span><span class="cx"> #include <CoreGraphics/CGDisplayConfiguration.h>
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if USE(GRAPHICS_LAYER_WC)
+#include "WCContentBufferIdentifier.h"
+#endif
+
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> namespace WTF {
</span><span class="cx"> class MachSendRight;
</span><span class="lines">@@ -73,11 +77,6 @@
</span><span class="cx">     void displayWasReconfigured();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if USE(GRAPHICS_LAYER_WC)
-    // FIXME: This is layering violation and should be removed.
-    PlatformLayer* platformLayer() const;
-#endif
-
</del><span class="cx"> protected:
</span><span class="cx">     RemoteGraphicsContextGL(GPUConnectionToWebProcess&, GraphicsContextGLIdentifier, RemoteRenderingBackend&, IPC::StreamConnectionBuffer&&);
</span><span class="cx">     void initialize(WebCore::GraphicsContextGLAttributes&&);
</span><span class="lines">@@ -100,6 +99,8 @@
</span><span class="cx">     void notifyMarkContextChanged();
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     virtual void prepareForDisplay(CompletionHandler<void(WTF::MachSendRight&&)>&&) = 0;
</span><ins>+#elif USE(GRAPHICS_LAYER_WC)
+    virtual void prepareForDisplay(CompletionHandler<void(std::optional<WCContentBufferIdentifier>)>&&) = 0;
</ins><span class="cx"> #else
</span><span class="cx">     void prepareForDisplay(CompletionHandler<void()>&&);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitGPUProcessgraphicsRemoteGraphicsContextGLmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in      2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in 2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -29,7 +29,10 @@
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     void PrepareForDisplay() -> (MachSendRight displayBuffer) Synchronous NotStreamEncodableReply
</span><span class="cx"> #endif
</span><del>-#if !PLATFORM(COCOA)
</del><ins>+#if USE(GRAPHICS_LAYER_WC)
+    void PrepareForDisplay() -> (std::optional<WebKit::WCContentBufferIdentifier> contentBuffer) Synchronous
+#endif
+#if !PLATFORM(COCOA) && !USE(GRAPHICS_LAYER_WC)
</ins><span class="cx">     void PrepareForDisplay() -> () Synchronous
</span><span class="cx"> #endif
</span><span class="cx">     void EnsureExtensionEnabled(String extension)
</span></span></pre></div>
<a id="trunkSourceWebKitGPUProcessgraphicsRemoteGraphicsContextGLWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLWin.cpp (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLWin.cpp   2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLWin.cpp      2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(GPU_PROCESS) && ENABLE(WEBGL) && PLATFORM(WIN)
</span><span class="cx"> #include "GPUConnectionToWebProcess.h"
</span><ins>+#include "WCContentBufferManager.h"
</ins><span class="cx"> #include <WebCore/GraphicsContextGLTextureMapper.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -40,6 +41,7 @@
</span><span class="cx"> 
</span><span class="cx">     // RemoteGraphicsContextGL overrides.
</span><span class="cx">     void platformWorkQueueInitialize(WebCore::GraphicsContextGLAttributes&&) final;
</span><ins>+    void prepareForDisplay(CompletionHandler<void(std::optional<WCContentBufferIdentifier>)>&&) final;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> Ref<RemoteGraphicsContextGL> RemoteGraphicsContextGL::create(GPUConnectionToWebProcess& gpuConnectionToWebProcess, WebCore::GraphicsContextGLAttributes&& attributes, GraphicsContextGLIdentifier graphicsContextGLIdentifier, RemoteRenderingBackend& renderingBackend, IPC::StreamConnectionBuffer&& stream)
</span><span class="lines">@@ -59,19 +61,13 @@
</span><span class="cx">     m_context = WebCore::GraphicsContextGLTextureMapper::create(WTFMove(attributes));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteGraphicsContextGL::prepareForDisplay(CompletionHandler<void()>&& completionHandler)
</del><ins>+void RemoteGraphicsContextGLWin::prepareForDisplay(CompletionHandler<void(std::optional<WCContentBufferIdentifier>)>&& completionHandler)
</ins><span class="cx"> {
</span><span class="cx">     m_context->prepareForDisplay();
</span><del>-    completionHandler();
</del><ins>+    auto identifier = WCContentBufferManager::singleton().acquireContentBufferIdentifier(m_webProcessIdentifier, m_context->layerContentsDisplayDelegate()->platformLayer());
+    completionHandler(identifier);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if USE(GRAPHICS_LAYER_WC)
-PlatformLayer* RemoteGraphicsContextGL::platformLayer() const
-{
-    return m_context->layerContentsDisplayDelegate()->platformLayer();
</del><span class="cx"> }
</span><del>-#endif
</del><span class="cx"> 
</span><del>-}
-
</del><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitGPUProcessgraphicswcRemoteWCLayerTreeHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/GPUProcess/graphics/wc/RemoteWCLayerTreeHost.cpp (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/GPUProcess/graphics/wc/RemoteWCLayerTreeHost.cpp     2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/GPUProcess/graphics/wc/RemoteWCLayerTreeHost.cpp        2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -46,11 +46,12 @@
</span><span class="cx"> 
</span><span class="cx"> RemoteWCLayerTreeHost::RemoteWCLayerTreeHost(GPUConnectionToWebProcess& connectionToWebProcess, WebKit::WCLayerTreeHostIdentifier identifier, uint64_t nativeWindow)
</span><span class="cx">     : m_connectionToWebProcess(connectionToWebProcess)
</span><ins>+    , m_webProcessIdentifier(connectionToWebProcess.webProcessIdentifier())
</ins><span class="cx">     , m_identifier(identifier)
</span><span class="cx">     , m_sharedSceneContextHolder(connectionToWebProcess.gpuProcess().sharedSceneContext().ensureHolderForWindow(nativeWindow))
</span><span class="cx"> {
</span><span class="cx">     m_connectionToWebProcess->messageReceiverMap().addMessageReceiver(Messages::RemoteWCLayerTreeHost::messageReceiverName(), m_identifier.toUInt64(), *this);
</span><del>-    m_scene = makeUnique<WCScene>();
</del><ins>+    m_scene = makeUnique<WCScene>(m_webProcessIdentifier);
</ins><span class="cx">     remoteGraphicsContextGLStreamWorkQueue().dispatch([scene = m_scene.get(), sceneContextHolder = m_sharedSceneContextHolder.get(), nativeWindow] {
</span><span class="cx">         if (!sceneContextHolder->context)
</span><span class="cx">             sceneContextHolder->context.emplace(nativeWindow);
</span><span class="lines">@@ -82,17 +83,8 @@
</span><span class="cx"> 
</span><span class="cx"> void RemoteWCLayerTreeHost::update(WCUpateInfo&& update)
</span><span class="cx"> {
</span><del>-    // findRemoteGraphicsContextGL should be called on the main thread
-    auto remoteGCGL = WTF::map(update.changedLayers, [this](auto& layerUpdate) -> RefPtr<RemoteGraphicsContextGL> {
-        if (layerUpdate.changes & WCLayerChange::PlatformLayer) {
-            if (layerUpdate.graphicsContextGLIdentifier)
-                return m_connectionToWebProcess->findRemoteGraphicsContextGL(makeObjectIdentifier<GraphicsContextGLIdentifierType>(layerUpdate.graphicsContextGLIdentifier));
-        }
-        return nullptr;
-    });
-
-    remoteGraphicsContextGLStreamWorkQueue().dispatch([this, weakThis = WeakPtr(*this), scene = m_scene.get(), update = WTFMove(update), remoteGCGL = WTFMove(remoteGCGL)]() mutable {
-        scene->update(WTFMove(update), WTFMove(remoteGCGL));
</del><ins>+    remoteGraphicsContextGLStreamWorkQueue().dispatch([this, weakThis = WeakPtr(*this), scene = m_scene.get(), update = WTFMove(update)]() mutable {
+        scene->update(WTFMove(update));
</ins><span class="cx">         RunLoop::main().dispatch([this, weakThis = WTFMove(weakThis)] {
</span><span class="cx">             if (!weakThis)
</span><span class="cx">                 return;
</span></span></pre></div>
<a id="trunkSourceWebKitGPUProcessgraphicswcRemoteWCLayerTreeHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/GPUProcess/graphics/wc/RemoteWCLayerTreeHost.h (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/GPUProcess/graphics/wc/RemoteWCLayerTreeHost.h       2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/GPUProcess/graphics/wc/RemoteWCLayerTreeHost.h  2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "MessageSender.h"
</span><span class="cx"> #include "WCLayerTreeHostIdentifier.h"
</span><span class="cx"> #include "WCSharedSceneContextHolder.h"
</span><ins>+#include <WebCore/ProcessIdentifier.h>
</ins><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> class GPUConnectionToWebProcess;
</span><span class="lines">@@ -55,6 +56,7 @@
</span><span class="cx">     uint64_t messageSenderDestinationID() const override;
</span><span class="cx"> 
</span><span class="cx">     WeakPtr<GPUConnectionToWebProcess> m_connectionToWebProcess;
</span><ins>+    WebCore::ProcessIdentifier m_webProcessIdentifier;
</ins><span class="cx">     WCLayerTreeHostIdentifier m_identifier;
</span><span class="cx">     RefPtr<WCSharedSceneContextHolder::Holder> m_sharedSceneContextHolder;
</span><span class="cx">     std::unique_ptr<WCScene> m_scene;
</span></span></pre></div>
<a id="trunkSourceWebKitGPUProcessgraphicswcWCContentBufferh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/GPUProcess/graphics/wc/WCContentBuffer.h (0 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/GPUProcess/graphics/wc/WCContentBuffer.h                             (rev 0)
+++ trunk/Source/WebKit/GPUProcess/graphics/wc/WCContentBuffer.h        2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -0,0 +1,91 @@
</span><ins>+/*
+ * Copyright (C) 2021 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if USE(GRAPHICS_LAYER_WC)
+
+#include "WCContentBufferIdentifier.h"
+#include "WCContentBufferManager.h"
+#include <WebCore/ProcessIdentifier.h>
+#include <WebCore/TextureMapperPlatformLayer.h>
+
+namespace WebKit {
+
+class WCContentBuffer final : WebCore::TextureMapperPlatformLayer::Client {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    class Client {
+    public:
+        virtual void platformLayerWillBeDestroyed() = 0;
+    };
+    
+    WCContentBuffer(WCContentBufferManager& manager, WebCore::ProcessIdentifier processIdentifier, WebCore::TextureMapperPlatformLayer* platformLayer)
+        : m_manager(manager)
+        , m_processIdentifier(processIdentifier)
+        , m_platformLayer(platformLayer)
+    {
+        m_platformLayer->setClient(this);
+    }
+
+    ~WCContentBuffer()
+    {
+        m_platformLayer->setClient(nullptr);
+    }
+
+    void setClient(Client* client)
+    {
+        m_client = client;
+    }
+
+    WebCore::TextureMapperPlatformLayer* platformLayer() const
+    {
+        return m_platformLayer;
+    }
+
+    WCContentBufferIdentifier identifier()
+    {
+        return m_identifier;
+    }
+
+private:
+    void platformLayerWillBeDestroyed() override
+    {
+        if (m_client)
+            m_client->platformLayerWillBeDestroyed();
+        m_manager.removeContentBuffer(m_processIdentifier, *this);
+    }
+    void setPlatformLayerNeedsDisplay() override { }
+
+    WCContentBufferManager& m_manager;
+    WebCore::ProcessIdentifier m_processIdentifier;
+    WCContentBufferIdentifier m_identifier { WCContentBufferIdentifier::generate() };
+    WebCore::TextureMapperPlatformLayer* m_platformLayer;
+    Client* m_client { nullptr };
+};
+
+} // namespace WebKit
+
+#endif // USE(GRAPHICS_LAYER_WC)
</ins></span></pre></div>
<a id="trunkSourceWebKitGPUProcessgraphicswcWCContentBufferManagercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/GPUProcess/graphics/wc/WCContentBufferManager.cpp (0 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/GPUProcess/graphics/wc/WCContentBufferManager.cpp                            (rev 0)
+++ trunk/Source/WebKit/GPUProcess/graphics/wc/WCContentBufferManager.cpp       2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -0,0 +1,109 @@
</span><ins>+/*
+ * Copyright (C) 2021 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WCContentBufferManager.h"
+
+#if USE(GRAPHICS_LAYER_WC)
+
+#include "WCContentBuffer.h"
+#include <wtf/HashSet.h>
+
+namespace WebKit {
+
+class WCContentBufferManager::ProcessInfo {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    ProcessInfo(WCContentBufferManager& manager, WebCore::ProcessIdentifier processIdentifier)
+        : m_manager(manager)
+        , m_processIdentifier(processIdentifier) { }
+
+    std::optional<WCContentBufferIdentifier> acquireContentBufferIdentifier(WebCore::TextureMapperPlatformLayer* platformLayer)
+    {
+        // FIXME: TextureMapperGCGLPlatformLayer doesn't support double buffering yet.
+        // TextureMapperPlatformLayer can acquire a single WCContentBufferIdentifier.
+        auto contentBufferAddResult = m_contentBuffers.ensure(platformLayer, [&] {
+            return makeUnique<WCContentBuffer>(m_manager, m_processIdentifier, platformLayer);
+        });
+        WCContentBuffer* buffer = contentBufferAddResult.iterator->value.get();
+        auto identifier = buffer->identifier();
+        auto identifierAddResult = m_validIdentifiers.add(identifier, buffer);
+        if (!identifierAddResult.isNewEntry)
+            return std::nullopt;
+        return identifier;
+    }
+
+    WCContentBuffer* releaseContentBufferIdentifier(WCContentBufferIdentifier identifier)
+    {
+        return m_validIdentifiers.take(identifier);
+    }
+
+    void removeContentBuffer(WCContentBuffer& contentBuffer)
+    {
+        m_validIdentifiers.remove(contentBuffer.identifier());
+        m_contentBuffers.remove(contentBuffer.platformLayer());
+    }
+
+private:
+    WCContentBufferManager& m_manager;
+    WebCore::ProcessIdentifier m_processIdentifier;
+    HashMap<WebCore::TextureMapperPlatformLayer*, std::unique_ptr<WCContentBuffer>> m_contentBuffers;
+    HashMap<WCContentBufferIdentifier, WCContentBuffer*> m_validIdentifiers;
+};
+
+WCContentBufferManager& WCContentBufferManager::singleton()
+{
+    static NeverDestroyed<WCContentBufferManager> contentBufferManager;
+    return contentBufferManager;
+}
+
+std::optional<WCContentBufferIdentifier> WCContentBufferManager::acquireContentBufferIdentifier(WebCore::ProcessIdentifier processIdentifier, WebCore::TextureMapperPlatformLayer* platformLayer)
+{
+    auto processAddResult = m_processMap.ensure(processIdentifier, [&] {
+        return makeUnique<ProcessInfo>(*this, processIdentifier);
+    });
+    return processAddResult.iterator->value->acquireContentBufferIdentifier(platformLayer);
+}
+
+WCContentBuffer* WCContentBufferManager::releaseContentBufferIdentifier(WebCore::ProcessIdentifier processIdentifier, WCContentBufferIdentifier contentBufferIdentifier)
+{
+    ASSERT(m_processMap.contains(processIdentifier));
+    return m_processMap.get(processIdentifier)->releaseContentBufferIdentifier(contentBufferIdentifier);
+}
+
+void WCContentBufferManager::removeContentBuffer(WebCore::ProcessIdentifier processIdentifier, WCContentBuffer& contentBuffer)
+{
+    ASSERT(m_processMap.contains(processIdentifier));
+    m_processMap.get(processIdentifier)->removeContentBuffer(contentBuffer);
+}
+
+void WCContentBufferManager::removeAllContentBuffersForProcess(WebCore::ProcessIdentifier processIdentifier)
+{
+    m_processMap.remove(processIdentifier);
+}
+
+} // namespace WebKit
+
+#endif // USE(GRAPHICS_LAYER_WC)
</ins></span></pre></div>
<a id="trunkSourceWebKitGPUProcessgraphicswcWCContentBufferManagerhfromrev287286trunkSourceWebKitGPUProcessgraphicswcWCSceneh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/GPUProcess/graphics/wc/WCContentBufferManager.h (from rev 287286, trunk/Source/WebKit/GPUProcess/graphics/wc/WCScene.h) (0 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/GPUProcess/graphics/wc/WCContentBufferManager.h                              (rev 0)
+++ trunk/Source/WebKit/GPUProcess/graphics/wc/WCContentBufferManager.h 2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+/*
+ * Copyright (C) 2021 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if USE(GRAPHICS_LAYER_WC)
+
+#include "WCContentBufferIdentifier.h"
+#include <WebCore/PlatformLayer.h>
+#include <WebCore/ProcessIdentifier.h>
+#include <wtf/HashMap.h>
+
+namespace WebCore {
+class TextureMapperPlatformLayer;
+}
+
+namespace WebKit {
+
+class WCContentBuffer;
+
+class WCContentBufferManager {
+public:
+    class ProcessInfo;
+
+    static WCContentBufferManager& singleton();
+
+    std::optional<WCContentBufferIdentifier> acquireContentBufferIdentifier(WebCore::ProcessIdentifier, WebCore::TextureMapperPlatformLayer*);
+    WCContentBuffer* releaseContentBufferIdentifier(WebCore::ProcessIdentifier, WCContentBufferIdentifier);
+    void removeContentBuffer(WebCore::ProcessIdentifier, WCContentBuffer&);
+    void removeAllContentBuffersForProcess(WebCore::ProcessIdentifier);
+
+private:
+    HashMap<WebCore::ProcessIdentifier, std::unique_ptr<ProcessInfo>> m_processMap;
+};
+
+} // namespace WebKit
+
+#endif // USE(GRAPHICS_LAYER_WC)
</ins></span></pre></div>
<a id="trunkSourceWebKitGPUProcessgraphicswcWCScenecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/GPUProcess/graphics/wc/WCScene.cpp (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/GPUProcess/graphics/wc/WCScene.cpp   2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/GPUProcess/graphics/wc/WCScene.cpp      2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -29,25 +29,27 @@
</span><span class="cx"> #if USE(GRAPHICS_LAYER_WC)
</span><span class="cx"> 
</span><span class="cx"> #include "RemoteGraphicsContextGL.h"
</span><ins>+#include "WCContentBuffer.h"
+#include "WCContentBufferManager.h"
</ins><span class="cx"> #include "WCSceneContext.h"
</span><span class="cx"> #include "WCUpateInfo.h"
</span><span class="cx"> #include <WebCore/GraphicsContextGLOpenGL.h>
</span><span class="cx"> #include <WebCore/TextureMapperLayer.h>
</span><ins>+#include <WebCore/TextureMapperPlatformLayer.h>
</ins><span class="cx"> #include <WebCore/TextureMapperTiledBackingStore.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-struct WCScene::Layer : public WebCore::TextureMapperPlatformLayer::Client {
</del><ins>+struct WCScene::Layer final : public WCContentBuffer::Client {
</ins><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     Layer() = default;
</span><span class="cx"> 
</span><del>-    // TextureMapperPlatformLayer::Client
</del><ins>+    // WCContentBuffer::Client
</ins><span class="cx">     void platformLayerWillBeDestroyed() override
</span><span class="cx">     {
</span><span class="cx">         texmapLayer.setContentsLayer(nullptr);
</span><span class="cx">     }
</span><del>-    void setPlatformLayerNeedsDisplay() override { }
</del><span class="cx"> 
</span><span class="cx">     WebCore::TextureMapperLayer texmapLayer;
</span><span class="cx">     RefPtr<WebCore::TextureMapperTiledBackingStore> backingStore;
</span><span class="lines">@@ -62,7 +64,10 @@
</span><span class="cx">     m_textureMapper = m_context->createTextureMapper();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WCScene::WCScene() = default;
</del><ins>+WCScene::WCScene(WebCore::ProcessIdentifier webProcessIdentifier)
+    : m_webProcessIdentifier(webProcessIdentifier)
+{
+}
</ins><span class="cx"> 
</span><span class="cx"> WCScene::~WCScene()
</span><span class="cx"> {
</span><span class="lines">@@ -70,7 +75,7 @@
</span><span class="cx">     m_textureMapper = nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WCScene::update(WCUpateInfo&& update, Vector<RefPtr<RemoteGraphicsContextGL>>&& remoteGCGL)
</del><ins>+void WCScene::update(WCUpateInfo&& update)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_context->makeContextCurrent())
</span><span class="cx">         return;
</span><span class="lines">@@ -80,8 +85,6 @@
</span><span class="cx">         m_layers.add(id, WTFMove(layer));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    auto remoteGCGLIterator = remoteGCGL.begin();
-
</del><span class="cx">     for (auto& layerUpdate : update.changedLayers) {
</span><span class="cx">         auto layer = m_layers.get(layerUpdate.id);
</span><span class="cx">         if (layerUpdate.changes & WCLayerChange::Children) {
</span><span class="lines">@@ -165,16 +168,19 @@
</span><span class="cx">             layer->texmapLayer.setBackdropFiltersRect(layerUpdate.backdropFiltersRect);
</span><span class="cx">         }
</span><span class="cx">         if (layerUpdate.changes & WCLayerChange::PlatformLayer) {
</span><del>-            if (*remoteGCGLIterator) {
-                auto platformLayer = (*remoteGCGLIterator)->platformLayer();
-                platformLayer->setClient(layer);
-                layer->texmapLayer.setContentsLayer(platformLayer);
-            } else
</del><ins>+            if (!layerUpdate.hasPlatformLayer)
</ins><span class="cx">                 layer->texmapLayer.setContentsLayer(nullptr);
</span><ins>+            else {
+                WCContentBuffer* contentBuffer = nullptr;
+                for (auto identifier : layerUpdate.contentBufferIdentifiers)
+                    contentBuffer = WCContentBufferManager::singleton().releaseContentBufferIdentifier(m_webProcessIdentifier, identifier);
+                if (contentBuffer) {
+                    contentBuffer->setClient(layer);
+                    layer->texmapLayer.setContentsLayer(contentBuffer->platformLayer());
+                }
+            }
</ins><span class="cx">         }
</span><del>-        remoteGCGLIterator++;
</del><span class="cx">     }
</span><del>-    ASSERT(remoteGCGLIterator == remoteGCGL.end());
</del><span class="cx"> 
</span><span class="cx">     for (auto id : update.removedLayers)
</span><span class="cx">         m_layers.remove(id);
</span></span></pre></div>
<a id="trunkSourceWebKitGPUProcessgraphicswcWCSceneh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/GPUProcess/graphics/wc/WCScene.h (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/GPUProcess/graphics/wc/WCScene.h     2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/GPUProcess/graphics/wc/WCScene.h        2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(GRAPHICS_LAYER_WC)
</span><span class="cx"> 
</span><ins>+#include <WebCore/ProcessIdentifier.h>
</ins><span class="cx"> #include <WebCore/TextureMapperFPSCounter.h>
</span><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="lines">@@ -34,12 +35,12 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> class TextureMapper;
</span><span class="cx"> class TextureMapperLayer;
</span><ins>+class TextureMapperPlatformLayer;
</ins><span class="cx"> class TextureMapperTiledBackingStore;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-class RemoteGraphicsContextGL;
</del><span class="cx"> class WCSceneContext;
</span><span class="cx"> struct WCUpateInfo;
</span><span class="cx"> 
</span><span class="lines">@@ -46,15 +47,16 @@
</span><span class="cx"> class WCScene {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    WCScene();
</del><ins>+    WCScene(WebCore::ProcessIdentifier);
</ins><span class="cx">     ~WCScene();
</span><span class="cx">     void initialize(WCSceneContext&);
</span><del>-    void update(WCUpateInfo&&, Vector<RefPtr<RemoteGraphicsContextGL>>&&);
</del><ins>+    void update(WCUpateInfo&&);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     struct Layer;
</span><span class="cx">     using LayerMap = HashMap<uint64_t, std::unique_ptr<Layer>>;
</span><span class="cx"> 
</span><ins>+    WebCore::ProcessIdentifier m_webProcessIdentifier;
</ins><span class="cx">     WCSceneContext* m_context { nullptr };
</span><span class="cx">     std::unique_ptr<WebCore::TextureMapper> m_textureMapper;
</span><span class="cx">     WebCore::TextureMapperFPSCounter m_fpsCounter;
</span></span></pre></div>
<a id="trunkSourceWebKitPlatformWincmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/PlatformWin.cmake (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/PlatformWin.cmake    2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/PlatformWin.cmake       2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -12,6 +12,7 @@
</span><span class="cx">     GPUProcess/graphics/RemoteGraphicsContextGLWin.cpp
</span><span class="cx"> 
</span><span class="cx">     GPUProcess/graphics/wc/RemoteWCLayerTreeHost.cpp
</span><ins>+    GPUProcess/graphics/wc/WCContentBufferManager.cpp
</ins><span class="cx">     GPUProcess/graphics/wc/WCScene.cpp
</span><span class="cx">     GPUProcess/graphics/wc/WCSceneContext.cpp
</span><span class="cx"> 
</span><span class="lines">@@ -120,6 +121,7 @@
</span><span class="cx">     "${WEBKIT_DIR}/Shared/CoordinatedGraphics"
</span><span class="cx">     "${WEBKIT_DIR}/Shared/CoordinatedGraphics/threadedcompositor"
</span><span class="cx">     "${WEBKIT_DIR}/Shared/Plugins/win"
</span><ins>+    "${WEBKIT_DIR}/Shared/wc"
</ins><span class="cx">     "${WEBKIT_DIR}/Shared/win"
</span><span class="cx">     "${WEBKIT_DIR}/UIProcess/API/C/cairo"
</span><span class="cx">     "${WEBKIT_DIR}/UIProcess/API/C/curl"
</span></span></pre></div>
<a id="trunkSourceWebKitScriptswebkitmessagespy"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Scripts/webkit/messages.py   2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py      2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -362,6 +362,7 @@
</span><span class="cx">         'WebKit::TransactionID',
</span><span class="cx">         'WebKit::UserContentControllerIdentifier',
</span><span class="cx">         'WebKit::WCLayerTreeHostIdentifier',
</span><ins>+        'WebKit::WCContentBufferIdentifier',
</ins><span class="cx">         'WebKit::WebGPUIdentifier',
</span><span class="cx">         'WebKit::WebPageProxyIdentifier',
</span><span class="cx">         'WebKit::WebURLSchemeHandlerIdentifier',
</span><span class="lines">@@ -374,6 +375,7 @@
</span><span class="cx">         '"InputMethodState.h"': ["PLATFORM(GTK)", "PLATFORM(WPE)"],
</span><span class="cx">         '"LayerHostingContext.h"': ["PLATFORM(COCOA)", ],
</span><span class="cx">         '"GestureTypes.h"': ["PLATFORM(IOS_FAMILY)"],
</span><ins>+        '"WCContentBufferIdentifier.h"': ["USE(GRAPHICS_LAYER_WC)"],
</ins><span class="cx">         '"WCLayerTreeHostIdentifier.h"': ["USE(GRAPHICS_LAYER_WC)"],
</span><span class="cx">         '<WebCore/CVUtilities.h>': ["PLATFORM(COCOA)", ],
</span><span class="cx">         '<WebCore/DataDetectorType.h>': ["ENABLE(DATA_DETECTION)"],
</span></span></pre></div>
<a id="trunkSourceWebKitSharedwcWCContentBufferIdentifierhfromrev287286trunkSourceWebKitWebProcessGPUgraphicswcWCPlatformLayerGCGLh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/Shared/wc/WCContentBufferIdentifier.h (from rev 287286, trunk/Source/WebKit/WebProcess/GPU/graphics/wc/WCPlatformLayerGCGL.h) (0 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/wc/WCContentBufferIdentifier.h                                (rev 0)
+++ trunk/Source/WebKit/Shared/wc/WCContentBufferIdentifier.h   2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+/*
+ * Copyright (C) 2021 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if USE(GRAPHICS_LAYER_WC)
+
+#include <wtf/ObjectIdentifier.h>
+
+namespace WebKit {
+
+enum WCContentBufferIdentifierType { };
+using WCContentBufferIdentifier = ObjectIdentifier<WCContentBufferIdentifierType>;
+
+} // namespace WebKit
+
+#endif // USE(GRAPHICS_LAYER_WC)
</ins></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUgraphicswcRemoteGraphicsContextGLProxyWCcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp        2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp   2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx"> private:
</span><span class="cx">     RemoteGraphicsContextGLProxyWC(GPUProcessConnection& gpuProcessConnection, const WebCore::GraphicsContextGLAttributes& attributes, RenderingBackendIdentifier renderingBackend)
</span><span class="cx">         : RemoteGraphicsContextGLProxy(gpuProcessConnection, attributes, renderingBackend)
</span><del>-        , m_layerContentsDisplayDelegate(PlatformLayerDisplayDelegate::create(makeUnique<WCPlatformLayerGCGL>(m_graphicsContextGLIdentifier)))
</del><ins>+        , m_layerContentsDisplayDelegate(PlatformLayerDisplayDelegate::create(makeUnique<WCPlatformLayerGCGL>()))
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -84,11 +84,14 @@
</span><span class="cx"> {
</span><span class="cx">     if (isContextLost())
</span><span class="cx">         return;
</span><del>-    auto sendResult = sendSync(Messages::RemoteGraphicsContextGL::PrepareForDisplay(), Messages::RemoteGraphicsContextGL::PrepareForDisplay::Reply());
</del><ins>+    std::optional<WCContentBufferIdentifier> contentBuffer;
+    auto sendResult = sendSync(Messages::RemoteGraphicsContextGL::PrepareForDisplay(), Messages::RemoteGraphicsContextGL::PrepareForDisplay::Reply(contentBuffer));
</ins><span class="cx">     if (!sendResult) {
</span><span class="cx">         markContextLost();
</span><span class="cx">         return;
</span><span class="cx">     }
</span><ins>+    if (contentBuffer)
+        static_cast<WCPlatformLayerGCGL*>(m_layerContentsDisplayDelegate->platformLayer())->addContentBufferIdentifier(*contentBuffer);
</ins><span class="cx">     markLayerComposited();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUgraphicswcWCPlatformLayerGCGLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/wc/WCPlatformLayerGCGL.h (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/GPU/graphics/wc/WCPlatformLayerGCGL.h     2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/wc/WCPlatformLayerGCGL.h        2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include "GraphicsContextGLIdentifier.h"
</span><ins>+#include "WCContentBufferIdentifier.h"
</ins><span class="cx"> #include <WebCore/WCPlatformLayer.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -32,14 +33,20 @@
</span><span class="cx"> 
</span><span class="cx"> class WCPlatformLayerGCGL : public WebCore::WCPlatformLayer {
</span><span class="cx"> public:
</span><del>-    WCPlatformLayerGCGL(GraphicsContextGLIdentifier identifier)
-        : m_graphicsContextGLIdentifier(identifier)
</del><ins>+    Vector<WCContentBufferIdentifier> takeContentBufferIdentifiers()
</ins><span class="cx">     {
</span><ins>+        return std::exchange(m_contentBufferIdentifiers, { });
</ins><span class="cx">     }
</span><del>-    GraphicsContextGLIdentifier& graphicsContextGLIdentifier() { return m_graphicsContextGLIdentifier; }
</del><span class="cx"> 
</span><ins>+    void addContentBufferIdentifier(WCContentBufferIdentifier contentBuffer)
+    {
+        m_contentBufferIdentifiers.append(contentBuffer);
+        // FIXME: TextureMapperGCGLPlatformLayer doesn't support double buffering yet.
+        ASSERT(m_contentBufferIdentifiers.size() == 1);
+    }
+
</ins><span class="cx"> private:
</span><del>-    GraphicsContextGLIdentifier m_graphicsContextGLIdentifier;
</del><ins>+    Vector<WCContentBufferIdentifier> m_contentBufferIdentifiers;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPagewcGraphicsLayerWCcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.cpp (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.cpp    2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.cpp       2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx"> void GraphicsLayerWC::setContentsNeedsDisplay()
</span><span class="cx"> {
</span><span class="cx">     // For example, if WebGL canvas changed, it needs flush to display.
</span><del>-    noteLayerPropertyChanged({ });
</del><ins>+    noteLayerPropertyChanged(WCLayerChange::PlatformLayer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool GraphicsLayerWC::setChildren(Vector<Ref<GraphicsLayer>>&& children)
</span><span class="lines">@@ -475,10 +475,9 @@
</span><span class="cx">         update.backdropFiltersRect = backdropFiltersRect();
</span><span class="cx">     }
</span><span class="cx">     if (update.changes & WCLayerChange::PlatformLayer) {
</span><ins>+        update.hasPlatformLayer = m_platformLayer;
</ins><span class="cx">         if (m_platformLayer)
</span><del>-            update.graphicsContextGLIdentifier = static_cast<WCPlatformLayerGCGL*>(m_platformLayer)->graphicsContextGLIdentifier().toUInt64();
-        else
-            update.graphicsContextGLIdentifier = 0;
</del><ins>+            update.contentBufferIdentifiers = static_cast<WCPlatformLayerGCGL*>(m_platformLayer)->takeContentBufferIdentifiers();
</ins><span class="cx">     }
</span><span class="cx">     m_observer->commitLayerUpateInfo(WTFMove(update));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPagewcWCUpateInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/wc/WCUpateInfo.h (287287 => 287288)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/wc/WCUpateInfo.h  2021-12-21 00:33:19 UTC (rev 287287)
+++ trunk/Source/WebKit/WebProcess/WebPage/wc/WCUpateInfo.h     2021-12-21 00:33:43 UTC (rev 287288)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include "WCBackingStore.h"
</span><ins>+#include "WCContentBufferIdentifier.h"
</ins><span class="cx"> #include "WebCoreArgumentCoders.h"
</span><span class="cx"> #include <WebCore/GraphicsLayer.h>
</span><span class="cx"> #include <optional>
</span><span class="lines">@@ -74,6 +75,7 @@
</span><span class="cx">     bool contentsVisible;
</span><span class="cx">     bool backfaceVisibility;
</span><span class="cx">     bool preserves3D;
</span><ins>+    bool hasPlatformLayer;
</ins><span class="cx">     WebCore::Color solidColor;
</span><span class="cx">     WebCore::Color backgroundColor;
</span><span class="cx">     WebCore::Color debugBorderColor;
</span><span class="lines">@@ -88,7 +90,7 @@
</span><span class="cx">     WebCore::FilterOperations backdropFilters;
</span><span class="cx">     WebCore::FloatRoundedRect backdropFiltersRect;
</span><span class="cx">     WebCore::FloatRoundedRect contentsClippingRect;
</span><del>-    uint64_t graphicsContextGLIdentifier;
</del><ins>+    Vector<WCContentBufferIdentifier> contentBufferIdentifiers;
</ins><span class="cx"> 
</span><span class="cx">     template<class Encoder>
</span><span class="cx">     void encode(Encoder& encoder) const
</span><span class="lines">@@ -136,7 +138,7 @@
</span><span class="cx">         if (changes & WCLayerChange::BackdropFilters)
</span><span class="cx">             encoder << backdropFilters << backdropFiltersRect;
</span><span class="cx">         if (changes & WCLayerChange::PlatformLayer)
</span><del>-            encoder << graphicsContextGLIdentifier;
</del><ins>+            encoder << hasPlatformLayer << contentBufferIdentifiers;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template <class Decoder>
</span><span class="lines">@@ -241,8 +243,10 @@
</span><span class="cx">                 return false;
</span><span class="cx">         }
</span><span class="cx">         if (result.changes & WCLayerChange::PlatformLayer) {
</span><del>-            if (!decoder.decode(result.graphicsContextGLIdentifier))
</del><ins>+            if (!decoder.decode(result.hasPlatformLayer))
</ins><span class="cx">                 return false;
</span><ins>+            if (!decoder.decode(result.contentBufferIdentifiers))
+                return false;
</ins><span class="cx">         }
</span><span class="cx">         return true;
</span><span class="cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>