Changeset 250381 in webkit
- Timestamp:
- Sep 26, 2019 1:33:35 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r250379 r250381 1 2019-09-26 Devin Rousso <drousso@apple.com> 2 3 Flaky Test: inspector/canvas/updateShader.html 4 https://bugs.webkit.org/show_bug.cgi?id=202186 5 <rdar://problem/55716053> 6 7 Reviewed by Joseph Pecoraro. 8 9 If the `WebGPUPipeline`/`WebGLProgram` outlives it's `WebGPUDevice`/`WebGLRenderingContext`, 10 the `ScriptExecutionContext*` that was provided in the constructor won't be invalidated 11 leading to the bad access crash. 12 13 Rather than pass the `ScriptExecutionContext*` directly, have `WebGPUPipeline`/`WebGLProgram` 14 extend from `ContextDestructionObserver` so that it can propertly invalidate (and notify Web 15 Inspector) when the related context is about to be destroyed. 16 17 Test: inspector/canvas/updateShader.html 18 19 * Modules/webgpu/WebGPUPipeline.h: 20 (WebCore::WebGPUPipeline::scriptExecutionContext const): Deleted. 21 * Modules/webgpu/WebGPUPipeline.cpp: 22 (WebCore::WebGPUPipeline::WebGPUPipeline): 23 (WebCore::WebGPUPipeline::contextDestroyed): Added. 24 25 * html/canvas/WebGLProgram.h: 26 (WebCore::WebGLProgram::scriptExecutionContext const): Deleted. 27 * html/canvas/WebGLProgram.cpp: 28 (WebCore::WebGLProgram::WebGLProgram): 29 (WebCore::WebGLProgram::contextDestroyed): Added. 30 1 31 2019-09-25 Chris Dumez <cdumez@apple.com> 2 32 -
trunk/Source/WebCore/Modules/webgpu/WebGPUPipeline.cpp
r250258 r250381 58 58 WebGPUPipeline::WebGPUPipeline(WebGPUDevice& device, GPUErrorScopes& errorScopes) 59 59 : GPUObjectBase(makeRef(errorScopes)) 60 , m_scriptExecutionContext(device.scriptExecutionContext())60 , ContextDestructionObserver(device.scriptExecutionContext()) 61 61 { 62 ASSERT( m_scriptExecutionContext);62 ASSERT(scriptExecutionContext()); 63 63 64 64 { … … 79 79 } 80 80 81 void WebGPUPipeline::contextDestroyed() 82 { 83 InspectorInstrumentation::willDestroyWebGPUPipeline(*this); 84 85 ContextDestructionObserver::contextDestroyed(); 86 } 87 81 88 } // namespace WebCore 82 89 -
trunk/Source/WebCore/Modules/webgpu/WebGPUPipeline.h
r250258 r250381 28 28 #if ENABLE(WEBGPU) 29 29 30 #include "ContextDestructionObserver.h" 30 31 #include "GPUObjectBase.h" 31 32 #include "WebGPUShaderModule.h" … … 38 39 class WebGPUDevice; 39 40 40 class WebGPUPipeline : public GPUObjectBase {41 class WebGPUPipeline : public GPUObjectBase, public ContextDestructionObserver { 41 42 public: 42 43 virtual ~WebGPUPipeline(); … … 45 46 static Lock& instancesMutex(); 46 47 48 void contextDestroyed() final; 49 47 50 virtual bool isRenderPipeline() const { return false; } 48 51 virtual bool isComputePipeline() const { return false; } 49 52 50 ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; }51 53 virtual bool isValid() const = 0; 52 54 … … 60 62 protected: 61 63 WebGPUPipeline(WebGPUDevice&, GPUErrorScopes&); 62 63 ScriptExecutionContext* m_scriptExecutionContext;64 64 }; 65 65 -
trunk/Source/WebCore/html/canvas/WebGLProgram.cpp
r250258 r250381 63 63 WebGLProgram::WebGLProgram(WebGLRenderingContextBase& ctx) 64 64 : WebGLSharedObject(ctx) 65 , m_scriptExecutionContext(ctx.scriptExecutionContext())66 { 67 ASSERT( m_scriptExecutionContext);65 , ContextDestructionObserver(ctx.scriptExecutionContext()) 66 { 67 ASSERT(scriptExecutionContext()); 68 68 69 69 { … … 86 86 instances(lock).remove(this); 87 87 } 88 } 89 90 void WebGLProgram::contextDestroyed() 91 { 92 InspectorInstrumentation::willDestroyWebGLProgram(*this); 93 94 ContextDestructionObserver::contextDestroyed(); 88 95 } 89 96 -
trunk/Source/WebCore/html/canvas/WebGLProgram.h
r250258 r250381 28 28 #if ENABLE(WEBGL) 29 29 30 #include "ContextDestructionObserver.h" 30 31 #include "WebGLSharedObject.h" 31 32 #include <wtf/Forward.h> … … 37 38 class WebGLShader; 38 39 39 class WebGLProgram final : public WebGLSharedObject {40 class WebGLProgram final : public WebGLSharedObject, public ContextDestructionObserver { 40 41 public: 41 42 static Ref<WebGLProgram> create(WebGLRenderingContextBase&); … … 45 46 static Lock& instancesMutex(); 46 47 47 ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; }48 void contextDestroyed() final; 48 49 49 50 unsigned numActiveAttribLocations(); … … 76 77 void cacheInfoIfNeeded(); 77 78 78 ScriptExecutionContext* m_scriptExecutionContext;79 80 79 Vector<GC3Dint> m_activeAttribLocations; 81 80
Note: See TracChangeset
for help on using the changeset viewer.