Changeset 250381 in webkit


Ignore:
Timestamp:
Sep 26, 2019 1:33:35 AM (5 years ago)
Author:
Devin Rousso
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.

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r250379 r250381  
     12019-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
    1312019-09-25  Chris Dumez  <cdumez@apple.com>
    232
  • trunk/Source/WebCore/Modules/webgpu/WebGPUPipeline.cpp

    r250258 r250381  
    5858WebGPUPipeline::WebGPUPipeline(WebGPUDevice& device, GPUErrorScopes& errorScopes)
    5959    : GPUObjectBase(makeRef(errorScopes))
    60     , m_scriptExecutionContext(device.scriptExecutionContext())
     60    , ContextDestructionObserver(device.scriptExecutionContext())
    6161{
    62     ASSERT(m_scriptExecutionContext);
     62    ASSERT(scriptExecutionContext());
    6363
    6464    {
     
    7979}
    8080
     81void WebGPUPipeline::contextDestroyed()
     82{
     83    InspectorInstrumentation::willDestroyWebGPUPipeline(*this);
     84
     85    ContextDestructionObserver::contextDestroyed();
     86}
     87
    8188} // namespace WebCore
    8289
  • trunk/Source/WebCore/Modules/webgpu/WebGPUPipeline.h

    r250258 r250381  
    2828#if ENABLE(WEBGPU)
    2929
     30#include "ContextDestructionObserver.h"
    3031#include "GPUObjectBase.h"
    3132#include "WebGPUShaderModule.h"
     
    3839class WebGPUDevice;
    3940
    40 class WebGPUPipeline : public GPUObjectBase {
     41class WebGPUPipeline : public GPUObjectBase, public ContextDestructionObserver {
    4142public:
    4243    virtual ~WebGPUPipeline();
     
    4546    static Lock& instancesMutex();
    4647
     48    void contextDestroyed() final;
     49
    4750    virtual bool isRenderPipeline() const { return false; }
    4851    virtual bool isComputePipeline() const { return false; }
    4952
    50     ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; }
    5153    virtual bool isValid() const = 0;
    5254
     
    6062protected:
    6163    WebGPUPipeline(WebGPUDevice&, GPUErrorScopes&);
    62 
    63     ScriptExecutionContext* m_scriptExecutionContext;
    6464};
    6565
  • trunk/Source/WebCore/html/canvas/WebGLProgram.cpp

    r250258 r250381  
    6363WebGLProgram::WebGLProgram(WebGLRenderingContextBase& ctx)
    6464    : WebGLSharedObject(ctx)
    65     , m_scriptExecutionContext(ctx.scriptExecutionContext())
    66 {
    67     ASSERT(m_scriptExecutionContext);
     65    , ContextDestructionObserver(ctx.scriptExecutionContext())
     66{
     67    ASSERT(scriptExecutionContext());
    6868
    6969    {
     
    8686        instances(lock).remove(this);
    8787    }
     88}
     89
     90void WebGLProgram::contextDestroyed()
     91{
     92    InspectorInstrumentation::willDestroyWebGLProgram(*this);
     93
     94    ContextDestructionObserver::contextDestroyed();
    8895}
    8996
  • trunk/Source/WebCore/html/canvas/WebGLProgram.h

    r250258 r250381  
    2828#if ENABLE(WEBGL)
    2929
     30#include "ContextDestructionObserver.h"
    3031#include "WebGLSharedObject.h"
    3132#include <wtf/Forward.h>
     
    3738class WebGLShader;
    3839
    39 class WebGLProgram final : public WebGLSharedObject {
     40class WebGLProgram final : public WebGLSharedObject, public ContextDestructionObserver {
    4041public:
    4142    static Ref<WebGLProgram> create(WebGLRenderingContextBase&);
     
    4546    static Lock& instancesMutex();
    4647
    47     ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; }
     48    void contextDestroyed() final;
    4849
    4950    unsigned numActiveAttribLocations();
     
    7677    void cacheInfoIfNeeded();
    7778
    78     ScriptExecutionContext* m_scriptExecutionContext;
    79 
    8079    Vector<GC3Dint> m_activeAttribLocations;
    8180
Note: See TracChangeset for help on using the changeset viewer.