- Revision
- 250381
- Author
- [email protected]
- Date
- 2019-09-26 01:33:35 -0700 (Thu, 26 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 `WebGPUPipeline`/`WebGLProgram` outlives it's `WebGPUDevice`/`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 `WebGPUPipeline`/`WebGLProgram`
extend 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
* Modules/webgpu/WebGPUPipeline.h:
(WebCore::WebGPUPipeline::scriptExecutionContext const): Deleted.
* Modules/webgpu/WebGPUPipeline.cpp:
(WebCore::WebGPUPipeline::WebGPUPipeline):
(WebCore::WebGPUPipeline::contextDestroyed): Added.
* 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 (250380 => 250381)
--- trunk/Source/WebCore/ChangeLog 2019-09-26 06:41:14 UTC (rev 250380)
+++ trunk/Source/WebCore/ChangeLog 2019-09-26 08:33:35 UTC (rev 250381)
@@ -1,3 +1,33 @@
+2019-09-26 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 `WebGPUPipeline`/`WebGLProgram` outlives it's `WebGPUDevice`/`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 `WebGPUPipeline`/`WebGLProgram`
+ extend 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
+
+ * Modules/webgpu/WebGPUPipeline.h:
+ (WebCore::WebGPUPipeline::scriptExecutionContext const): Deleted.
+ * Modules/webgpu/WebGPUPipeline.cpp:
+ (WebCore::WebGPUPipeline::WebGPUPipeline):
+ (WebCore::WebGPUPipeline::contextDestroyed): Added.
+
+ * html/canvas/WebGLProgram.h:
+ (WebCore::WebGLProgram::scriptExecutionContext const): Deleted.
+ * html/canvas/WebGLProgram.cpp:
+ (WebCore::WebGLProgram::WebGLProgram):
+ (WebCore::WebGLProgram::contextDestroyed): Added.
+
2019-09-25 Chris Dumez <[email protected]>
Add very basic PageCache support for RTCPeerConnection
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUPipeline.cpp (250380 => 250381)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUPipeline.cpp 2019-09-26 06:41:14 UTC (rev 250380)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUPipeline.cpp 2019-09-26 08:33:35 UTC (rev 250381)
@@ -57,9 +57,9 @@
WebGPUPipeline::WebGPUPipeline(WebGPUDevice& device, GPUErrorScopes& errorScopes)
: GPUObjectBase(makeRef(errorScopes))
- , m_scriptExecutionContext(device.scriptExecutionContext())
+ , ContextDestructionObserver(device.scriptExecutionContext())
{
- ASSERT(m_scriptExecutionContext);
+ ASSERT(scriptExecutionContext());
{
LockHolder lock(instancesMutex());
@@ -78,6 +78,13 @@
}
}
+void WebGPUPipeline::contextDestroyed()
+{
+ InspectorInstrumentation::willDestroyWebGPUPipeline(*this);
+
+ ContextDestructionObserver::contextDestroyed();
+}
+
} // namespace WebCore
#endif // ENABLE(WEBGPU)
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUPipeline.h (250380 => 250381)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUPipeline.h 2019-09-26 06:41:14 UTC (rev 250380)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUPipeline.h 2019-09-26 08:33:35 UTC (rev 250381)
@@ -27,6 +27,7 @@
#if ENABLE(WEBGPU)
+#include "ContextDestructionObserver.h"
#include "GPUObjectBase.h"
#include "WebGPUShaderModule.h"
#include <wtf/Forward.h>
@@ -37,7 +38,7 @@
class GPUErrorScopes;
class WebGPUDevice;
-class WebGPUPipeline : public GPUObjectBase {
+class WebGPUPipeline : public GPUObjectBase, public ContextDestructionObserver {
public:
virtual ~WebGPUPipeline();
@@ -44,10 +45,11 @@
static HashMap<WebGPUPipeline*, WebGPUDevice*>& instances(const LockHolder&);
static Lock& instancesMutex();
+ void contextDestroyed() final;
+
virtual bool isRenderPipeline() const { return false; }
virtual bool isComputePipeline() const { return false; }
- ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; }
virtual bool isValid() const = 0;
struct ShaderData {
@@ -59,8 +61,6 @@
protected:
WebGPUPipeline(WebGPUDevice&, GPUErrorScopes&);
-
- ScriptExecutionContext* m_scriptExecutionContext;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/html/canvas/WebGLProgram.cpp (250380 => 250381)
--- trunk/Source/WebCore/html/canvas/WebGLProgram.cpp 2019-09-26 06:41:14 UTC (rev 250380)
+++ trunk/Source/WebCore/html/canvas/WebGLProgram.cpp 2019-09-26 08:33:35 UTC (rev 250381)
@@ -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 (250380 => 250381)
--- trunk/Source/WebCore/html/canvas/WebGLProgram.h 2019-09-26 06:41:14 UTC (rev 250380)
+++ trunk/Source/WebCore/html/canvas/WebGLProgram.h 2019-09-26 08:33:35 UTC (rev 250381)
@@ -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 };