Title: [273877] trunk
Revision
273877
Author
commit-qu...@webkit.org
Date
2021-03-04 01:00:18 -0800 (Thu, 04 Mar 2021)

Log Message

Adding new test conditions for WebGL should be simpler
https://bugs.webkit.org/show_bug.cgi?id=222593

Patch by Kimmo Kinnunen <kkinnu...@apple.com> on 2021-03-04
Reviewed by Kenneth Russell.

Source/WebCore:

Replace Internals functions:
    Internals.setFailNextGPUStatusCheck()
    Internals.simulateContextChanged()
with
    Internals.simulateEventForWebGLContext(SimulatedWebGLContextEvent, WebGLRenderingContext)

Most envisioned test simulation environment triggers do not need parameters. It is simpler
to implement the triggers from one call site.

No new tests, a refactor.

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::simulateEventForTesting):
* html/canvas/WebGLRenderingContextBase.h:
* platform/graphics/GraphicsContextGL.h:
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::simulateEventForTesting):
* platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
(WebCore::GraphicsContextGLOpenGL::simulateEventForTesting):
* platform/graphics/opengl/GraphicsContextGLOpenGL.h:
* testing/Internals.h:
* testing/Internals.idl:

Implement the feature by replacing
    Internals.setFailNextGPUStatusCheck()
    Internals.simulateContextChanged()
with
    Internals.simulateEventForWebGLContext(SimulatedWebGLContextEvent, WebGLRenderingContext)
with eventName taking invented events that can happen to a
webgl context:
 "GPUStatusFailure" and "ContextChange".

Future commits will add at least "Timeout".

The Internals function name was chosen not to contain "ForTesting" suffix, as
all the functions in the class should have that suffix.
The function names in the implementation path for the feature contains
"ForTesting" in order to highlight the feature not being in the normal
path.

Source/WebKit:

Replace simulateContextChanged and
setFailNextGPUStatusCheck with simulateEventForTesting.

* GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::simulateEventForTesting):
* GPUProcess/graphics/RemoteGraphicsContextGL.h:
* GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
* GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::simulateEventForTesting):
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp:

Tools:

Add SimulateEventForTesting(String eventName) to manually
implemented RemoteGraphicsContextGL functions.
Use manually generated function because next commit for
timeout implementation will add some logic to RemoteGraphicsContextGL
while forwarding rest of the events to the underlying GraphicsContextGL.

* Scripts/generate-gpup-webgl:

LayoutTests:

* fast/canvas/webgl/webglcontextchangedevent.html:
Replace internals.simulateContextChanged(context) with
internals.simulateEventForWebGLContext("ContextChange", context)

* fast/canvas/webgl/lose-context-on-status-failure.html:
Similarly replace internals.setFailNextGPUStatusCheck(context) with
internals.simulateEventForWebGLContext("GPUStatusFailure", context).

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (273876 => 273877)


--- trunk/LayoutTests/ChangeLog	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/LayoutTests/ChangeLog	2021-03-04 09:00:18 UTC (rev 273877)
@@ -1,3 +1,18 @@
+2021-03-04  Kimmo Kinnunen  <kkinnu...@apple.com>
+
+        Adding new test conditions for WebGL should be simpler
+        https://bugs.webkit.org/show_bug.cgi?id=222593
+
+        Reviewed by Kenneth Russell.
+
+        * fast/canvas/webgl/webglcontextchangedevent.html:
+        Replace internals.simulateContextChanged(context) with
+        internals.simulateEventForWebGLContext("ContextChange", context)
+
+        * fast/canvas/webgl/lose-context-on-status-failure.html:
+        Similarly replace internals.setFailNextGPUStatusCheck(context) with
+        internals.simulateEventForWebGLContext("GPUStatusFailure", context).
+
 2021-03-04  Sergio Villar Senin  <svil...@igalia.com>
 
         ASSERTION FAILED: contentSize >= 0 in WefbCore::RenderFlexibleBox::adjustChildSizeForMinAndMax

Modified: trunk/LayoutTests/fast/canvas/webgl/lose-context-on-status-failure.html (273876 => 273877)


--- trunk/LayoutTests/fast/canvas/webgl/lose-context-on-status-failure.html	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/LayoutTests/fast/canvas/webgl/lose-context-on-status-failure.html	2021-03-04 09:00:18 UTC (rev 273877)
@@ -69,7 +69,7 @@
 
     debug("Now force failure after the next drawArrays.")
     if (window.internals)
-        window.internals.failNextGPUStatusCheck(gl);
+        window.internals.simulateEventForWebGLContext("GPUStatusFailure", gl);
     gl.drawArrays(gl.TRIANGLES, 0, 6);
     await webGLContextLost(canvas);
     shouldBeTrue("gl.isContextLost()");
@@ -101,7 +101,7 @@
 
     debug("Now force failure after the next drawElements.")
     if (window.internals)
-        window.internals.failNextGPUStatusCheck(gl);
+        window.internals.simulateEventForWebGLContext("GPUStatusFailure", gl);
     gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0);
     await webGLContextLost(canvas)
     shouldBeTrue("gl.isContextLost()");
@@ -128,7 +128,7 @@
 
     debug("Now force failure after the next drawArraysInstancedANGLE.")
     if (window.internals)
-        window.internals.failNextGPUStatusCheck(gl);
+        window.internals.simulateEventForWebGLContext("GPUStatusFailure", gl);
     ext.drawArraysInstancedANGLE(gl.TRIANGLES, 0, 6, 10);
     await webGLContextLost(canvas);
     shouldBeTrue("gl.isContextLost()");
@@ -161,7 +161,7 @@
 
     debug("Now force failure after the next drawElementsInstancedANGLE.")
     if (window.internals)
-        window.internals.failNextGPUStatusCheck(gl);
+        window.internals.simulateEventForWebGLContext("GPUStatusFailure", gl);
     ext.drawElementsInstancedANGLE(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0, 8);
     await webGLContextLost(canvas);
     shouldBeTrue("gl.isContextLost()");

Modified: trunk/LayoutTests/fast/canvas/webgl/webglcontextchangedevent.html (273876 => 273877)


--- trunk/LayoutTests/fast/canvas/webgl/webglcontextchangedevent.html	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/LayoutTests/fast/canvas/webgl/webglcontextchangedevent.html	2021-03-04 09:00:18 UTC (rev 273877)
@@ -38,7 +38,7 @@
     });
 
     let gl = document.querySelector("canvas").getContext("webgl");
-    window.internals.simulateWebGLContextChanged(gl);
+    window.internals.simulateEventForWebGLContext("ContextChange", gl);
 }
 
 

Modified: trunk/Source/WebCore/ChangeLog (273876 => 273877)


--- trunk/Source/WebCore/ChangeLog	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebCore/ChangeLog	2021-03-04 09:00:18 UTC (rev 273877)
@@ -1,3 +1,50 @@
+2021-03-04  Kimmo Kinnunen  <kkinnu...@apple.com>
+
+        Adding new test conditions for WebGL should be simpler
+        https://bugs.webkit.org/show_bug.cgi?id=222593
+
+        Reviewed by Kenneth Russell.
+
+        Replace Internals functions:
+            Internals.setFailNextGPUStatusCheck()
+            Internals.simulateContextChanged()
+        with
+            Internals.simulateEventForWebGLContext(SimulatedWebGLContextEvent, WebGLRenderingContext)
+
+        Most envisioned test simulation environment triggers do not need parameters. It is simpler
+        to implement the triggers from one call site.
+
+        No new tests, a refactor.
+
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::simulateEventForTesting):
+        * html/canvas/WebGLRenderingContextBase.h:
+        * platform/graphics/GraphicsContextGL.h:
+        * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+        (WebCore::GraphicsContextGLOpenGL::simulateEventForTesting):
+        * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:
+        (WebCore::GraphicsContextGLOpenGL::simulateEventForTesting):
+        * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
+        Implement the feature by replacing
+            Internals.setFailNextGPUStatusCheck()
+            Internals.simulateContextChanged()
+        with
+            Internals.simulateEventForWebGLContext(SimulatedWebGLContextEvent, WebGLRenderingContext)
+        with eventName taking invented events that can happen to a
+        webgl context:
+         "GPUStatusFailure" and "ContextChange".
+
+        Future commits will add at least "Timeout".
+
+        The Internals function name was chosen not to contain "ForTesting" suffix, as
+        all the functions in the class should have that suffix.
+        The function names in the implementation path for the feature contains
+        "ForTesting" in order to highlight the feature not being in the normal
+        path.
+
 2021-03-03  Jean-Yves Avenard  <j...@apple.com>
 
         Remove RemoteCommandListenerIOS in favor of a common RemoteCommandListenerCocoa

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (273876 => 273877)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2021-03-04 09:00:18 UTC (rev 273877)
@@ -7564,10 +7564,10 @@
     canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextrestoredEvent, Event::CanBubble::No, Event::IsCancelable::Yes, emptyString()));
 }
 
-void WebGLRenderingContextBase::simulateContextChanged()
+void WebGLRenderingContextBase::simulateEventForTesting(SimulatedEventForTesting event)
 {
     if (m_context)
-        m_context->simulateContextChanged();
+        m_context->simulateEventForTesting(event);
 }
 
 String WebGLRenderingContextBase::ensureNotNull(const String& text) const
@@ -7899,14 +7899,6 @@
         m_context->setContextVisibility(newActivityState.contains(ActivityState::IsVisible));
 }
 
-void WebGLRenderingContextBase::setFailNextGPUStatusCheck()
-{
-    if (!m_context)
-        return;
-
-    m_context->setFailNextGPUStatusCheck();
-}
-
 void WebGLRenderingContextBase::didComposite()
 {
     m_compositingResultsNeedUpdating = false;

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (273876 => 273877)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2021-03-04 09:00:18 UTC (rev 273877)
@@ -378,7 +378,8 @@
     void forceLostContext(LostContextMode);
     void forceRestoreContext();
     void loseContextImpl(LostContextMode);
-    WEBCORE_EXPORT void simulateContextChanged();
+    using SimulatedEventForTesting = GraphicsContextGL::SimulatedEventForTesting;
+    WEBCORE_EXPORT void simulateEventForTesting(SimulatedEventForTesting);
 
     GraphicsContextGL* graphicsContextGL() const { return m_context.get(); }
     WebGLContextGroup* contextGroup() const { return m_contextGroup.get(); }
@@ -402,9 +403,6 @@
     void drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, long long offset, GCGLsizei primcount);
     void vertexAttribDivisor(GCGLuint index, GCGLuint divisor);
 
-    // Used for testing only, from Internals.
-    WEBCORE_EXPORT void setFailNextGPUStatusCheck();
-
     // GraphicsContextGL::Client
     void didComposite() override;
     void forceContextLost() override;

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h (273876 => 273877)


--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h	2021-03-04 09:00:18 UTC (rev 273877)
@@ -1275,8 +1275,6 @@
     // error list. Return true if at least one error is moved.
     virtual bool moveErrorsToSyntheticErrorList() = 0;
 
-    virtual void setFailNextGPUStatusCheck() = 0;
-
     virtual void prepareForDisplay() = 0;
 
     // FIXME: should be removed, caller should keep track of changed state.
@@ -1301,7 +1299,11 @@
     // on the content.
     virtual void markLayerComposited() = 0;
 
-    virtual void simulateContextChanged() = 0;
+    enum class SimulatedEventForTesting {
+        ContextChange,
+        GPUStatusFailure
+    };
+    virtual void simulateEventForTesting(SimulatedEventForTesting) = 0;
 
 #if ENABLE(VIDEO) && USE(AVFOUNDATION)
     // Returns interface for CV interaction if the functionality is present.

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (273876 => 273877)


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2021-03-04 09:00:18 UTC (rev 273877)
@@ -569,9 +569,16 @@
     return m_isForWebGL2;
 }
 
-void GraphicsContextGLOpenGL::simulateContextChanged()
+void GraphicsContextGLOpenGL::simulateEventForTesting(SimulatedEventForTesting event)
 {
-    GraphicsContextGLOpenGLManager::sharedManager().displayWasReconfigured();
+    if (event == SimulatedEventForTesting::ContextChange) {
+        GraphicsContextGLOpenGLManager::sharedManager().displayWasReconfigured();
+        return;
+    }
+    if (event == SimulatedEventForTesting::GPUStatusFailure) {
+        m_failNextStatusCheck = true;
+        return;
+    }
 }
 
 void GraphicsContextGLOpenGL::prepareForDisplay()

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp (273876 => 273877)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp	2021-03-04 09:00:18 UTC (rev 273877)
@@ -192,8 +192,10 @@
 {
 }
 
-void GraphicsContextGLOpenGL::simulateContextChanged()
+void GraphicsContextGLOpenGL::simulateEventForTesting(SimulatedEventForTesting event)
 {
+    if (event == SimulatedEventForTesting::GPUStatusFailure)
+        m_failNextStatusCheck = true;
 }
 
 void GraphicsContextGLOpenGL::prepareForDisplay()

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h (273876 => 273877)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h	2021-03-04 09:00:18 UTC (rev 273877)
@@ -457,7 +457,6 @@
     void enablePreserveDrawingBuffer() final;
 
     void dispatchContextChangedNotification();
-    void simulateContextChanged() final;
 
     void paintRenderingResultsToCanvas(ImageBuffer&) final;
     RefPtr<ImageData> paintRenderingResultsToImageData() final;
@@ -507,7 +506,7 @@
     ExtensionsGL& getExtensions() final;
 #endif
 
-    void setFailNextGPUStatusCheck() final { m_failNextStatusCheck = true; }
+    void simulateEventForTesting(SimulatedEventForTesting) override;
 
     unsigned textureSeed(GCGLuint texture) { return m_state.textureSeedCount.count(texture); }
 

Modified: trunk/Source/WebCore/testing/Internals.cpp (273876 => 273877)


--- trunk/Source/WebCore/testing/Internals.cpp	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebCore/testing/Internals.cpp	2021-03-04 09:00:18 UTC (rev 273877)
@@ -5092,16 +5092,23 @@
 #endif
 
 #if ENABLE(WEBGL)
-void Internals::simulateWebGLContextChanged(WebGLRenderingContext& context)
+void Internals::simulateEventForWebGLContext(SimulatedWebGLContextEvent event, WebGLRenderingContext& context)
 {
-    context.simulateContextChanged();
+    WebGLRenderingContext::SimulatedEventForTesting contextEvent;
+    switch (event) {
+    case SimulatedWebGLContextEvent::ContextChange:
+        contextEvent = WebGLRenderingContext::SimulatedEventForTesting::ContextChange;
+        break;
+    case SimulatedWebGLContextEvent::GPUStatusFailure:
+        contextEvent = WebGLRenderingContext::SimulatedEventForTesting::GPUStatusFailure;
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        return;
+    }
+    context.simulateEventForTesting(contextEvent);
 }
 
-void Internals::failNextGPUStatusCheck(WebGLRenderingContext& context)
-{
-    context.setFailNextGPUStatusCheck();
-}
-
 bool Internals::hasLowAndHighPowerGPUs()
 {
 #if PLATFORM(MAC)

Modified: trunk/Source/WebCore/testing/Internals.h (273876 => 273877)


--- trunk/Source/WebCore/testing/Internals.h	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebCore/testing/Internals.h	2021-03-04 09:00:18 UTC (rev 273877)
@@ -772,8 +772,11 @@
 #endif
 
 #if ENABLE(WEBGL)
-    void simulateWebGLContextChanged(WebGLRenderingContext&);
-    void failNextGPUStatusCheck(WebGLRenderingContext&);
+    enum class SimulatedWebGLContextEvent {
+        ContextChange,
+        GPUStatusFailure
+    };
+    void simulateEventForWebGLContext(SimulatedWebGLContextEvent, WebGLRenderingContext&);
     bool hasLowAndHighPowerGPUs();
 #endif
 

Modified: trunk/Source/WebCore/testing/Internals.idl (273876 => 273877)


--- trunk/Source/WebCore/testing/Internals.idl	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebCore/testing/Internals.idl	2021-03-04 09:00:18 UTC (rev 273877)
@@ -99,6 +99,11 @@
     "ComposedTree"
 };
 
+[Conditional=WEBGL] enum SimulatedWebGLContextEvent {
+    "ContextChange",
+    "GPUStatusFailure"
+};
+
 [
     ExportMacro=WEBCORE_TESTSUPPORT_EXPORT,
     Conditional=VIDEO,
@@ -791,8 +796,7 @@
     undefined disableTileSizeUpdateDelay();
     undefined setSpeculativeTilingDelayDisabledForTesting(boolean disabled);
 
-    [Conditional=WEBGL] undefined simulateWebGLContextChanged(WebGLRenderingContext context);
-    [Conditional=WEBGL] undefined failNextGPUStatusCheck(WebGLRenderingContext context);
+    [Conditional=WEBGL] undefined simulateEventForWebGLContext(SimulatedWebGLContextEvent event, WebGLRenderingContext context);
     [Conditional=WEBGL] boolean hasLowAndHighPowerGPUs();
 
     undefined setPageVisibility(boolean isVisible);

Modified: trunk/Source/WebKit/ChangeLog (273876 => 273877)


--- trunk/Source/WebKit/ChangeLog	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebKit/ChangeLog	2021-03-04 09:00:18 UTC (rev 273877)
@@ -1,3 +1,23 @@
+2021-03-04  Kimmo Kinnunen  <kkinnu...@apple.com>
+
+        Adding new test conditions for WebGL should be simpler
+        https://bugs.webkit.org/show_bug.cgi?id=222593
+
+        Reviewed by Kenneth Russell.
+
+        Replace simulateContextChanged and
+        setFailNextGPUStatusCheck with simulateEventForTesting.
+
+        * GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
+        (WebKit::RemoteGraphicsContextGL::simulateEventForTesting):
+        * GPUProcess/graphics/RemoteGraphicsContextGL.h:
+        * GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
+        * GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h:
+        * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
+        (WebKit::RemoteGraphicsContextGLProxy::simulateEventForTesting):
+        * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
+        * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp:
+
 2021-03-03  Alex Christensen  <achristen...@webkit.org>
 
         WKRemoteObjectCoder should be able to handle NSErrors from TLS failures

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp (273876 => 273877)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp	2021-03-04 09:00:18 UTC (rev 273877)
@@ -255,6 +255,12 @@
 #endif
 }
 
+void RemoteGraphicsContextGL::simulateEventForTesting(WebCore::GraphicsContextGLOpenGL::SimulatedEventForTesting event)
+{
+    // FIXME: only run this in testing mode. https://bugs.webkit.org/show_bug.cgi?id=222544
+    m_context->simulateEventForTesting(event);
+}
+
 } // namespace WebKit
 
 #endif

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h (273876 => 273877)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h	2021-03-04 09:00:18 UTC (rev 273877)
@@ -92,6 +92,7 @@
     void paintRenderingResultsToCanvas(WebCore::RenderingResourceIdentifier, CompletionHandler<void()>&&);
     void paintCompositedResultsToCanvas(WebCore::RenderingResourceIdentifier, CompletionHandler<void()>&&);
     void copyTextureFromMedia(WebCore::MediaPlayerIdentifier, uint32_t texture, uint32_t target, int32_t level, uint32_t internalFormat, uint32_t format, uint32_t type, bool premultiplyAlpha, bool flipY, CompletionHandler<void(bool)>&&);
+    void simulateEventForTesting(WebCore::GraphicsContextGLOpenGL::SimulatedEventForTesting);
 
 #include "RemoteGraphicsContextGLFunctionsGenerated.h" // NOLINT
 

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in (273876 => 273877)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in	2021-03-04 09:00:18 UTC (rev 273877)
@@ -39,8 +39,8 @@
     void PaintRenderingResultsToCanvas(WebCore::RenderingResourceIdentifier imageBuffer) -> () Synchronous
     void PaintCompositedResultsToCanvas(WebCore::RenderingResourceIdentifier imageBuffer) -> () Synchronous
     void CopyTextureFromMedia(WebCore::MediaPlayerIdentifier identifier, uint32_t texture, uint32_t target, int32_t level, uint32_t internalFormat, uint32_t format, uint32_t type, bool premultiplyAlpha, bool flipY) -> (bool success) Synchronous
+    void SimulateEventForTesting(WebCore::GraphicsContextGL::SimulatedEventForTesting event)
 
-    void SetFailNextGPUStatusCheck()
     void MoveErrorsToSyntheticErrorList() -> (bool returnValue) Synchronous
     void ActiveTexture(uint32_t texture)
     void AttachShader(uint32_t program, uint32_t shader)

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h (273876 => 273877)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLFunctionsGenerated.h	2021-03-04 09:00:18 UTC (rev 273877)
@@ -25,10 +25,6 @@
 // This file should be included in the private section of the
 // RemoteGraphicsContextGL implementations.
 #pragma once
-    void setFailNextGPUStatusCheck()
-    {
-        m_context->setFailNextGPUStatusCheck();
-    }
     void moveErrorsToSyntheticErrorList(CompletionHandler<void(bool)>&& completionHandler)
     {
         bool returnValue = { };

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h (273876 => 273877)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2021-03-04 09:00:18 UTC (rev 273877)
@@ -1023,6 +1023,14 @@
 #endif
     >;
 };
+
+template <> struct EnumTraits<WebCore::GraphicsContextGL::SimulatedEventForTesting> {
+    using values = EnumValues<
+    WebCore::GraphicsContextGL::SimulatedEventForTesting,
+    WebCore::GraphicsContextGL::SimulatedEventForTesting::ContextChange,
+    WebCore::GraphicsContextGL::SimulatedEventForTesting::GPUStatusFailure
+    >;
+};
 #endif
 
 } // namespace WTF

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp (273876 => 273877)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp	2021-03-04 09:00:18 UTC (rev 273877)
@@ -128,12 +128,6 @@
         markContextLost();
 }
 
-void RemoteGraphicsContextGLProxy::simulateContextChanged()
-{
-    // FIXME: Currently not implemented because it's not clear this is the right way. https://bugs.webkit.org/show_bug.cgi?id=219349
-    notImplemented();
-}
-
 void RemoteGraphicsContextGLProxy::paintRenderingResultsToCanvas(ImageBuffer& buffer)
 {
     // FIXME: the buffer is "relatively empty" always, but for consistency, we need to ensure
@@ -199,6 +193,15 @@
     return std::exchange(m_errorWhenContextIsLost, NO_ERROR);
 }
 
+void RemoteGraphicsContextGLProxy::simulateEventForTesting(SimulatedEventForTesting event)
+{
+    if (!isContextLost()) {
+        auto sendResult = send(Messages::RemoteGraphicsContextGL::SimulateEventForTesting(event));
+        if (!sendResult)
+            markContextLost();
+    }
+}
+
 void RemoteGraphicsContextGLProxy::wasCreated(bool didSucceed, IPC::Semaphore&& semaphore, String&& availableExtensions, String&& requestedExtensions)
 {
     if (isContextLost())

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h (273876 => 273877)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h	2021-03-04 09:00:18 UTC (rev 273877)
@@ -64,16 +64,14 @@
     using WebCore::RemoteGraphicsContextGLProxyBase::isEnabled;
     void ensureExtensionEnabled(const String& extension) final;
     void notifyMarkContextChanged() final;
-    void simulateContextChanged() final;
     void paintRenderingResultsToCanvas(WebCore::ImageBuffer&) final;
     void paintCompositedResultsToCanvas(WebCore::ImageBuffer&) final;
     void synthesizeGLError(GCGLenum error) final;
     GCGLenum getError() final;
-
     bool copyTextureFromMedia(WebCore::MediaPlayer&, PlatformGLObject texture, GCGLenum target, GCGLint level, GCGLenum internalFormat, GCGLenum format, GCGLenum type, bool premultiplyAlpha, bool flipY) final;
+    void simulateEventForTesting(SimulatedEventForTesting) final;
 
     // Functions with a generated implementation. This list is used by generate-gpup-webgl script.
-    void setFailNextGPUStatusCheck() final;
     bool moveErrorsToSyntheticErrorList() final;
     void activeTexture(GCGLenum texture) final;
     void attachShader(PlatformGLObject program, PlatformGLObject shader) final;

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp (273876 => 273877)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp	2021-03-04 09:00:18 UTC (rev 273877)
@@ -30,15 +30,6 @@
 
 namespace WebKit {
 
-void RemoteGraphicsContextGLProxy::setFailNextGPUStatusCheck()
-{
-    if (!isContextLost()) {
-        auto sendResult = send(Messages::RemoteGraphicsContextGL::SetFailNextGPUStatusCheck());
-        if (!sendResult)
-            markContextLost();
-    }
-}
-
 bool RemoteGraphicsContextGLProxy::moveErrorsToSyntheticErrorList()
 {
     bool returnValue = { };

Modified: trunk/Tools/ChangeLog (273876 => 273877)


--- trunk/Tools/ChangeLog	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Tools/ChangeLog	2021-03-04 09:00:18 UTC (rev 273877)
@@ -1,3 +1,18 @@
+2021-03-04  Kimmo Kinnunen  <kkinnu...@apple.com>
+
+        Adding new test conditions for WebGL should be simpler
+        https://bugs.webkit.org/show_bug.cgi?id=222593
+
+        Reviewed by Kenneth Russell.
+
+        Add SimulateEventForTesting(String eventName) to manually
+        implemented RemoteGraphicsContextGL functions.
+        Use manually generated function because next commit for
+        timeout implementation will add some logic to RemoteGraphicsContextGL
+        while forwarding rest of the events to the underlying GraphicsContextGL.
+
+        * Scripts/generate-gpup-webgl:
+
 2021-03-03  Alex Christensen  <achristen...@webkit.org>
 
         WKRemoteObjectCoder should be able to handle NSErrors from TLS failures

Modified: trunk/Tools/Scripts/generate-gpup-webgl (273876 => 273877)


--- trunk/Tools/Scripts/generate-gpup-webgl	2021-03-04 08:48:49 UTC (rev 273876)
+++ trunk/Tools/Scripts/generate-gpup-webgl	2021-03-04 09:00:18 UTC (rev 273877)
@@ -104,6 +104,7 @@
     void PaintRenderingResultsToCanvas(WebCore::RenderingResourceIdentifier imageBuffer) -> () Synchronous
     void PaintCompositedResultsToCanvas(WebCore::RenderingResourceIdentifier imageBuffer) -> () Synchronous
     void CopyTextureFromMedia(WebCore::MediaPlayerIdentifier identifier, uint32_t texture, uint32_t target, int32_t level, uint32_t internalFormat, uint32_t format, uint32_t type, bool premultiplyAlpha, bool flipY) -> (bool success) Synchronous
+    void SimulateEventForTesting(WebCore::GraphicsContextGL::SimulatedEventForTesting event)
 {}
 }}
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to