Changeset 77900 in webkit


Ignore:
Timestamp:
Feb 7, 2011 10:25:20 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-02-07 Alexey Marinichev <amarinichev@chromium.org>

Reviewed by Kenneth Russell.

Hook up WebGraphicsContext3D::setContextLostCallback.
https://bugs.webkit.org/show_bug.cgi?id=53722

Test: fast/canvas/webgl/context-lost.html, comment out the line with
extension.loseContext() and kill the GPU process "Lose context"
message shows up.

  • html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContextLostCallback::WebGLRenderingContextLostCallback): (WebCore::WebGLRenderingContextLostCallback::onContextLost): (WebCore::WebGLRenderingContextLostCallback::~WebGLRenderingContextLostCallback): (WebCore::WebGLRenderingContext::initializeNewContext): (WebCore::WebGLRenderingContext::~WebGLRenderingContext):
  • platform/graphics/GraphicsContext3D.h: (WebCore::GraphicsContext3D::ContextLostCallback::~ContextLostCallback):
  • platform/graphics/mac/GraphicsContext3DMac.mm: (WebCore::GraphicsContext3D::setContextLostCallback): stub
  • platform/graphics/qt/GraphicsContext3DQt.cpp: (WebCore::GraphicsContext3D::setContextLostCallback): stub

2011-02-07 Alexey Marinichev <amarinichev@chromium.org>

Reviewed by Kenneth Russell.

Hook up WebGraphicsContext3D::setContextLostCallback.
https://bugs.webkit.org/show_bug.cgi?id=53722

Test: fast/canvas/webgl/context-lost.html, comment out the line with
extension.loseContext() and kill the GPU process "Lose context"
message shows up.

  • public/WebGraphicsContext3D.h: (WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback::~WebGraphicsContextLostCallback):
  • src/GraphicsContext3DChromium.cpp: (WebCore::GraphicsContextLostCallbackAdapter::~GraphicsContextLostCallbackAdapter): (WebCore::GraphicsContextLostCallbackAdapter::GraphicsContextLostCallbackAdapter): (WebCore::GraphicsContextLostCallbackAdapter::onContextLost): (WebCore::GraphicsContextLostCallbackAdapter::create): (WebCore::GraphicsContext3DInternal::setContextLostCallback):
  • src/GraphicsContext3DInternal.h:
Location:
trunk/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r77895 r77900  
     12011-02-07  Alexey Marinichev  <amarinichev@chromium.org>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Hook up WebGraphicsContext3D::setContextLostCallback.
     6        https://bugs.webkit.org/show_bug.cgi?id=53722
     7
     8        Test: fast/canvas/webgl/context-lost.html, comment out the line with
     9        extension.loseContext() and kill the GPU process "Lose context"
     10        message shows up.
     11
     12        * html/canvas/WebGLRenderingContext.cpp:
     13        (WebCore::WebGLRenderingContextLostCallback::WebGLRenderingContextLostCallback):
     14        (WebCore::WebGLRenderingContextLostCallback::onContextLost):
     15        (WebCore::WebGLRenderingContextLostCallback::~WebGLRenderingContextLostCallback):
     16        (WebCore::WebGLRenderingContext::initializeNewContext):
     17        (WebCore::WebGLRenderingContext::~WebGLRenderingContext):
     18        * platform/graphics/GraphicsContext3D.h:
     19        (WebCore::GraphicsContext3D::ContextLostCallback::~ContextLostCallback):
     20        * platform/graphics/mac/GraphicsContext3DMac.mm:
     21        (WebCore::GraphicsContext3D::setContextLostCallback): stub
     22        * platform/graphics/qt/GraphicsContext3DQt.cpp:
     23        (WebCore::GraphicsContext3D::setContextLostCallback): stub
     24
    1252011-02-07  Patrick Gansterer  <paroga@webkit.org>
    226
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp

    r77821 r77900  
    342342}
    343343
     344class WebGLRenderingContextLostCallback : public GraphicsContext3D::ContextLostCallback {
     345public:
     346    WebGLRenderingContextLostCallback(WebGLRenderingContext* cb) : m_contextLostCallback(cb) {}
     347    virtual void onContextLost() { m_contextLostCallback->forceLostContext(); }
     348    virtual ~WebGLRenderingContextLostCallback() {}
     349private:
     350    WebGLRenderingContext* m_contextLostCallback;
     351};
     352
    344353PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElement* canvas, WebGLContextAttributes* attrs)
    345354{
     
    417426    m_context->reshape(canvas()->width(), canvas()->height());
    418427    m_context->viewport(0, 0, canvas()->width(), canvas()->height());
     428
     429    m_context->setContextLostCallback(adoptPtr(new WebGLRenderingContextLostCallback(this)));
    419430}
    420431
     
    438449{
    439450    detachAndRemoveAllObjects();
     451    m_context->setContextLostCallback(0);
    440452}
    441453
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h

    r76549 r77900  
    455455    };
    456456
     457    class ContextLostCallback {
     458    public:
     459        virtual void onContextLost() = 0;
     460        virtual ~ContextLostCallback() {}
     461    };
     462
     463    void setContextLostCallback(PassOwnPtr<ContextLostCallback>);
     464
    457465    static PassRefPtr<GraphicsContext3D> create(Attributes, HostWindow*, RenderStyle = RenderOffscreen);
    458466    ~GraphicsContext3D();
  • trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm

    r76600 r77900  
    246246}
    247247
     248void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback>)
     249{
     250}
     251
    248252}
    249253
  • trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp

    r76600 r77900  
    16481648}
    16491649
     1650void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback>)
     1651{
     1652}
     1653
    16501654}
    16511655
  • trunk/Source/WebKit/chromium/ChangeLog

    r77896 r77900  
     12011-02-07  Alexey Marinichev  <amarinichev@chromium.org>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Hook up WebGraphicsContext3D::setContextLostCallback.
     6        https://bugs.webkit.org/show_bug.cgi?id=53722
     7
     8        Test: fast/canvas/webgl/context-lost.html, comment out the line with
     9        extension.loseContext() and kill the GPU process "Lose context"
     10        message shows up.
     11
     12        * public/WebGraphicsContext3D.h:
     13        (WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback::~WebGraphicsContextLostCallback):
     14        * src/GraphicsContext3DChromium.cpp:
     15        (WebCore::GraphicsContextLostCallbackAdapter::~GraphicsContextLostCallbackAdapter):
     16        (WebCore::GraphicsContextLostCallbackAdapter::GraphicsContextLostCallbackAdapter):
     17        (WebCore::GraphicsContextLostCallbackAdapter::onContextLost):
     18        (WebCore::GraphicsContextLostCallbackAdapter::create):
     19        (WebCore::GraphicsContext3DInternal::setContextLostCallback):
     20        * src/GraphicsContext3DInternal.h:
     21
    1222011-02-07  Adam Klein  <adamk@chromium.org>
    223
  • trunk/Source/WebKit/chromium/public/WebGraphicsContext3D.h

    r76876 r77900  
    100100    public:
    101101        virtual void onContextLost() = 0;
     102        virtual ~WebGraphicsContextLostCallback() {}
    102103    };
    103104
  • trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp

    r77242 r77900  
    10831083DELEGATE_TO_INTERNAL_R(getExtensions, Extensions3D*)
    10841084
     1085DELEGATE_TO_INTERNAL_1(setContextLostCallback, PassOwnPtr<GraphicsContext3D::ContextLostCallback>)
     1086
     1087class GraphicsContextLostCallbackAdapter : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback {
     1088public:
     1089    virtual void onContextLost();
     1090    static PassOwnPtr<GraphicsContextLostCallbackAdapter> create(PassOwnPtr<GraphicsContext3D::ContextLostCallback>);
     1091    virtual ~GraphicsContextLostCallbackAdapter() {}
     1092private:
     1093    GraphicsContextLostCallbackAdapter(PassOwnPtr<GraphicsContext3D::ContextLostCallback> cb) : m_contextLostCallback(cb) {}
     1094    OwnPtr<GraphicsContext3D::ContextLostCallback> m_contextLostCallback;
     1095};
     1096
     1097void GraphicsContextLostCallbackAdapter::onContextLost()
     1098{
     1099    if (m_contextLostCallback)
     1100        m_contextLostCallback->onContextLost();
     1101}
     1102
     1103PassOwnPtr<GraphicsContextLostCallbackAdapter> GraphicsContextLostCallbackAdapter::create(PassOwnPtr<GraphicsContext3D::ContextLostCallback> cb)
     1104{
     1105    return adoptPtr(new GraphicsContextLostCallbackAdapter(cb));
     1106}
     1107
     1108void GraphicsContext3DInternal::setContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback> cb)
     1109{
     1110    m_contextLostCallbackAdapter = GraphicsContextLostCallbackAdapter::create(cb);
     1111    m_impl->setContextLostCallback(m_contextLostCallbackAdapter.get());
     1112}
     1113
    10851114bool GraphicsContext3D::isGLES2Compliant() const
    10861115{
  • trunk/Source/WebKit/chromium/src/GraphicsContext3DInternal.h

    r76717 r77900  
    4545class WebGLLayerChromium;
    4646#endif
     47class GraphicsContextLostCallbackAdapter;
    4748
    4849class GraphicsContext3DInternal {
     
    240241    void synthesizeGLError(GC3Denum error);
    241242
     243    void setContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback>);
     244
    242245    // Extensions3D support.
    243246    Extensions3D* getExtensions();
     
    266269    OwnPtr<WebKit::WebGraphicsContext3D> m_impl;
    267270    OwnPtr<Extensions3DChromium> m_extensions;
     271    OwnPtr<GraphicsContextLostCallbackAdapter> m_contextLostCallbackAdapter;
    268272    WebKit::WebViewImpl* m_webViewImpl;
    269273    bool m_initializedAvailableExtensions;
Note: See TracChangeset for help on using the changeset viewer.