Title: [250434] trunk/Source/WebCore
Revision
250434
Author
[email protected]
Date
2019-09-27 10:54:22 -0700 (Fri, 27 Sep 2019)

Log Message

Flaky Test: inspector/canvas/updateShader.html
https://bugs.webkit.org/show_bug.cgi?id=202186
<rdar://problem/55716053>

Reviewed by Joseph Pecoraro.

If the `WebGLProgram` outlives it's `WebGLRenderingContext`, the `ScriptExecutionContext*`
that was provided in the constructor won't be invalidated leading to the bad access crash.

Rather than pass the `ScriptExecutionContext*` directly, have `WebGLProgram` inherit from
`ContextDestructionObserver` so that it can propertly invalidate (and notify Web Inspector)
when the related context is about to be destroyed.

Test: inspector/canvas/updateShader.html

* html/canvas/WebGLProgram.h:
(WebCore::WebGLProgram::scriptExecutionContext const): Deleted.
* html/canvas/WebGLProgram.cpp:
(WebCore::WebGLProgram::WebGLProgram):
(WebCore::WebGLProgram::contextDestroyed): Added.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (250433 => 250434)


--- trunk/Source/WebCore/ChangeLog	2019-09-27 17:45:01 UTC (rev 250433)
+++ trunk/Source/WebCore/ChangeLog	2019-09-27 17:54:22 UTC (rev 250434)
@@ -1,3 +1,26 @@
+2019-09-27  Devin Rousso  <[email protected]>
+
+        Flaky Test: inspector/canvas/updateShader.html
+        https://bugs.webkit.org/show_bug.cgi?id=202186
+        <rdar://problem/55716053>
+
+        Reviewed by Joseph Pecoraro.
+
+        If the `WebGLProgram` outlives it's `WebGLRenderingContext`, the `ScriptExecutionContext*`
+        that was provided in the constructor won't be invalidated leading to the bad access crash.
+
+        Rather than pass the `ScriptExecutionContext*` directly, have `WebGLProgram` inherit from
+        `ContextDestructionObserver` so that it can propertly invalidate (and notify Web Inspector)
+        when the related context is about to be destroyed.
+
+        Test: inspector/canvas/updateShader.html
+
+        * html/canvas/WebGLProgram.h:
+        (WebCore::WebGLProgram::scriptExecutionContext const): Deleted.
+        * html/canvas/WebGLProgram.cpp:
+        (WebCore::WebGLProgram::WebGLProgram):
+        (WebCore::WebGLProgram::contextDestroyed): Added.
+
 2019-09-27  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] Replace Line::Run's logicalRect/textContext with Display::Run

Modified: trunk/Source/WebCore/html/canvas/WebGLProgram.cpp (250433 => 250434)


--- trunk/Source/WebCore/html/canvas/WebGLProgram.cpp	2019-09-27 17:45:01 UTC (rev 250433)
+++ trunk/Source/WebCore/html/canvas/WebGLProgram.cpp	2019-09-27 17:54:22 UTC (rev 250434)
@@ -62,9 +62,9 @@
 
 WebGLProgram::WebGLProgram(WebGLRenderingContextBase& ctx)
     : WebGLSharedObject(ctx)
-    , m_scriptExecutionContext(ctx.scriptExecutionContext())
+    , ContextDestructionObserver(ctx.scriptExecutionContext())
 {
-    ASSERT(m_scriptExecutionContext);
+    ASSERT(scriptExecutionContext());
 
     {
         LockHolder lock(instancesMutex());
@@ -87,6 +87,13 @@
     }
 }
 
+void WebGLProgram::contextDestroyed()
+{
+    InspectorInstrumentation::willDestroyWebGLProgram(*this);
+
+    ContextDestructionObserver::contextDestroyed();
+}
+
 void WebGLProgram::deleteObjectImpl(GraphicsContext3D* context3d, Platform3DObject obj)
 {
     context3d->deleteProgram(obj);

Modified: trunk/Source/WebCore/html/canvas/WebGLProgram.h (250433 => 250434)


--- trunk/Source/WebCore/html/canvas/WebGLProgram.h	2019-09-27 17:45:01 UTC (rev 250433)
+++ trunk/Source/WebCore/html/canvas/WebGLProgram.h	2019-09-27 17:54:22 UTC (rev 250434)
@@ -27,6 +27,7 @@
 
 #if ENABLE(WEBGL)
 
+#include "ContextDestructionObserver.h"
 #include "WebGLSharedObject.h"
 #include <wtf/Forward.h>
 
@@ -36,7 +37,7 @@
 class WebGLRenderingContextBase;
 class WebGLShader;
 
-class WebGLProgram final : public WebGLSharedObject {
+class WebGLProgram final : public WebGLSharedObject, public ContextDestructionObserver {
 public:
     static Ref<WebGLProgram> create(WebGLRenderingContextBase&);
     virtual ~WebGLProgram();
@@ -44,7 +45,7 @@
     static HashMap<WebGLProgram*, WebGLRenderingContextBase*>& instances(const LockHolder&);
     static Lock& instancesMutex();
 
-    ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; }
+    void contextDestroyed() final;
 
     unsigned numActiveAttribLocations();
     GC3Dint getActiveAttribLocation(GC3Duint index);
@@ -75,8 +76,6 @@
     void cacheActiveAttribLocations(GraphicsContext3D*);
     void cacheInfoIfNeeded();
 
-    ScriptExecutionContext* m_scriptExecutionContext;
-
     Vector<GC3Dint> m_activeAttribLocations;
 
     GC3Dint m_linkStatus { 0 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to