Changeset 250434 in webkit


Ignore:
Timestamp:
Sep 27, 2019 10:54:22 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 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.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r250429 r250434  
     12019-09-27  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 `WebGLProgram` outlives it's `WebGLRenderingContext`, the `ScriptExecutionContext*`
     10        that was provided in the constructor won't be invalidated leading to the bad access crash.
     11
     12        Rather than pass the `ScriptExecutionContext*` directly, have `WebGLProgram` inherit from
     13        `ContextDestructionObserver` so that it can propertly invalidate (and notify Web Inspector)
     14        when the related context is about to be destroyed.
     15
     16        Test: inspector/canvas/updateShader.html
     17
     18        * html/canvas/WebGLProgram.h:
     19        (WebCore::WebGLProgram::scriptExecutionContext const): Deleted.
     20        * html/canvas/WebGLProgram.cpp:
     21        (WebCore::WebGLProgram::WebGLProgram):
     22        (WebCore::WebGLProgram::contextDestroyed): Added.
     23
    1242019-09-27  Zalan Bujtas  <zalan@apple.com>
    225
  • trunk/Source/WebCore/html/canvas/WebGLProgram.cpp

    r250386 r250434  
    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

    r250386 r250434  
    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.