Diff
Modified: trunk/LayoutTests/ChangeLog (291398 => 291399)
--- trunk/LayoutTests/ChangeLog 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/LayoutTests/ChangeLog 2022-03-17 10:07:16 UTC (rev 291399)
@@ -1,3 +1,23 @@
+2022-03-17 Kimmo Kinnunen <[email protected]>
+
+ WebGL context lost event is not sent again for contexts that are lost and restored
+ https://bugs.webkit.org/show_bug.cgi?id=237952
+
+ Reviewed by Antti Koivisto.
+
+ * platform/glib/TestExpectations:
+ * webgl/lose-context-after-context-lost-expected.txt:
+ * webgl/lose-context-after-context-lost.html:
+ Enable the test for GPUP, it works now after
+ r290816 "WebGL context count is not limited for GPU process.".
+ Adjust the order of waiting for webglcontextlost and checking
+ isContextLost(), so that it works when context loss is reported
+ asynchronously by GPUP.
+
+ * webgl/multiple-context-losses-expected.txt: Added.
+ * webgl/multiple-context-losses.html: Added.
+ Add a test testing the bug fix.
+
2022-03-17 Ziran Sun <[email protected]>
[Selection] Fixes selection range settings for TEXTAREA
Modified: trunk/LayoutTests/platform/glib/TestExpectations (291398 => 291399)
--- trunk/LayoutTests/platform/glib/TestExpectations 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/LayoutTests/platform/glib/TestExpectations 2022-03-17 10:07:16 UTC (rev 291399)
@@ -1383,6 +1383,7 @@
webkit.org/b/172812 fast/canvas/webgl/lose-context-on-status-failure.html [ Skip ]
webkit.org/b/172812 webgl/lose-context-after-context-lost.html [ Failure ]
+webkit.org/b/172812 webgl/multiple-context-losses.html [ Failure ]
webkit.org/b/223624 webgl/conformance/extensions/khr-parallel-shader-compile.html [ Skip ]
Modified: trunk/LayoutTests/webgl/lose-context-after-context-lost-expected.txt (291398 => 291399)
--- trunk/LayoutTests/webgl/lose-context-after-context-lost-expected.txt 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/LayoutTests/webgl/lose-context-after-context-lost-expected.txt 2022-03-17 10:07:16 UTC (rev 291399)
@@ -5,40 +5,40 @@
TEST COMPLETE: 29 PASS, 2 FAIL
Running test: loseMethod: loseContext, testedMethod: loseContext
+PASS Got webglcontextlost.
PASS gl.isContextLost() is true
PASS gl.getError() is gl.CONTEXT_LOST_WEBGL
PASS gl.getError() is gl.NO_ERROR
-PASS Got webglcontextlost.
PASS Did not crash on tested method loseContext.
Running test: loseMethod: loseContext, testedMethod: restoreContext
+PASS Got webglcontextlost.
PASS gl.isContextLost() is true
PASS gl.getError() is gl.CONTEXT_LOST_WEBGL
PASS gl.getError() is gl.NO_ERROR
-PASS Got webglcontextlost.
PASS Did not crash on tested method restoreContext.
Running test: loseMethod: manyContexts, testedMethod: loseContext
+PASS Got webglcontextlost.
PASS gl.isContextLost() is true
FAIL gl.getError() should be 37442. Was 0.
PASS gl.getError() is gl.NO_ERROR
-PASS Got webglcontextlost.
PASS Did not crash on tested method loseContext.
Running test: loseMethod: manyContexts, testedMethod: restoreContext
+PASS Got webglcontextlost.
PASS gl.isContextLost() is true
FAIL gl.getError() should be 37442. Was 0.
PASS gl.getError() is gl.NO_ERROR
-PASS Got webglcontextlost.
PASS Did not crash on tested method restoreContext.
Running test: loseMethod: gpuStatusFailure, testedMethod: loseContext
+PASS Got webglcontextlost.
PASS gl.isContextLost() is true
PASS gl.getError() is gl.CONTEXT_LOST_WEBGL
PASS gl.getError() is gl.NO_ERROR
-PASS Got webglcontextlost.
PASS Did not crash on tested method loseContext.
Running test: loseMethod: gpuStatusFailure, testedMethod: restoreContext
+PASS Got webglcontextlost.
PASS gl.isContextLost() is true
PASS gl.getError() is gl.CONTEXT_LOST_WEBGL
PASS gl.getError() is gl.NO_ERROR
-PASS Got webglcontextlost.
PASS Did not crash on tested method restoreContext.
PASS successfullyParsed is true
Modified: trunk/LayoutTests/webgl/lose-context-after-context-lost.html (291398 => 291399)
--- trunk/LayoutTests/webgl/lose-context-after-context-lost.html 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/LayoutTests/webgl/lose-context-after-context-lost.html 2022-03-17 10:07:16 UTC (rev 291399)
@@ -1,5 +1,4 @@
-<!DOCTYPE html><!-- webkit-test-runner [ UseGPUProcessForWebGLEnabled=false ] -->
-<!-- Should be removed when https://bugs.webkit.org/show_bug.cgi?id=236964 is fixed. -->
+<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
@@ -56,9 +55,6 @@
document.createElement("canvas").getContext("webgl");
}
- shouldBeTrue("gl.isContextLost()");
- shouldBe("gl.getError()", "gl.CONTEXT_LOST_WEBGL");
- shouldBe("gl.getError()", "gl.NO_ERROR");
try {
await webglcontextlost;
testPassed("Got webglcontextlost.");
@@ -65,6 +61,9 @@
} catch (e) {
testFailed("Timed out waiting webglcontextlost.");
}
+ shouldBeTrue("gl.isContextLost()");
+ shouldBe("gl.getError()", "gl.CONTEXT_LOST_WEBGL");
+ shouldBe("gl.getError()", "gl.NO_ERROR");
if (subcase.testedMethod == "loseContext")
WEBGL_lose_context.loseContext();
Added: trunk/LayoutTests/webgl/multiple-context-losses-expected.txt (0 => 291399)
--- trunk/LayoutTests/webgl/multiple-context-losses-expected.txt (rev 0)
+++ trunk/LayoutTests/webgl/multiple-context-losses-expected.txt 2022-03-17 10:07:16 UTC (rev 291399)
@@ -0,0 +1,59 @@
+Test that a context can be lost multiple times.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+TEST COMPLETE: 50 PASS, 0 FAIL
+
+PASS Got webglcontextlost iteration:0
+PASS gl.isContextLost() is true
+PASS gl.getError() is gl.CONTEXT_LOST_WEBGL
+PASS gl.getError() is gl.NO_ERROR
+PASS Got webglcontextrestored iteration:0
+PASS gl.isContextLost() is false
+PASS gl.getError() is gl.NO_ERROR
+PASS Got webglcontextlost iteration:1
+PASS gl.isContextLost() is true
+PASS gl.getError() is gl.CONTEXT_LOST_WEBGL
+PASS gl.getError() is gl.NO_ERROR
+PASS Got webglcontextrestored iteration:1
+PASS gl.isContextLost() is false
+PASS gl.getError() is gl.NO_ERROR
+PASS Got webglcontextlost iteration:2
+PASS gl.isContextLost() is true
+PASS gl.getError() is gl.CONTEXT_LOST_WEBGL
+PASS gl.getError() is gl.NO_ERROR
+PASS Got webglcontextrestored iteration:2
+PASS gl.isContextLost() is false
+PASS gl.getError() is gl.NO_ERROR
+PASS Got webglcontextlost iteration:3
+PASS gl.isContextLost() is true
+PASS gl.getError() is gl.CONTEXT_LOST_WEBGL
+PASS gl.getError() is gl.NO_ERROR
+PASS Got webglcontextrestored iteration:3
+PASS gl.isContextLost() is false
+PASS gl.getError() is gl.NO_ERROR
+PASS Got webglcontextlost iteration:4
+PASS gl.isContextLost() is true
+PASS gl.getError() is gl.CONTEXT_LOST_WEBGL
+PASS gl.getError() is gl.NO_ERROR
+PASS Got webglcontextrestored iteration:4
+PASS gl.isContextLost() is false
+PASS gl.getError() is gl.NO_ERROR
+PASS Got webglcontextlost iteration:5
+PASS gl.isContextLost() is true
+PASS gl.getError() is gl.CONTEXT_LOST_WEBGL
+PASS gl.getError() is gl.NO_ERROR
+PASS Got webglcontextrestored iteration:5
+PASS gl.isContextLost() is false
+PASS gl.getError() is gl.NO_ERROR
+PASS Got webglcontextlost iteration:6
+PASS gl.isContextLost() is true
+PASS gl.getError() is gl.CONTEXT_LOST_WEBGL
+PASS gl.getError() is gl.NO_ERROR
+PASS Got webglcontextrestored iteration:6
+PASS gl.isContextLost() is false
+PASS gl.getError() is gl.NO_ERROR
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/webgl/multiple-context-losses.html (0 => 291399)
--- trunk/LayoutTests/webgl/multiple-context-losses.html (rev 0)
+++ trunk/LayoutTests/webgl/multiple-context-losses.html 2022-03-17 10:07:16 UTC (rev 291399)
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+</head>
+<body _onload_="test()">
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+description("Test that a context can be lost multiple times.");
+
+var wtu = WebGLTestUtils;
+var gl;
+
+async function waitForWebGLContextLostAndRestore(canvas)
+{
+ return new Promise((resolve, reject) => {
+ const rejectID = setTimeout(reject, 2000);
+ function handleContextLoss(event) {
+ console.log("got here 1");
+ clearTimeout(rejectID);
+ event.preventDefault();
+ console.log("got here 2");
+
+ resolve();
+ }
+ canvas.addEventListener("webglcontextlost", handleContextLoss, { once: true });
+ });
+}
+
+async function waitForWebGLContextRestored(canvas)
+{
+ return new Promise((resolve, reject) => {
+ setTimeout(reject, 2000);
+ canvas.addEventListener("webglcontextrestored", resolve, { once: true });
+ });
+}
+
+async function runTest()
+{
+ if (!window.internals) {
+ testFailed("Needs internals.");
+ return;
+ }
+ const canvas = document.createElement("canvas");
+ canvas.width = 1;
+ canvas.height = 1;
+ gl = wtu.create3DContext(canvas);
+
+ for (let i = 0; i < 7; ++i) {
+ const webglcontextlostandrestore = waitForWebGLContextLostAndRestore(canvas);
+ const webglcontextrestored = waitForWebGLContextRestored(canvas);
+
+ internals.simulateEventForWebGLContext("GPUStatusFailure", gl);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+
+ try {
+ await webglcontextlostandrestore;
+ testPassed(`Got webglcontextlost iteration:${i}`);
+ } catch (e) {
+ testFailed(`Timed out waiting webglcontextlost iteration:${i}` + e);
+ return;
+ }
+ shouldBeTrue("gl.isContextLost()");
+ shouldBe("gl.getError()", "gl.CONTEXT_LOST_WEBGL");
+ shouldBe("gl.getError()", "gl.NO_ERROR");
+ try {
+ await webglcontextrestored;
+ testPassed(`Got webglcontextrestored iteration:${i}`);
+ } catch (e) {
+ testFailed(`Timed out waiting webglcontextrestored iteration:${i}`);
+ return;
+ }
+ shouldBeFalse("gl.isContextLost()");
+ shouldBe("gl.getError()", "gl.NO_ERROR");
+ }
+}
+
+async function test()
+{
+ await runTest();
+ finishTest();
+}
+
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (291398 => 291399)
--- trunk/Source/WebCore/ChangeLog 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/Source/WebCore/ChangeLog 2022-03-17 10:07:16 UTC (rev 291399)
@@ -1,3 +1,37 @@
+2022-03-17 Kimmo Kinnunen <[email protected]>
+
+ WebGL context lost event is not sent again for contexts that are lost and restored
+ https://bugs.webkit.org/show_bug.cgi?id=237952
+
+ Reviewed by Antti Koivisto.
+
+ WebGLRenderingContextBase did not register the GraphicsContextGL::Client
+ for new contexts after a context lost.
+ Move the client registration to WebGLRenderingContextBase::setGraphicsContextGL()
+ which is called always when setting a new context.
+ Rename the GraphicsContextGL::addClient as GraphicsContextGL::setClient(),
+ move the shared implementation to the base class GraphicsContextGL.
+ Remove GraphicsContextGL::Client::recycleContext(), the use was removed in
+ r290816 "WebGL context count is not limited for GPU process.".
+
+ Test: webgl/multiple-context-losses.html
+
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
+ (WebCore::WebGLRenderingContextBase::setGraphicsContextGL):
+ (WebCore::WebGLRenderingContextBase::destroyGraphicsContextGL):
+ * html/canvas/WebGLRenderingContextBase.h:
+ * platform/graphics/GraphicsContextGL.cpp:
+ (WebCore::GraphicsContextGL::markLayerComposited):
+ (WebCore::GraphicsContextGL::forceContextLost):
+ (WebCore::GraphicsContextGL::dispatchContextChangedNotification):
+ * platform/graphics/GraphicsContextGL.h:
+ (WebCore::GraphicsContextGL::setClient):
+ * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+ * platform/graphics/angle/GraphicsContextGLANGLE.h:
+ * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
+ * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+
2022-03-17 Antti Koivisto <[email protected]>
Pass style builder context to CSSToLengthConversionData
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (291398 => 291399)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2022-03-17 10:07:16 UTC (rev 291399)
@@ -981,8 +981,6 @@
m_contextGroup = WebGLContextGroup::create();
m_contextGroup->addContext(*this);
- m_context->addClient(*this);
-
m_context->getIntegerv(GraphicsContextGL::MAX_VIEWPORT_DIMS, m_maxViewportDims);
setupFlags();
@@ -1256,7 +1254,12 @@
void WebGLRenderingContextBase::setGraphicsContextGL(Ref<GraphicsContextGL>&& context)
{
bool wasActive = m_context;
+ if (m_context) {
+ m_context->setClient(nullptr);
+ m_context = nullptr;
+ }
m_context = WTFMove(context);
+ m_context->setClient(this);
updateActiveOrdinal();
if (!wasActive)
addActiveContext(*this);
@@ -1270,7 +1273,7 @@
removeActivityStateChangeObserver();
if (m_context) {
- m_context->removeClient(*this);
+ m_context->setClient(nullptr);
m_context = nullptr;
removeActiveContext(*this);
}
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (291398 => 291399)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h 2022-03-17 10:07:16 UTC (rev 291399)
@@ -412,9 +412,10 @@
// GraphicsContextGL::Client
void didComposite() override;
void forceContextLost() override;
- void recycleContext() override;
void dispatchContextChangedNotification() override;
+ void recycleContext();
+
virtual void addMembersToOpaqueRoots(JSC::AbstractSlotVisitor&);
// This lock must be held across all mutations of containers like
// Vectors, HashSets, etc. which contain RefPtr<WebGLObject>, and
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp (291398 => 291399)
--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp 2022-03-17 10:07:16 UTC (rev 291399)
@@ -633,10 +633,23 @@
if (attrs.stencil)
m_buffersToAutoClear |= GraphicsContextGL::STENCIL_BUFFER_BIT;
}
- for (auto* client : copyToVector(m_clients))
- client->didComposite();
+ if (m_client)
+ m_client->didComposite();
}
+
+void GraphicsContextGL::forceContextLost()
+{
+ if (m_client)
+ m_client->forceContextLost();
+}
+
+void GraphicsContextGL::dispatchContextChangedNotification()
+{
+ if (m_client)
+ m_client->dispatchContextChangedNotification();
+}
+
} // namespace WebCore
#endif // ENABLE(WEBGL)
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h (291398 => 291399)
--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h 2022-03-17 10:07:16 UTC (rev 291399)
@@ -1035,7 +1035,6 @@
WEBCORE_EXPORT virtual ~Client();
virtual void didComposite() = 0;
virtual void forceContextLost() = 0;
- virtual void recycleContext() = 0;
virtual void dispatchContextChangedNotification() = 0;
};
@@ -1048,8 +1047,7 @@
WEBCORE_EXPORT GraphicsContextGL(GraphicsContextGLAttributes);
WEBCORE_EXPORT virtual ~GraphicsContextGL();
- void addClient(Client& client) { m_clients.add(&client); }
- void removeClient(Client& client) { m_clients.remove(&client); }
+ void setClient(Client* client) { m_client = client; }
// ========== WebGL 1 entry points.
virtual void activeTexture(GCGLenum texture) = 0;
@@ -1507,9 +1505,12 @@
WEBCORE_EXPORT static void paintToCanvas(const GraphicsContextGLAttributes&, PixelBuffer&&, const IntSize& canvasSize, GraphicsContext&);
protected:
+ WEBCORE_EXPORT void forceContextLost();
+ WEBCORE_EXPORT void dispatchContextChangedNotification();
+
int m_currentWidth { 0 };
int m_currentHeight { 0 };
- HashSet<Client*> m_clients;
+ Client* m_client { nullptr };
// A bitmask of GL buffer bits (GL_COLOR_BUFFER_BIT,
// GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT) which need to be
// auto-cleared.
Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (291398 => 291399)
--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2022-03-17 10:07:16 UTC (rev 291399)
@@ -2192,24 +2192,6 @@
m_syntheticErrors.add(error);
}
-void GraphicsContextGLANGLE::forceContextLost()
-{
- for (auto* client : copyToVector(m_clients))
- client->forceContextLost();
-}
-
-void GraphicsContextGLANGLE::recycleContext()
-{
- for (auto* client : copyToVector(m_clients))
- client->recycleContext();
-}
-
-void GraphicsContextGLANGLE::dispatchContextChangedNotification()
-{
- for (auto* client : copyToVector(m_clients))
- client->dispatchContextChangedNotification();
-}
-
void GraphicsContextGLANGLE::drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount)
{
if (!makeContextCurrent())
Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h (291398 => 291399)
--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h 2022-03-17 10:07:16 UTC (rev 291399)
@@ -352,9 +352,6 @@
std::optional<PixelBuffer> paintRenderingResultsToPixelBuffer() final;
void paintCompositedResultsToCanvas(ImageBuffer&) final;
- void forceContextLost();
- void recycleContext();
- void dispatchContextChangedNotification();
std::optional<PixelBuffer> readRenderingResultsForPainting();
std::optional<PixelBuffer> readCompositedResultsForPainting();
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp (291398 => 291399)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp 2022-03-17 10:07:16 UTC (rev 291399)
@@ -2337,24 +2337,6 @@
m_syntheticErrors.add(error);
}
-void GraphicsContextGLOpenGL::forceContextLost()
-{
- for (auto* client : copyToVector(m_clients))
- client->forceContextLost();
-}
-
-void GraphicsContextGLOpenGL::recycleContext()
-{
- for (auto* client : copyToVector(m_clients))
- client->recycleContext();
-}
-
-void GraphicsContextGLOpenGL::dispatchContextChangedNotification()
-{
- for (auto* client : copyToVector(m_clients))
- client->dispatchContextChangedNotification();
-}
-
void GraphicsContextGLOpenGL::texImage2DDirect(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLenum format, GCGLenum type, const void* pixels)
{
if (!makeContextCurrent())
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h (291398 => 291399)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h 2022-03-17 10:07:16 UTC (rev 291399)
@@ -377,11 +377,6 @@
String getTranslatedShaderSourceANGLE(PlatformGLObject) final;
// Helper methods.
- void forceContextLost();
- void recycleContext();
-
- void dispatchContextChangedNotification();
-
void paintRenderingResultsToCanvas(ImageBuffer&) final;
std::optional<PixelBuffer> paintRenderingResultsToPixelBuffer() final;
void paintCompositedResultsToCanvas(ImageBuffer&) final;
Modified: trunk/Source/WebKit/ChangeLog (291398 => 291399)
--- trunk/Source/WebKit/ChangeLog 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/Source/WebKit/ChangeLog 2022-03-17 10:07:16 UTC (rev 291399)
@@ -1,3 +1,21 @@
+2022-03-17 Kimmo Kinnunen <[email protected]>
+
+ WebGL context lost event is not sent again for contexts that are lost and restored
+ https://bugs.webkit.org/show_bug.cgi?id=237952
+
+ Reviewed by Antti Koivisto.
+
+ Adjust after GraphicsContextGL::addClient() was renamed setClient().
+
+ * GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
+ (WebKit::RemoteGraphicsContextGL::workQueueInitialize):
+ (WebKit::RemoteGraphicsContextGL::workQueueUninitialize):
+ * GPUProcess/graphics/RemoteGraphicsContextGL.h:
+ * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
+ (WebKit::RemoteGraphicsContextGLProxy::wasLost):
+ (WebKit::RemoteGraphicsContextGLProxy::wasChanged):
+ (WebKit::RemoteGraphicsContextGLProxy::markContextLost):
+
2022-03-16 Antoine Quint <[email protected]>
[model] -[ASVInlinePreview setRemoteContext:] should be called inside the -[ASVInlinePreview setupRemoteConnectionWithCompletionHandler:] callback
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp (291398 => 291399)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp 2022-03-17 10:07:16 UTC (rev 291399)
@@ -118,7 +118,7 @@
assertIsCurrent(workQueue());
platformWorkQueueInitialize(WTFMove(attributes));
if (m_context) {
- m_context->addClient(*this);
+ m_context->setClient(this);
String extensions = m_context->getString(GraphicsContextGL::EXTENSIONS);
String requestableExtensions = m_context->getString(GraphicsContextGL::REQUESTABLE_EXTENSIONS_ANGLE);
send(Messages::RemoteGraphicsContextGLProxy::WasCreated(true, remoteGraphicsContextGLStreamWorkQueue().wakeUpSemaphore(), extensions, requestableExtensions));
@@ -129,6 +129,7 @@
void RemoteGraphicsContextGL::workQueueUninitialize()
{
assertIsCurrent(workQueue());
+ m_context->setClient(nullptr);
m_context = nullptr;
m_streamConnection = nullptr;
}
@@ -144,11 +145,6 @@
send(Messages::RemoteGraphicsContextGLProxy::WasLost());
}
-void RemoteGraphicsContextGL::recycleContext()
-{
- ASSERT_NOT_REACHED();
-}
-
void RemoteGraphicsContextGL::dispatchContextChangedNotification()
{
assertIsCurrent(workQueue());
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h (291398 => 291399)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h 2022-03-17 10:07:16 UTC (rev 291399)
@@ -101,7 +101,6 @@
// GraphicsContextGL::Client overrides.
void didComposite() final;
void forceContextLost() final;
- void recycleContext() final;
void dispatchContextChangedNotification() final;
// Messages to be received.
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp (291398 => 291399)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp 2022-03-17 09:41:08 UTC (rev 291398)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp 2022-03-17 10:07:16 UTC (rev 291399)
@@ -279,6 +279,7 @@
if (isContextLost())
return;
markContextLost();
+
}
void RemoteGraphicsContextGLProxy::wasChanged()
@@ -285,15 +286,13 @@
{
if (isContextLost())
return;
- for (auto* client : copyToVector(m_clients))
- client->dispatchContextChangedNotification();
+ dispatchContextChangedNotification();
}
void RemoteGraphicsContextGLProxy::markContextLost()
{
disconnectGpuProcessIfNeeded();
- for (auto* client : copyToVector(m_clients))
- client->forceContextLost();
+ forceContextLost();
}
bool RemoteGraphicsContextGLProxy::handleMessageToRemovedDestination(IPC::Connection&, IPC::Decoder& decoder)