Changeset 75271 in webkit


Ignore:
Timestamp:
Jan 7, 2011 1:41:37 PM (13 years ago)
Author:
enne@google.com
Message:

2011-01-05 Adrienne Walker <enne@google.com>

Reviewed by Kenneth Russell.

Add tests for WebGL's lost context events.
https://bugs.webkit.org/show_bug.cgi?id=51492

  • fast/canvas/webgl/context-lost-expected.txt: Added.
  • fast/canvas/webgl/context-lost-restored-expected.txt: Added.
  • fast/canvas/webgl/context-lost-restored.html: Added.
  • fast/canvas/webgl/context-lost.html: Added.

2011-01-05 Adrienne Walker <enne@google.com>

Reviewed by Kenneth Russell.

Add WEBKIT_lose_context WebGL extension.
https://bugs.webkit.org/show_bug.cgi?id=51492

Tests: fast/canvas/webgl/context-lost-restored.html

fast/canvas/webgl/context-lost.html

  • CMakeLists.txt:
  • DerivedSources.make:
  • GNUmakefile.am:
  • WebCore.gypi:
  • WebCore.pri:
  • WebCore.pro:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSWebGLRenderingContextCustom.cpp: (WebCore::toJS): (WebCore::JSWebGLRenderingContext::getSupportedExtensions):
  • bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: (WebCore::toV8Object): (WebCore::V8WebGLRenderingContext::getSupportedExtensionsCallback):
  • html/canvas/WebGLExtension.h:
  • html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::WebGLRenderingContextRestoreTimer::fired): (WebCore::WebGLRenderingContext::getExtension): (WebCore::WebGLRenderingContext::getSupportedExtensions): (WebCore::WebGLRenderingContext::forceLostContext): (WebCore::WebGLRenderingContext::onLostContext): (WebCore::WebGLRenderingContext::getNumberOfExtensions): (WebCore::WebGLRenderingContext::getExtensionNumber):
  • html/canvas/WebGLRenderingContext.h:
  • html/canvas/WebKitLoseContext.cpp: Copied from WebCore/html/canvas/WebGLExtension.h. (WebCore::WebKitLoseContext::WebKitLoseContext): (WebCore::WebKitLoseContext::~WebKitLoseContext): (WebCore::WebKitLoseContext::getName): (WebCore::WebKitLoseContext::create): (WebCore::WebKitLoseContext::loseContext):
  • html/canvas/WebKitLoseContext.h: Copied from WebCore/html/canvas/WebGLExtension.h.
  • html/canvas/WebKitLoseContext.idl: Copied from WebCore/html/canvas/WebGLExtension.h.
Location:
trunk
Files:
4 added
14 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r75263 r75271  
     12011-01-05  Adrienne Walker  <enne@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Add tests for WebGL's lost context events.
     6        https://bugs.webkit.org/show_bug.cgi?id=51492
     7
     8        * fast/canvas/webgl/context-lost-expected.txt: Added.
     9        * fast/canvas/webgl/context-lost-restored-expected.txt: Added.
     10        * fast/canvas/webgl/context-lost-restored.html: Added.
     11        * fast/canvas/webgl/context-lost.html: Added.
     12
    1132011-01-07  Stephen White  <senorblanco@chromium.org>
    214
  • trunk/WebCore/CMakeLists.txt

    r75169 r75271  
    304304    html/canvas/WebGLTexture.idl
    305305    html/canvas/WebGLUniformLocation.idl
     306    html/canvas/WebKitLoseContext.idl
    306307
    307308    inspector/InjectedScriptHost.idl
  • trunk/WebCore/ChangeLog

    r75270 r75271  
     12011-01-05  Adrienne Walker  <enne@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Add WEBKIT_lose_context WebGL extension.
     6        https://bugs.webkit.org/show_bug.cgi?id=51492
     7
     8        Tests: fast/canvas/webgl/context-lost-restored.html
     9               fast/canvas/webgl/context-lost.html
     10
     11        * CMakeLists.txt:
     12        * DerivedSources.make:
     13        * GNUmakefile.am:
     14        * WebCore.gypi:
     15        * WebCore.pri:
     16        * WebCore.pro:
     17        * WebCore.xcodeproj/project.pbxproj:
     18        * bindings/js/JSWebGLRenderingContextCustom.cpp:
     19        (WebCore::toJS):
     20        (WebCore::JSWebGLRenderingContext::getSupportedExtensions):
     21        * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
     22        (WebCore::toV8Object):
     23        (WebCore::V8WebGLRenderingContext::getSupportedExtensionsCallback):
     24        * html/canvas/WebGLExtension.h:
     25        * html/canvas/WebGLRenderingContext.cpp:
     26        (WebCore::WebGLRenderingContext::WebGLRenderingContextRestoreTimer::fired):
     27        (WebCore::WebGLRenderingContext::getExtension):
     28        (WebCore::WebGLRenderingContext::getSupportedExtensions):
     29        (WebCore::WebGLRenderingContext::forceLostContext):
     30        (WebCore::WebGLRenderingContext::onLostContext):
     31        (WebCore::WebGLRenderingContext::getNumberOfExtensions):
     32        (WebCore::WebGLRenderingContext::getExtensionNumber):
     33        * html/canvas/WebGLRenderingContext.h:
     34        * html/canvas/WebKitLoseContext.cpp: Copied from WebCore/html/canvas/WebGLExtension.h.
     35        (WebCore::WebKitLoseContext::WebKitLoseContext):
     36        (WebCore::WebKitLoseContext::~WebKitLoseContext):
     37        (WebCore::WebKitLoseContext::getName):
     38        (WebCore::WebKitLoseContext::create):
     39        (WebCore::WebKitLoseContext::loseContext):
     40        * html/canvas/WebKitLoseContext.h: Copied from WebCore/html/canvas/WebGLExtension.h.
     41        * html/canvas/WebKitLoseContext.idl: Copied from WebCore/html/canvas/WebGLExtension.h.
     42
    1432011-01-07  Chris Marrin  <cmarrin@apple.com>
    244
  • trunk/WebCore/DerivedSources.make

    r73806 r75271  
    509509    WebKitCSSMatrix \
    510510    WebKitCSSTransformValue \
     511    WebKitLoseContext \
    511512    WebKitPoint \
    512513    WebKitTransitionEvent \
  • trunk/WebCore/GNUmakefile.am

    r75209 r75271  
    595595        DerivedSources/WebCore/JSWebKitCSSTransformValue.cpp \
    596596        DerivedSources/WebCore/JSWebKitCSSTransformValue.h \
     597        DerivedSources/WebCore/JSWebKitLoseContext.cpp \
     598        DerivedSources/WebCore/JSWebKitLoseContext.h \
    597599        DerivedSources/WebCore/JSWebKitPoint.cpp \
    598600        DerivedSources/WebCore/JSWebKitPoint.h \
     
    15721574        WebCore/html/canvas/OESTextureFloat.cpp \
    15731575        WebCore/html/canvas/OESTextureFloat.h \
     1576        WebCore/html/canvas/WebKitLoseContext.cpp \
     1577        WebCore/html/canvas/WebKitLoseContext.h \
    15741578        WebCore/html/canvas/Uint16Array.cpp \
    15751579        WebCore/html/canvas/Uint16Array.h \
  • trunk/WebCore/WebCore.gypi

    r75169 r75271  
    229229            'html/canvas/WebGLTexture.idl',
    230230            'html/canvas/WebGLUniformLocation.idl',
     231            'html/canvas/WebKitLoseContext.idl',
    231232            'inspector/InjectedScriptHost.idl',
    232233            'inspector/InspectorFrontendHost.idl',
     
    19491950            'html/canvas/WebGLUniformLocation.cpp',
    19501951            'html/canvas/WebGLUniformLocation.h',
     1952            'html/canvas/WebKitLoseContext.cpp',
     1953            'html/canvas/WebKitLoseContext.h',
    19511954            'html/parser/CSSPreloadScanner.cpp',
    19521955            'html/parser/CSSPreloadScanner.h',
  • trunk/WebCore/WebCore.pri

    r74115 r75271  
    205205    html/canvas/WebGLTexture.idl \
    206206    html/canvas/WebGLUniformLocation.idl \
     207    html/canvas/WebKitLoseContext.idl \
    207208    html/canvas/Uint8Array.idl \
    208209    html/canvas/Uint32Array.idl \
  • trunk/WebCore/WebCore.pro

    r75169 r75271  
    37983798        html/canvas/WebGLTexture.h \
    37993799        html/canvas/WebGLUniformLocation.h \
     3800        html/canvas/WebKitLoseContext.h \
    38003801        platform/graphics/Extensions3D.h \
    38013802        platform/graphics/GraphicsContext3D.h \
     
    38213822        html/canvas/WebGLTexture.cpp \
    38223823        html/canvas/WebGLUniformLocation.cpp \
     3824        html/canvas/WebKitLoseContext.cpp \
    38233825        platform/graphics/GraphicsContext3D.cpp \
    38243826        platform/graphics/qt/Extensions3DQt.cpp \
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r75262 r75271  
    29602960                93F19B1608245E59001E9ABC /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8216299029F4FB501000131 /* JavaScriptCore.framework */; };
    29612961                93F19B1708245E59001E9ABC /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 93F1D31A0558CC5C00821BC0 /* libicucore.dylib */; };
     2962                93F1D5BA12D532C400832BEC /* WebKitLoseContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1D5B712D532C400832BEC /* WebKitLoseContext.cpp */; };
     2963                93F1D5BB12D532C400832BEC /* WebKitLoseContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F1D5B812D532C400832BEC /* WebKitLoseContext.h */; };
     2964                93F1D5C012D5335600832BEC /* JSWebKitLoseContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1D5BE12D5335600832BEC /* JSWebKitLoseContext.cpp */; };
     2965                93F1D5C112D5335600832BEC /* JSWebKitLoseContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F1D5BF12D5335600832BEC /* JSWebKitLoseContext.h */; };
    29622966                93F6F1ED127F70B10055CB06 /* WebGLContextEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F6F1EA127F70B10055CB06 /* WebGLContextEvent.cpp */; };
    29632967                93F6F1EE127F70B10055CB06 /* WebGLContextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F6F1EB127F70B10055CB06 /* WebGLContextEvent.h */; };
     
    79267930                6EBF0E7412A9868800DB1709 /* JSOESTextureFloat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOESTextureFloat.cpp; sourceTree = "<group>"; };
    79277931                6EBF0E7512A9868800DB1709 /* JSOESTextureFloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOESTextureFloat.h; sourceTree = "<group>"; };
     7932                93F1D5BE12D5335600832BEC /* JSWebKitLoseContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSWebKitLoseContext.cpp; path = JSWebKitLoseContext.cpp; sourceTree = "<group>"; };
     7933                93F1D5BF12D5335600832BEC /* JSWebKitLoseContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSWebKitLoseContext.h; path = JSWebKitLoseContext.h; sourceTree = "<group>"; };
    79287934                6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLContextAttributes.cpp; sourceTree = "<group>"; };
    79297935                6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLContextAttributes.h; sourceTree = "<group>"; };
     
    92969302                93F19B1A08245E5A001E9ABC /* WebCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WebCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
    92979303                93F1D31A0558CC5C00821BC0 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = /usr/lib/libicucore.dylib; sourceTree = "<absolute>"; };
     9304                93F1D5B712D532C400832BEC /* WebKitLoseContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebKitLoseContext.cpp; path = canvas/WebKitLoseContext.cpp; sourceTree = "<group>"; };
     9305                93F1D5B812D532C400832BEC /* WebKitLoseContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebKitLoseContext.h; path = canvas/WebKitLoseContext.h; sourceTree = "<group>"; };
     9306                93F1D5B912D532C400832BEC /* WebKitLoseContext.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebKitLoseContext.idl; path = canvas/WebKitLoseContext.idl; sourceTree = "<group>"; };
    92989307                93F6F1EA127F70B10055CB06 /* WebGLContextEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLContextEvent.cpp; path = canvas/WebGLContextEvent.cpp; sourceTree = "<group>"; };
    92999308                93F6F1EB127F70B10055CB06 /* WebGLContextEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLContextEvent.h; path = canvas/WebGLContextEvent.h; sourceTree = "<group>"; };
     
    1308913098                        isa = PBXGroup;
    1309013099                        children = (
     13100                                93F1D5B712D532C400832BEC /* WebKitLoseContext.cpp */,
     13101                                93F1D5B812D532C400832BEC /* WebKitLoseContext.h */,
     13102                                93F1D5B912D532C400832BEC /* WebKitLoseContext.idl */,
    1309113103                                49EECDCA10503C2300099FAB /* ArrayBuffer.cpp */,
    1309213104                                49EECDCB10503C2300099FAB /* ArrayBuffer.h */,
     
    1583215844                        isa = PBXGroup;
    1583315845                        children = (
     15846                                93F1D5BE12D5335600832BEC /* JSWebKitLoseContext.cpp */,
     15847                                93F1D5BF12D5335600832BEC /* JSWebKitLoseContext.h */,
    1583415848                                49EECEF2105070C400099FAB /* JSArrayBuffer.cpp */,
    1583515849                                49EECEF3105070C400099FAB /* JSArrayBuffer.h */,
     
    2227722291                                7EE6847012D26E3800E79415 /* ResourceResponse.h in Headers */,
    2227822292                                493E5E0912D6420500020081 /* PlatformCALayerClient.h in Headers */,
     22293                                93F1D5BB12D532C400832BEC /* WebKitLoseContext.h in Headers */,
     22294                                93F1D5C112D5335600832BEC /* JSWebKitLoseContext.h in Headers */,
    2227922295                        );
    2228022296                        runOnlyForDeploymentPostprocessing = 0;
     
    2495924975                                7EE6847112D26E3800E79415 /* ResourceResponseCFNet.cpp in Sources */,
    2496024976                                7EE6847512D26E7000E79415 /* ResourceLoaderCFNet.cpp in Sources */,
     24977                                93F1D5BA12D532C400832BEC /* WebKitLoseContext.cpp in Sources */,
     24978                                93F1D5C012D5335600832BEC /* JSWebKitLoseContext.cpp in Sources */,
    2496124979                        );
    2496224980                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp

    r73806 r75271  
    3030#include "JSWebGLRenderingContext.h"
    3131
     32#include "WebKitLoseContext.h"
    3233#include "ExceptionCode.h"
    3334#include "HTMLCanvasElement.h"
    3435#include "HTMLImageElement.h"
     36#include "JSWebKitLoseContext.h"
    3537#include "JSHTMLCanvasElement.h"
    3638#include "JSHTMLImageElement.h"
     
    170172        return jsNull();
    171173    switch (extension->getName()) {
     174    case WebGLExtension::WebKitLoseContextName:
     175        return toJS(exec, globalObject, static_cast<WebKitLoseContext*>(extension));
    172176    case WebGLExtension::OESTextureFloatName:
    173177        return toJS(exec, globalObject, static_cast<OESTextureFloat*>(extension));
     
    321325{
    322326    WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
     327    if (context->isContextLost())
     328        return jsNull();
    323329    Vector<String> value = context->getSupportedExtensions();
    324330    MarkedArgumentBuffer list;
  • trunk/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp

    r73806 r75271  
    3636
    3737#include "ExceptionCode.h"
    38 
    3938#include "NotImplemented.h"
    40 
    41 #include <wtf/FastMalloc.h>
    42 
     39#include "V8ArrayBufferView.h"
    4340#include "V8Binding.h"
    4441#include "V8BindingMacros.h"
    45 #include "V8ArrayBufferView.h"
    46 #include "V8WebGLBuffer.h"
    47 #include "V8Int8Array.h"
     42#include "V8WebKitLoseContext.h"
    4843#include "V8Float32Array.h"
    49 #include "V8WebGLFramebuffer.h"
    50 #include "V8Int32Array.h"
    51 #include "V8WebGLProgram.h"
    52 #include "V8WebGLRenderbuffer.h"
    53 #include "V8WebGLShader.h"
    54 #include "V8Int16Array.h"
    55 #include "V8WebGLTexture.h"
    56 #include "V8WebGLUniformLocation.h"
    57 #include "V8Uint8Array.h"
    58 #include "V8Uint32Array.h"
    59 #include "V8Uint16Array.h"
    6044#include "V8HTMLCanvasElement.h"
    6145#include "V8HTMLImageElement.h"
    6246#include "V8HTMLVideoElement.h"
    6347#include "V8ImageData.h"
     48#include "V8Int16Array.h"
     49#include "V8Int32Array.h"
     50#include "V8Int8Array.h"
    6451#include "V8OESTextureFloat.h"
    6552#include "V8Proxy.h"
     53#include "V8Uint16Array.h"
     54#include "V8Uint32Array.h"
     55#include "V8Uint8Array.h"
     56#include "V8WebGLBuffer.h"
     57#include "V8WebGLFramebuffer.h"
     58#include "V8WebGLProgram.h"
     59#include "V8WebGLRenderbuffer.h"
     60#include "V8WebGLShader.h"
     61#include "V8WebGLTexture.h"
     62#include "V8WebGLUniformLocation.h"
    6663#include "WebGLRenderingContext.h"
     64#include <wtf/FastMalloc.h>
    6765
    6866namespace WebCore {
     
    160158    v8::Handle<v8::Value> extensionObject;
    161159    switch (extension->getName()) {
     160    case WebGLExtension::WebKitLoseContextName:
     161        extensionObject = toV8(static_cast<WebKitLoseContext*>(extension));
     162        break;
    162163    case WebGLExtension::OESTextureFloatName:
    163164        extensionObject = toV8(static_cast<OESTextureFloat*>(extension));
     
    376377    INC_STATS("DOM.WebGLRenderingContext.getSupportedExtensionsCallback()");
    377378    WebGLRenderingContext* imp = V8WebGLRenderingContext::toNative(args.Holder());
     379    if (imp->isContextLost())
     380        return v8::Null();
     381
    378382    Vector<String> value = imp->getSupportedExtensions();
    379383    v8::Local<v8::Array> array = v8::Array::New(value.size());
  • trunk/WebCore/html/canvas/WebGLExtension.h

    r73806 r75271  
    3535    // Extension names are needed to properly wrap instances in JavaScript objects.
    3636    enum ExtensionName {
    37         OESTextureFloatName
     37        WebKitLoseContextName,
     38        OESTextureFloatName,
    3839    };
    3940
  • trunk/WebCore/html/canvas/WebGLRenderingContext.cpp

    r75254 r75271  
    3333#include "CanvasPixelArray.h"
    3434#include "CheckedInt.h"
     35#include "WebKitLoseContext.h"
    3536#include "Console.h"
    3637#include "DOMWindow.h"
     
    138139{
    139140    // Timer is started when m_contextLost is false.  It will first call
    140     // loseContext, which will set m_contextLost to true.  Then it will keep
     141    // onLostContext, which will set m_contextLost to true.  Then it will keep
    141142    // calling restoreContext and reschedule itself until m_contextLost is back
    142143    // to false.
    143144    if (!m_context->m_contextLost) {
    144         m_context->loseContext();
     145        m_context->onLostContext();
    145146        startOneShot(secondsBetweenRestoreAttempts);
    146147    } else {
     
    15741575WebGLExtension* WebGLRenderingContext::getExtension(const String& name)
    15751576{
     1577    if (isContextLost())
     1578        return 0;
     1579
    15761580    if (equalIgnoringCase(name, "OES_texture_float")
    15771581        && m_context->getExtensions()->supports("GL_OES_texture_float")) {
     
    15811585        }
    15821586        return m_oesTextureFloat.get();
     1587    } else if (equalIgnoringCase(name, "WEBKIT_lose_context")) {
     1588        if (!m_webkitLoseContext)
     1589            m_webkitLoseContext = WebKitLoseContext::create(this);
     1590        return m_webkitLoseContext.get();
    15831591    }
    15841592
     
    19861994    if (m_context->getExtensions()->supports("GL_OES_texture_float"))
    19871995        result.append("OES_texture_float");
     1996    result.append("WEBKIT_lose_context");
    19881997    return result;
    19891998}
     
    34593468}
    34603469
    3461 void WebGLRenderingContext::loseContext()
     3470void WebGLRenderingContext::forceLostContext()
     3471{
     3472    if (isContextLost()) {
     3473        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
     3474        return;
     3475    }
     3476
     3477    m_restoreTimer.startOneShot(0);
     3478}
     3479
     3480void WebGLRenderingContext::onLostContext()
    34623481{
    34633482    m_contextLost = true;
     
    43464365int WebGLRenderingContext::getNumberOfExtensions()
    43474366{
    4348     return (m_oesTextureFloat ? 1 : 0);
     4367    return (m_webkitLoseContext ? 1 : 0) + (m_oesTextureFloat ? 1 : 0);
    43494368}
    43504369
    43514370WebGLExtension* WebGLRenderingContext::getExtensionNumber(int i)
    43524371{
     4372    if (m_webkitLoseContext) {
     4373        if (!i)
     4374            return m_webkitLoseContext.get();
     4375        --i;
     4376    }
    43534377    if (m_oesTextureFloat) {
    43544378        if (!i)
  • trunk/WebCore/html/canvas/WebGLRenderingContext.h

    r75252 r75271  
    5252class WebGLTexture;
    5353class WebGLUniformLocation;
     54class WebKitLoseContext;
    5455class HTMLImageElement;
    5556class HTMLVideoElement;
     
    285286    void viewport(long x, long y, long width, long height);
    286287
    287     void loseContext();
     288    void forceLostContext();
     289    void onLostContext();
    288290    void restoreContext();
    289291
     
    469471    // Enabled extension objects.
    470472    RefPtr<OESTextureFloat> m_oesTextureFloat;
     473    RefPtr<WebKitLoseContext> m_webkitLoseContext;
    471474
    472475    // Helpers for getParameter and others
  • trunk/WebCore/html/canvas/WebKitLoseContext.cpp

    r75270 r75271  
    2424 */
    2525
    26 #ifndef WebGLExtension_h
    27 #define WebGLExtension_h
     26#include "config.h"
    2827
    29 #include <wtf/RefCounted.h>
     28#if ENABLE(3D_CANVAS)
     29
     30#include "WebKitLoseContext.h"
     31
     32#include "WebGLRenderingContext.h"
    3033
    3134namespace WebCore {
    3235
    33 class WebGLExtension : public RefCounted<WebGLExtension> {
    34 public:
    35     // Extension names are needed to properly wrap instances in JavaScript objects.
    36     enum ExtensionName {
    37         OESTextureFloatName
    38     };
     36WebKitLoseContext::WebKitLoseContext(WebGLRenderingContext* context)
     37    : WebGLExtension()
     38    , m_context(context)
     39{
     40}
    3941
    40     virtual ~WebGLExtension();
    41     virtual ExtensionName getName() const = 0;
     42WebKitLoseContext::~WebKitLoseContext()
     43{
     44}
    4245
    43 protected:
    44     WebGLExtension();
    45 };
     46WebGLExtension::ExtensionName WebKitLoseContext::getName() const
     47{
     48    return WebKitLoseContextName;
     49}
     50
     51PassRefPtr<WebKitLoseContext> WebKitLoseContext::create(WebGLRenderingContext* context)
     52{
     53    return adoptRef(new WebKitLoseContext(context));
     54}
     55
     56void WebKitLoseContext::loseContext()
     57{
     58    m_context->forceLostContext();
     59}
    4660
    4761} // namespace WebCore
    4862
    49 #endif // WebGLExtension_h
     63#endif // ENABLE(3D_CANVAS)
  • trunk/WebCore/html/canvas/WebKitLoseContext.h

    r75270 r75271  
    2424 */
    2525
    26 #ifndef WebGLExtension_h
    27 #define WebGLExtension_h
     26#ifndef WebKitLoseContext_h
     27#define WebKitLoseContext_h
    2828
     29#include "WebGLExtension.h"
     30#include <wtf/PassRefPtr.h>
    2931#include <wtf/RefCounted.h>
    3032
    3133namespace WebCore {
    3234
    33 class WebGLExtension : public RefCounted<WebGLExtension> {
     35class WebGLRenderingContext;
     36
     37class WebKitLoseContext : public WebGLExtension {
    3438public:
    35     // Extension names are needed to properly wrap instances in JavaScript objects.
    36     enum ExtensionName {
    37         OESTextureFloatName
    38     };
     39    static PassRefPtr<WebKitLoseContext> create(WebGLRenderingContext*);
    3940
    40     virtual ~WebGLExtension();
    41     virtual ExtensionName getName() const = 0;
     41    virtual ~WebKitLoseContext();
     42    virtual ExtensionName getName() const;
    4243
    43 protected:
    44     WebGLExtension();
     44    void loseContext();
     45
     46private:
     47    WebKitLoseContext(WebGLRenderingContext*);
     48
     49    WebGLRenderingContext* m_context;
    4550};
    4651
    4752} // namespace WebCore
    4853
    49 #endif // WebGLExtension_h
     54#endif // WebKitLoseContext_h
  • trunk/WebCore/html/canvas/WebKitLoseContext.idl

    r75270 r75271  
    2424 */
    2525
    26 #ifndef WebGLExtension_h
    27 #define WebGLExtension_h
    28 
    29 #include <wtf/RefCounted.h>
    30 
    31 namespace WebCore {
    32 
    33 class WebGLExtension : public RefCounted<WebGLExtension> {
    34 public:
    35     // Extension names are needed to properly wrap instances in JavaScript objects.
    36     enum ExtensionName {
    37         OESTextureFloatName
     26module html {
     27    interface [Conditional=3D_CANVAS, OmitConstructor] WebKitLoseContext {
     28        [StrictTypeChecking] void loseContext();
    3829    };
    39 
    40     virtual ~WebGLExtension();
    41     virtual ExtensionName getName() const = 0;
    42 
    43 protected:
    44     WebGLExtension();
    45 };
    46 
    47 } // namespace WebCore
    48 
    49 #endif // WebGLExtension_h
     30}
Note: See TracChangeset for help on using the changeset viewer.