[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

kbr at google.com kbr at google.com
Wed Dec 22 15:27:15 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit fd3feecc07b994a2106636593d306d927dddce61
Author: kbr at google.com <kbr at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 3 21:48:04 2010 +0000

    2010-11-03  Kenneth Russell  <kbr at google.com>
    
            Reviewed by Chris Marrin.
    
            Redesign extension mechanism in GraphicsContext3D
            https://bugs.webkit.org/show_bug.cgi?id=46894
    
            * JavaScriptCore.exp:
             - Exposed String::split(const String&, Vector<String>).
    2010-11-03  Kenneth Russell  <kbr at google.com>
    
            Reviewed by Chris Marrin.
    
            Redesign extension mechanism in GraphicsContext3D
            https://bugs.webkit.org/show_bug.cgi?id=46894
    
            Upon request, factored out extension support from GraphicsContext3D
            into a new Extensions3D class. (The plural was chosen because the
            class and subclasses hold multiple extensions.)
    
            Unlike GraphicsContext3D, Extensions3D contains only pure virtual
            methods. This was done because Extensions3D's inheritance diagram
            and usage pattern is very different from that of GraphicsContext3D,
            and the concrete subclasses need to decide how to implement the
            various entry points. Requiring them to be placed at the
            Extensions3D level will cause implementation details to leak into
            the base class, which is highly undesirable. Any virtual call
            overhead to these entry points will be negligible.
    
            Changed call sites utilizing these extensions to call through the
            Extensions3D object or its subclasses.
    
            Tested:
             - Chromium on Linux with accelerated 2D canvas and HTML5 video
             - Chromium on Mac OS X with WebGL and CSS 3D content
             - Safari on Mac OS X with WebGL and CSS 3D content
    
            No new tests. Covered by existing tests.
    
            * WebKit.gyp:
            * public/WebGraphicsContext3D.h:
            * src/Extensions3DChromium.cpp: Added.
            (WebCore::Extensions3DChromium::Extensions3DChromium):
            (WebCore::Extensions3DChromium::~Extensions3DChromium):
            (WebCore::Extensions3DChromium::supports):
            (WebCore::Extensions3DChromium::getGraphicsResetStatusARB):
            (WebCore::Extensions3DChromium::mapBufferSubDataCHROMIUM):
            (WebCore::Extensions3DChromium::unmapBufferSubDataCHROMIUM):
            (WebCore::Extensions3DChromium::mapTexSubImage2DCHROMIUM):
            (WebCore::Extensions3DChromium::unmapTexSubImage2DCHROMIUM):
            (WebCore::Extensions3DChromium::copyTextureToParentTextureCHROMIUM):
            * src/GraphicsContext3DChromium.cpp:
            (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
            (WebCore::GraphicsContext3DInternal::getExtensions):
            (WebCore::GraphicsContext3DInternal::supportsExtension):
            * src/GraphicsContext3DInternal.h:
            * src/WebGraphicsContext3DDefaultImpl.cpp:
            (WebKit::WebGraphicsContext3DDefaultImpl::copyTextureToParentTextureCHROMIUM):
            (WebKit::WebGraphicsContext3DDefaultImpl::getString):
            * src/WebGraphicsContext3DDefaultImpl.h:
            * src/WebViewImpl.cpp:
            (WebKit::WebViewImpl::composite):
    2010-11-03  Kenneth Russell  <kbr at google.com>
    
            Reviewed by Chris Marrin.
    
            Redesign extension mechanism in GraphicsContext3D
            https://bugs.webkit.org/show_bug.cgi?id=46894
    
            Upon request, factored out extension support from GraphicsContext3D
            into a new Extensions3D class. (The plural was chosen because the
            class and subclasses hold multiple extensions.)
    
            Unlike GraphicsContext3D, Extensions3D contains only pure virtual
            methods. This was done because Extensions3D's inheritance diagram
            and usage pattern is very different from that of GraphicsContext3D,
            and the concrete subclasses need to decide how to implement the
            various entry points. Requiring them to be placed at the
            Extensions3D level will cause implementation details to leak into
            the base class, which is highly undesirable. Any virtual call
            overhead to these entry points will be negligible.
    
            Changed call sites utilizing these extensions to call through the
            Extensions3D object or its subclasses.
    
            Tested:
             - Chromium on Linux with accelerated 2D canvas and HTML5 video
             - Chromium on Mac OS X with WebGL and CSS 3D content
             - Safari on Mac OS X with WebGL and CSS 3D content
    
            No new tests. Covered by existing tests.
    
            * WebCore.gypi:
            * WebCore.pro:
            * WebCore.xcodeproj/project.pbxproj:
            * platform/graphics/Extensions3D.h: Added.
            (WebCore::Extensions3D::~Extensions3D):
            * platform/graphics/GraphicsContext3D.cpp:
            * platform/graphics/GraphicsContext3D.h:
            * platform/graphics/chromium/DrawingBufferChromium.cpp:
            (WebCore::DrawingBuffer::DrawingBuffer):
            (WebCore::DrawingBuffer::publishToPlatformLayer):
            * platform/graphics/chromium/Extensions3DChromium.h: Added.
            * platform/graphics/chromium/VideoLayerChromium.cpp:
            (WebCore::VideoLayerChromium::updateTexture):
            * platform/graphics/gpu/SharedGraphicsContext3D.cpp:
            (WebCore::SharedGraphicsContext3D::supportsBGRA):
            * platform/graphics/gpu/SharedGraphicsContext3D.h:
            * platform/graphics/gpu/Texture.cpp:
            (WebCore::convertFormat):
            * platform/graphics/mac/GraphicsContext3DMac.mm:
            * platform/graphics/opengl/Extensions3DOpenGL.cpp: Added.
            (WebCore::Extensions3DOpenGL::Extensions3DOpenGL):
            (WebCore::Extensions3DOpenGL::~Extensions3DOpenGL):
            (WebCore::Extensions3DOpenGL::supports):
            (WebCore::Extensions3DOpenGL::getGraphicsResetStatusARB):
            * platform/graphics/opengl/Extensions3DOpenGL.h: Added.
            * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
            (WebCore::GraphicsContext3D::getExtensions):
            * platform/graphics/qt/Extensions3DQt.cpp: Added.
            (WebCore::Extensions3DQt::Extensions3DQt):
            (WebCore::Extensions3DQt::~Extensions3DQt):
            (WebCore::Extensions3DQt::supports):
            (WebCore::Extensions3DQt::getGraphicsResetStatusARB):
            * platform/graphics/qt/Extensions3DQt.h: Added.
            * platform/graphics/qt/GraphicsContext3DQt.cpp:
            (WebCore::GraphicsContext3D::getExtensions):
            * platform/graphics/skia/PlatformContextSkia.cpp:
            (WebCore::PlatformContextSkia::readbackHardwareToSoftware):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71272 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index d5e6f84..ae3c410 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-03  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Chris Marrin.
+
+        Redesign extension mechanism in GraphicsContext3D
+        https://bugs.webkit.org/show_bug.cgi?id=46894
+
+        * JavaScriptCore.exp:
+         - Exposed String::split(const String&, Vector<String>).
+
 2010-11-03  Adam Roben  <aroben at apple.com>
 
         Bring WTF.vcproj up to date
diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp
index 6ef8ead..3715a43 100644
--- a/JavaScriptCore/JavaScriptCore.exp
+++ b/JavaScriptCore/JavaScriptCore.exp
@@ -563,6 +563,7 @@ __ZNK3WTF6String19characterStartingAtEj
 __ZNK3WTF6String4utf8Eb
 __ZNK3WTF6String5asciiEv
 __ZNK3WTF6String5lowerEv
+__ZNK3WTF6String5splitERKS0_RNS_6VectorIS0_Lm0EEE
 __ZNK3WTF6String5splitERKS0_bRNS_6VectorIS0_Lm0EEE
 __ZNK3WTF6String5splitEtRNS_6VectorIS0_Lm0EEE
 __ZNK3WTF6String5splitEtbRNS_6VectorIS0_Lm0EEE
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3728bac..e87a8e9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,71 @@
+2010-11-03  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Chris Marrin.
+
+        Redesign extension mechanism in GraphicsContext3D
+        https://bugs.webkit.org/show_bug.cgi?id=46894
+
+        Upon request, factored out extension support from GraphicsContext3D
+        into a new Extensions3D class. (The plural was chosen because the
+        class and subclasses hold multiple extensions.)
+
+        Unlike GraphicsContext3D, Extensions3D contains only pure virtual
+        methods. This was done because Extensions3D's inheritance diagram
+        and usage pattern is very different from that of GraphicsContext3D,
+        and the concrete subclasses need to decide how to implement the
+        various entry points. Requiring them to be placed at the
+        Extensions3D level will cause implementation details to leak into
+        the base class, which is highly undesirable. Any virtual call
+        overhead to these entry points will be negligible.
+
+        Changed call sites utilizing these extensions to call through the
+        Extensions3D object or its subclasses.
+
+        Tested:
+         - Chromium on Linux with accelerated 2D canvas and HTML5 video
+         - Chromium on Mac OS X with WebGL and CSS 3D content
+         - Safari on Mac OS X with WebGL and CSS 3D content
+
+        No new tests. Covered by existing tests.
+
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/Extensions3D.h: Added.
+        (WebCore::Extensions3D::~Extensions3D):
+        * platform/graphics/GraphicsContext3D.cpp:
+        * platform/graphics/GraphicsContext3D.h:
+        * platform/graphics/chromium/DrawingBufferChromium.cpp:
+        (WebCore::DrawingBuffer::DrawingBuffer):
+        (WebCore::DrawingBuffer::publishToPlatformLayer):
+        * platform/graphics/chromium/Extensions3DChromium.h: Added.
+        * platform/graphics/chromium/VideoLayerChromium.cpp:
+        (WebCore::VideoLayerChromium::updateTexture):
+        * platform/graphics/gpu/SharedGraphicsContext3D.cpp:
+        (WebCore::SharedGraphicsContext3D::supportsBGRA):
+        * platform/graphics/gpu/SharedGraphicsContext3D.h:
+        * platform/graphics/gpu/Texture.cpp:
+        (WebCore::convertFormat):
+        * platform/graphics/mac/GraphicsContext3DMac.mm:
+        * platform/graphics/opengl/Extensions3DOpenGL.cpp: Added.
+        (WebCore::Extensions3DOpenGL::Extensions3DOpenGL):
+        (WebCore::Extensions3DOpenGL::~Extensions3DOpenGL):
+        (WebCore::Extensions3DOpenGL::supports):
+        (WebCore::Extensions3DOpenGL::getGraphicsResetStatusARB):
+        * platform/graphics/opengl/Extensions3DOpenGL.h: Added.
+        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
+        (WebCore::GraphicsContext3D::getExtensions):
+        * platform/graphics/qt/Extensions3DQt.cpp: Added.
+        (WebCore::Extensions3DQt::Extensions3DQt):
+        (WebCore::Extensions3DQt::~Extensions3DQt):
+        (WebCore::Extensions3DQt::supports):
+        (WebCore::Extensions3DQt::getGraphicsResetStatusARB):
+        * platform/graphics/qt/Extensions3DQt.h: Added.
+        * platform/graphics/qt/GraphicsContext3DQt.cpp:
+        (WebCore::GraphicsContext3D::getExtensions):
+        * platform/graphics/skia/PlatformContextSkia.cpp:
+        (WebCore::PlatformContextSkia::readbackHardwareToSoftware):
+
 2010-11-03  Mike Thole  <mthole at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index f09575a..4e32133 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -2423,6 +2423,7 @@
             'platform/graphics/chromium/CanvasLayerChromium.cpp',
             'platform/graphics/chromium/CanvasLayerChromium.h',
             'platform/graphics/chromium/DrawingBufferChromium.cpp',
+            'platform/graphics/chromium/Extensions3DChromium.h',
             'platform/graphics/chromium/ContentLayerChromium.cpp',
             'platform/graphics/chromium/ContentLayerChromium.h',
             'platform/graphics/chromium/CrossProcessFontLoading.h',
@@ -2740,6 +2741,7 @@
             'platform/graphics/Color.cpp',
             'platform/graphics/Color.h',
             'platform/graphics/DashArray.h',
+            'platform/graphics/Extensions3D.h',
             'platform/graphics/FloatPoint.cpp',
             'platform/graphics/FloatPoint.h',
             'platform/graphics/FloatPoint3D.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 4a7613d..392380d 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -3677,7 +3677,9 @@ HEADERS += \
         html/canvas/Uint8Array.h \
         html/canvas/Uint32Array.h \
         html/canvas/Uint16Array.h \
-        platform/graphics/GraphicsContext3D.h
+        platform/graphics/Extensions3D.h \
+        platform/graphics/GraphicsContext3D.h \
+        platform/graphics/qt/Extensions3DQt.h
 
     !v8 {
         SOURCES += \
@@ -3715,6 +3717,7 @@ SOURCES += \
         html/canvas/Uint32Array.cpp \
         html/canvas/Uint16Array.cpp \
         platform/graphics/GraphicsContext3D.cpp \
+        platform/graphics/qt/Extensions3DQt.cpp \
         platform/graphics/qt/GraphicsContext3DQt.cpp
 
 }
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 4659d17..5eef5a2 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1480,6 +1480,9 @@
 		6E4E91AD10F7FB3100A2779C /* CanvasContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E4E91A810F7FB3100A2779C /* CanvasContextAttributes.h */; };
 		6E4E91AE10F7FB3100A2779C /* WebGLContextAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E4E91A910F7FB3100A2779C /* WebGLContextAttributes.cpp */; };
 		6E4E91AF10F7FB3100A2779C /* WebGLContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E4E91AA10F7FB3100A2779C /* WebGLContextAttributes.h */; };
+		6E67D2A61280E8A4008758F7 /* Extensions3DOpenGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E67D2A41280E8A4008758F7 /* Extensions3DOpenGL.cpp */; };
+		6E67D2A71280E8A4008758F7 /* Extensions3DOpenGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E67D2A51280E8A4008758F7 /* Extensions3DOpenGL.h */; };
+		6E67D2A91280E8BD008758F7 /* Extensions3D.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E67D2A81280E8BD008758F7 /* Extensions3D.h */; };
 		6E96BB1C11986EE2007D94CD /* IntegralTypedArrayBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E96BB1A11986EE1007D94CD /* IntegralTypedArrayBase.h */; };
 		6E96BB1D11986EE2007D94CD /* TypedArrayBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E96BB1B11986EE1007D94CD /* TypedArrayBase.h */; };
 		6EE8A77210F803F3005A4A24 /* JSWebGLContextAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */; };
@@ -7620,6 +7623,9 @@
 		6E4E91A910F7FB3100A2779C /* WebGLContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLContextAttributes.cpp; path = canvas/WebGLContextAttributes.cpp; sourceTree = "<group>"; };
 		6E4E91AA10F7FB3100A2779C /* WebGLContextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLContextAttributes.h; path = canvas/WebGLContextAttributes.h; sourceTree = "<group>"; };
 		6E4E91AB10F7FB3100A2779C /* WebGLContextAttributes.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLContextAttributes.idl; path = canvas/WebGLContextAttributes.idl; sourceTree = "<group>"; };
+		6E67D2A41280E8A4008758F7 /* Extensions3DOpenGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Extensions3DOpenGL.cpp; sourceTree = "<group>"; };
+		6E67D2A51280E8A4008758F7 /* Extensions3DOpenGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Extensions3DOpenGL.h; sourceTree = "<group>"; };
+		6E67D2A81280E8BD008758F7 /* Extensions3D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Extensions3D.h; sourceTree = "<group>"; };
 		6E96BB1A11986EE1007D94CD /* IntegralTypedArrayBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IntegralTypedArrayBase.h; path = canvas/IntegralTypedArrayBase.h; sourceTree = "<group>"; };
 		6E96BB1B11986EE1007D94CD /* TypedArrayBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TypedArrayBase.h; path = canvas/TypedArrayBase.h; sourceTree = "<group>"; };
 		6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLContextAttributes.cpp; sourceTree = "<group>"; };
@@ -16571,6 +16577,7 @@
 		B2A015910AF6CD53006BCE0E /* graphics */ = {
 			isa = PBXGroup;
 			children = (
+				6E67D2A81280E8BD008758F7 /* Extensions3D.h */,
 				B27535290B053814002CE64F /* cg */,
 				B5320D68122A24E9002D1440 /* cocoa */,
 				A75E8B7F0E1DE2B0007F2481 /* filters */,
@@ -18395,6 +18402,8 @@
 		FBC220DD1237FBEB00BCF788 /* opengl */ = {
 			isa = PBXGroup;
 			children = (
+				6E67D2A41280E8A4008758F7 /* Extensions3DOpenGL.cpp */,
+				6E67D2A51280E8A4008758F7 /* Extensions3DOpenGL.h */,
 				FBC220DE1237FBEB00BCF788 /* GraphicsContext3DOpenGL.cpp */,
 			);
 			path = opengl;
@@ -21265,6 +21274,8 @@
 				93F199ED08245E59001E9ABC /* XSLTProcessor.h in Headers */,
 				E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
 				97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
+				6E67D2A71280E8A4008758F7 /* Extensions3DOpenGL.h in Headers */,
+				6E67D2A91280E8BD008758F7 /* Extensions3D.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -21324,7 +21335,6 @@
 			isa = PBXProject;
 			buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
 			compatibilityVersion = "Xcode 2.4";
-			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				English,
@@ -23828,6 +23838,7 @@
 				93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */,
 				E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
 				97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
+				6E67D2A61280E8A4008758F7 /* Extensions3DOpenGL.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebCore/platform/graphics/Extensions3D.h b/WebCore/platform/graphics/Extensions3D.h
new file mode 100644
index 0000000..9b0c211
--- /dev/null
+++ b/WebCore/platform/graphics/Extensions3D.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Extensions3D_h
+#define Extensions3D_h
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+// This is a base class containing only pure virtual functions.
+// Implementations must provide a subclass.
+//
+// The supported extensions are defined below and in subclasses,
+// possibly platform-specific ones.
+//
+// Calling any extension function not supported by the current context
+// must be a no-op; in particular, it may not have side effects. In
+// this situation, if the function has a return value, 0 is returned.
+class Extensions3D {
+public:
+    virtual ~Extensions3D() {}
+
+    // Supported extensions:
+    //   GL_EXT_texture_format_BGRA8888
+    //   GL_EXT_read_format_bgra
+    //   GL_ARB_robustness
+
+    // Takes full name of extension; for example,
+    // "GL_EXT_texture_format_BGRA8888".
+    virtual bool supports(const String&) = 0;
+
+    enum {
+        // GL_EXT_texture_format_BGRA8888 enums
+        BGRA_EXT = 0x80E1,
+
+        // GL_ARB_robustness enums
+        GUILTY_CONTEXT_RESET_ARB = 0x8253,
+        INNOCENT_CONTEXT_RESET_ARB = 0x8254,
+        UNKNOWN_CONTEXT_RESET_ARB = 0x8255
+    };
+
+    // GL_ARB_robustness
+    virtual int getGraphicsResetStatusARB() = 0;
+};
+
+} // namespace WebCore
+
+#endif // Extensions3D_h
diff --git a/WebCore/platform/graphics/GraphicsContext3D.cpp b/WebCore/platform/graphics/GraphicsContext3D.cpp
index 8b92376..061c87e 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.cpp
+++ b/WebCore/platform/graphics/GraphicsContext3D.cpp
@@ -1088,55 +1088,6 @@ bool GraphicsContext3D::packPixels(const uint8_t* sourceData,
     return true;
 }
 
-#if !PLATFORM(CHROMIUM)
-bool GraphicsContext3D::supportsBGRA()
-{
-    // For OpenGL ES2.0, this requires checking for
-    // GL_EXT_texture_format_BGRA8888 and GL_EXT_read_format_bgra.
-    // For desktop GL, BGRA has been supported since OpenGL 1.2.
-
-    // However, note that the GL ES2 extension requires the internalFormat to
-    // glTexImage2D() be GL_BGRA, while desktop GL will not accept GL_BGRA
-    // (must be GL_RGBA), so this must be checked on each platform.
-    // Returning false for now to be safe.
-    return false;
-}
-
-bool GraphicsContext3D::supportsMapSubCHROMIUM()
-{
-    // We don't claim support for this extension at this time.
-    return false;
-}
-
-void* GraphicsContext3D::mapBufferSubDataCHROMIUM(unsigned, int, int, unsigned)
-{
-    return 0;
-}
-
-void GraphicsContext3D::unmapBufferSubDataCHROMIUM(const void*)
-{
-}
-
-void* GraphicsContext3D::mapTexSubImage2DCHROMIUM(unsigned, int, int, int, int, int, unsigned, unsigned, unsigned)
-{
-    return 0;
-}
-
-void GraphicsContext3D::unmapTexSubImage2DCHROMIUM(const void*)
-{
-}
-
-bool GraphicsContext3D::supportsCopyTextureToParentTextureCHROMIUM()
-{
-    // We don't claim support for this extension at this time.
-    return false;
-}
-
-void GraphicsContext3D::copyTextureToParentTextureCHROMIUM(unsigned, unsigned)
-{
-}
-#endif
-
 } // namespace WebCore
 
 #endif // ENABLE(3D_CANVAS)
diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h
index 5074bbf..a30123d 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/WebCore/platform/graphics/GraphicsContext3D.h
@@ -76,6 +76,10 @@ const Platform3DObject NullPlatform3DObject = 0;
 namespace WebCore {
 class CanvasRenderingContext;
 class DrawingBuffer;
+class Extensions3D;
+#if PLATFORM(MAC)
+class Extensions3DOpenGL;
+#endif
 class HostWindow;
 class Image;
 class ImageData;
@@ -401,19 +405,6 @@ public:
         // WebGL-specific enums
         UNPACK_FLIP_Y_WEBGL = 0x9240,
         UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241,
-
-        // GL_EXT_texture_format_BGRA8888
-        BGRA_EXT = 0x80E1,
-
-        // GL_CHROMIUM_map_sub (enums inherited from GL_ARB_vertex_buffer_object)
-        READ_ONLY = 0x88B8,
-        WRITE_ONLY = 0x88B9,
-
-        // GL_ARB_robustness enums
-        GUILTY_CONTEXT_RESET_ARB = 0x8253,
-        INNOCENT_CONTEXT_RESET_ARB = 0x8254,
-        UNKNOWN_CONTEXT_RESET_ARB = 0x8255
-
     };
 
     // Context creation attributes.
@@ -786,22 +777,11 @@ public:
     // getError in the order they were added.
     void synthesizeGLError(unsigned long error);
 
-    // EXT_texture_format_BGRA8888
-    bool supportsBGRA();
-
-    // GL_CHROMIUM_map_sub
-    bool supportsMapSubCHROMIUM();
-    void* mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access);
-    void unmapBufferSubDataCHROMIUM(const void*);
-    void* mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access);
-    void unmapTexSubImage2DCHROMIUM(const void*);
-
-    // GL_CHROMIUM_copy_texture_to_parent_texture
-    bool supportsCopyTextureToParentTextureCHROMIUM();
-    void copyTextureToParentTextureCHROMIUM(unsigned texture, unsigned parentTexture);
-
-    // GL_ARB_robustness
-    int getGraphicsResetStatusARB();
+    // Support for extensions. Returns a non-null object, though not
+    // all methods it contains may necessarily be supported on the
+    // current hardware. Must call Extensions3D::supports() to
+    // determine this.
+    Extensions3D* getExtensions();
 
   private:
     GraphicsContext3D(Attributes attrs, HostWindow* hostWindow, bool renderDirectlyToHostWindow);
@@ -872,6 +852,8 @@ public:
 
     ANGLEWebKitBridge m_compiler;
 
+    OwnPtr<Extensions3DOpenGL> m_extensions;
+
     Attributes m_attrs;
     Vector<Vector<float> > m_vertexArray;
 
diff --git a/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp b/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
index b54a427..e44ec9d 100644
--- a/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
+++ b/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
@@ -32,6 +32,7 @@
 
 #include "DrawingBuffer.h"
 
+#include "Extensions3DChromium.h"
 #include "GraphicsContext3D.h"
 #include "SharedGraphicsContext3D.h"
 
@@ -69,9 +70,14 @@ static unsigned generateColorTexture(GraphicsContext3D* context, const IntSize&
 DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, const IntSize& size)
     : m_context(context)
     , m_size(size)
-    , m_fbo(context->createFramebuffer())
+    , m_fbo(0)
     , m_internal(new DrawingBufferInternal)
 {
+    if (!m_context->getExtensions()->supports("GL_CHROMIUM_copy_texture_to_parent_texture")) {
+        m_context.clear();
+        return;
+    }
+    m_fbo = context->createFramebuffer();
     context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
     m_internal->offscreenColorTexture = generateColorTexture(context, size);
 }
@@ -107,7 +113,7 @@ void DrawingBuffer::publishToPlatformLayer()
     // happens before the compositor draws.  This means we might draw stale frames sometimes.  Ideally this
     // would insert a fence into the child command stream that the compositor could wait for.
     m_context->makeContextCurrent();
-    m_context->copyTextureToParentTextureCHROMIUM(m_internal->offscreenColorTexture, parentTexture);
+    static_cast<Extensions3DChromium*>(m_context->getExtensions())->copyTextureToParentTextureCHROMIUM(m_internal->offscreenColorTexture, parentTexture);
     m_context->flush();
 }
 #endif
diff --git a/WebCore/platform/graphics/chromium/Extensions3DChromium.h b/WebCore/platform/graphics/chromium/Extensions3DChromium.h
new file mode 100644
index 0000000..0fd1fff
--- /dev/null
+++ b/WebCore/platform/graphics/chromium/Extensions3DChromium.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Extensions3DChromium_h
+#define Extensions3DChromium_h
+
+#include "Extensions3D.h"
+
+namespace WebCore {
+
+class GraphicsContext3DInternal;
+
+class Extensions3DChromium : public Extensions3D {
+public:
+    virtual ~Extensions3DChromium();
+
+    // Extensions3D methods.
+    virtual bool supports(const String&);
+    virtual int getGraphicsResetStatusARB();
+
+    enum {
+        // GL_CHROMIUM_map_sub (enums inherited from GL_ARB_vertex_buffer_object)
+        READ_ONLY = 0x88B8,
+        WRITE_ONLY = 0x88B9
+    };
+
+    // GL_CHROMIUM_map_sub
+    void* mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access);
+    void unmapBufferSubDataCHROMIUM(const void*);
+    void* mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access);
+    void unmapTexSubImage2DCHROMIUM(const void*);
+
+    // GL_CHROMIUM_copy_texture_to_parent_texture
+    void copyTextureToParentTextureCHROMIUM(unsigned texture, unsigned parentTexture);
+
+private:
+    // Instances of this class are strictly owned by the GraphicsContext3D implementation and do not
+    // need to be instantiated by any other code.
+    friend class GraphicsContext3DInternal;
+    explicit Extensions3DChromium(GraphicsContext3DInternal*);
+
+    // Weak pointer back to GraphicsContext3DInternal
+    GraphicsContext3DInternal* m_internal;
+};
+
+} // namespace WebCore
+
+#endif // Extensions3DChromium_h
diff --git a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
index 46c73a1..fa6c2c8 100644
--- a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
@@ -33,6 +33,7 @@
 #if USE(ACCELERATED_COMPOSITING)
 #include "VideoLayerChromium.h"
 
+#include "Extensions3DChromium.h"
 #include "GraphicsContext3D.h"
 #include "LayerRendererChromium.h"
 #include "RenderLayerBacking.h"
@@ -302,10 +303,10 @@ void VideoLayerChromium::updateTexture(GraphicsContext3D* context, unsigned text
 {
     ASSERT(context);
     GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId));
-    void* mem = context->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, dimensions.width(), dimensions.height(), format, GraphicsContext3D::UNSIGNED_BYTE, GraphicsContext3D::WRITE_ONLY);
+    void* mem = static_cast<Extensions3DChromium*>(context->getExtensions())->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, dimensions.width(), dimensions.height(), format, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY);
     if (mem) {
         memcpy(mem, data, dimensions.width() * dimensions.height());
-        GLC(context, context->unmapTexSubImage2DCHROMIUM(mem));
+        GLC(context, static_cast<Extensions3DChromium*>(context->getExtensions())->unmapTexSubImage2DCHROMIUM(mem));
     } else {
         // FIXME: We should have some sort of code to handle the case when
         // mapTexSubImage2D fails.
diff --git a/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp b/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp
index 87a0b69..bf29059 100644
--- a/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp
+++ b/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp
@@ -36,6 +36,7 @@
 
 #include "AffineTransform.h"
 #include "Color.h"
+#include "Extensions3D.h"
 #include "FloatRect.h"
 #include "GraphicsContext3D.h"
 #include "GraphicsTypes.h"
@@ -178,18 +179,8 @@ void SharedGraphicsContext3D::readPixels(long x, long y, unsigned long width, un
 
 bool SharedGraphicsContext3D::supportsBGRA()
 {
-    return m_context->supportsBGRA();
-}
-
-bool SharedGraphicsContext3D::supportsCopyTextureToParentTextureCHROMIUM()
-
-{
-    return m_context->supportsCopyTextureToParentTextureCHROMIUM();
-}
-
-void SharedGraphicsContext3D::copyTextureToParentTextureCHROMIUM(unsigned texture, unsigned parentTexture)
-{
-    return m_context->copyTextureToParentTextureCHROMIUM(texture, parentTexture);
+    return m_context->getExtensions()->supports("GL_EXT_texture_format_BGRA8888")
+        && m_context->getExtensions()->supports("GL_EXT_read_format_bgra");
 }
 
 Texture* SharedGraphicsContext3D::createTexture(NativeImagePtr ptr, Texture::Format format, int width, int height)
diff --git a/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h b/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h
index 05008c2..86c64b4 100644
--- a/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h
+++ b/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h
@@ -100,10 +100,6 @@ public:
 
     bool supportsBGRA();
 
-    // GL_CHROMIUM_copy_texture_to_parent_texture
-    bool supportsCopyTextureToParentTextureCHROMIUM();
-    void copyTextureToParentTextureCHROMIUM(unsigned texture, unsigned parentTexture);
-
     // Creates a texture associated with the given image.  Is owned by this context's
     // TextureHashMap.
     Texture* createTexture(NativeImagePtr, Texture::Format, int width, int height);
diff --git a/WebCore/platform/graphics/gpu/Texture.cpp b/WebCore/platform/graphics/gpu/Texture.cpp
index 74807dc..18c9ead 100644
--- a/WebCore/platform/graphics/gpu/Texture.cpp
+++ b/WebCore/platform/graphics/gpu/Texture.cpp
@@ -34,6 +34,7 @@
 
 #include "Texture.h"
 
+#include "Extensions3D.h"
 #include "FloatRect.h"
 #include "GraphicsContext3D.h"
 #include "IntRect.h"
@@ -69,8 +70,8 @@ static void convertFormat(GraphicsContext3D* context, Texture::Format format, un
         *glType = GraphicsContext3D::UNSIGNED_BYTE;
         break;
     case Texture::BGRA8:
-        if (context->supportsBGRA()) {
-            *glFormat = GraphicsContext3D::BGRA_EXT;
+        if (context->getExtensions()->supports("GL_EXT_texture_format_BGRA8888")) {
+            *glFormat = Extensions3D::BGRA_EXT;
             *glType = GraphicsContext3D::UNSIGNED_BYTE;
         } else {
             *glFormat = GraphicsContext3D::RGBA;
diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm b/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
index 78d004a..ab6993f 100644
--- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
+++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
@@ -36,6 +36,7 @@
 #include "ArrayBufferView.h"
 #include "CanvasRenderingContext.h"
 #include <CoreGraphics/CGBitmapContext.h>
+#include "Extensions3DOpenGL.h"
 #include "Float32Array.h"
 #include "GraphicsContext.h"
 #include "HTMLCanvasElement.h"
diff --git a/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp b/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp
new file mode 100644
index 0000000..8c62e9d
--- /dev/null
+++ b/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(3D_CANVAS)
+
+#include "Extensions3DOpenGL.h"
+
+#include "GraphicsContext3D.h"
+#include <wtf/Vector.h>
+
+#if PLATFORM(MAC)
+#include <OpenGL/gl.h>
+#endif
+
+namespace WebCore {
+
+Extensions3DOpenGL::Extensions3DOpenGL()
+    : m_initializedAvailableExtensions(false)
+{
+}
+
+Extensions3DOpenGL::~Extensions3DOpenGL()
+{
+}
+
+bool Extensions3DOpenGL::supports(const String& name)
+{
+    // Note on support for BGRA:
+    //
+    // For OpenGL ES2.0, requires checking for
+    // GL_EXT_texture_format_BGRA8888 and GL_EXT_read_format_bgra.
+    // For desktop GL, BGRA has been supported since OpenGL 1.2.
+    //
+    // However, note that the GL ES2 extension requires the
+    // internalFormat to glTexImage2D() be GL_BGRA, while desktop GL
+    // will not accept GL_BGRA (must be GL_RGBA), so this must be
+    // checked on each platform. Desktop GL offers neither
+    // GL_EXT_texture_format_BGRA8888 or GL_EXT_read_format_bgra, so
+    // treat them as unsupported here.
+    if (!m_initializedAvailableExtensions) {
+        String extensionsString(reinterpret_cast<const char*>(::glGetString(GL_EXTENSIONS)));
+        Vector<String> availableExtensions;
+        extensionsString.split(" ", availableExtensions);
+        for (size_t i = 0; i < availableExtensions.size(); ++i)
+            m_availableExtensions.add(availableExtensions[i]);
+        m_initializedAvailableExtensions = true;
+    }
+    return m_availableExtensions.contains(name);
+}
+
+int Extensions3DOpenGL::getGraphicsResetStatusARB()
+{
+    return GraphicsContext3D::NO_ERROR;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(3D_CANVAS)
diff --git a/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h b/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h
new file mode 100644
index 0000000..1b333b2
--- /dev/null
+++ b/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Extensions3DOpenGL_h
+#define Extensions3DOpenGL_h
+
+#include "Extensions3D.h"
+
+#include "GraphicsContext3D.h"
+#include <wtf/HashSet.h>
+#include <wtf/text/StringHash.h>
+
+namespace WebCore {
+
+class Extensions3DOpenGL : public Extensions3D {
+public:
+    virtual ~Extensions3DOpenGL();
+
+    // Extensions3D methods.
+    virtual bool supports(const String&);
+    virtual int getGraphicsResetStatusARB();
+
+private:
+    // This class only needs to be instantiated by GraphicsContext3D implementations.
+    friend class GraphicsContext3D;
+    Extensions3DOpenGL();
+
+    bool m_initializedAvailableExtensions;
+    HashSet<String> m_availableExtensions;
+};
+
+} // namespace WebCore
+
+#endif // Extensions3DOpenGL_h
diff --git a/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp b/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
index daf3b12..4016ffb 100644
--- a/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
+++ b/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
@@ -33,6 +33,7 @@
 #include "ArrayBufferView.h"
 #include "WebGLObject.h"
 #include "CanvasRenderingContext.h"
+#include "Extensions3DOpenGL.h"
 #include "Float32Array.h"
 #include "GraphicsContext.h"
 #include "HTMLCanvasElement.h"
@@ -1445,9 +1446,11 @@ void GraphicsContext3D::synthesizeGLError(unsigned long error)
     m_syntheticErrors.add(error);
 }
 
-int GraphicsContext3D::getGraphicsResetStatusARB()
+Extensions3D* GraphicsContext3D::getExtensions()
 {
-    return NO_ERROR;
+    if (!m_extensions)
+        m_extensions = adoptPtr(new Extensions3DOpenGL);
+    return m_extensions.get();
 }
 
 }
diff --git a/WebCore/platform/graphics/qt/Extensions3DQt.cpp b/WebCore/platform/graphics/qt/Extensions3DQt.cpp
new file mode 100644
index 0000000..6a34671
--- /dev/null
+++ b/WebCore/platform/graphics/qt/Extensions3DQt.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(3D_CANVAS)
+
+#include "Extensions3DQt.h"
+
+#include "GraphicsContext3D.h"
+
+namespace WebCore {
+
+Extensions3DQt::Extensions3DQt()
+{
+}
+
+Extensions3DQt::~Extensions3DQt()
+{
+}
+
+bool Extensions3DQt::supports(const String&)
+{
+    return false;
+}
+
+int Extensions3DQt::getGraphicsResetStatusARB()
+{
+    return GraphicsContext3D::NO_ERROR;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(3D_CANVAS)
diff --git a/WebCore/platform/graphics/qt/Extensions3DQt.h b/WebCore/platform/graphics/qt/Extensions3DQt.h
new file mode 100644
index 0000000..29209ba
--- /dev/null
+++ b/WebCore/platform/graphics/qt/Extensions3DQt.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Extensions3DQt_h
+#define Extensions3DQt_h
+
+#include "Extensions3D.h"
+
+namespace WebCore {
+
+class Extensions3DQt : public Extensions3D {
+public:
+    virtual ~Extensions3DQt();
+
+    // Extensions3D methods.
+    virtual bool supports(const String&);
+    virtual int getGraphicsResetStatusARB();
+
+private:
+    // This class only needs to be instantiated by GraphicsContext3D implementations.
+    friend class GraphicsContext3D;
+    Extensions3DQt();
+};
+
+} // namespace WebCore
+
+#endif // Extensions3DQt_h
diff --git a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
index cda8606..26db220 100644
--- a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
@@ -22,6 +22,7 @@
 
 #include "WebGLObject.h"
 #include "CanvasRenderingContext.h"
+#include "Extensions3DQt.h"
 #include "GraphicsContext.h"
 #include "HTMLCanvasElement.h"
 #include "HostWindow.h"
@@ -253,6 +254,8 @@ public:
     QImage m_pixels;
     ListHashSet<unsigned long> m_syntheticErrors;
 
+    OwnPtr<Extensions3DQt> m_extensions;
+
 private:
 
     void* getProcAddress(const String& proc);
@@ -1632,6 +1635,13 @@ void GraphicsContext3D::synthesizeGLError(unsigned long error)
     m_internal->m_syntheticErrors.add(error);
 }
 
+Extensions3D* GraphicsContext3D::getExtensions()
+{
+    if (!m_internal->m_extensions)
+        m_internal->m_extensions = adoptPtr(new Extensions3DQt);
+    return m_internal->m_extensions;
+}
+
 bool GraphicsContext3D::getImageData(Image* image,
                                      unsigned int format,
                                      unsigned int type,
diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
index 6204597..d610c2a 100644
--- a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
@@ -34,6 +34,7 @@
 
 #include "AffineTransform.h"
 #include "DrawingBuffer.h"
+#include "Extensions3D.h"
 #include "GraphicsContext.h"
 #include "GraphicsContext3D.h"
 #include "ImageBuffer.h"
@@ -861,7 +862,7 @@ void PlatformContextSkia::readbackHardwareToSoftware() const
     for (int y = 0; y < height; ++y) {
         uint32_t* pixels = bitmap.getAddr32(0, y);
         if (context->supportsBGRA())
-            context->readPixels(0, height - 1 - y, width, 1, GraphicsContext3D::BGRA_EXT, GraphicsContext3D::UNSIGNED_BYTE, pixels);
+            context->readPixels(0, height - 1 - y, width, 1, Extensions3D::BGRA_EXT, GraphicsContext3D::UNSIGNED_BYTE, pixels);
         else {
             context->readPixels(0, height - 1 - y, width, 1, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels);
             for (int i = 0; i < width; ++i) {
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 7c7ec8e..d01d552 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,57 @@
+2010-11-03  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Chris Marrin.
+
+        Redesign extension mechanism in GraphicsContext3D
+        https://bugs.webkit.org/show_bug.cgi?id=46894
+
+        Upon request, factored out extension support from GraphicsContext3D
+        into a new Extensions3D class. (The plural was chosen because the
+        class and subclasses hold multiple extensions.)
+
+        Unlike GraphicsContext3D, Extensions3D contains only pure virtual
+        methods. This was done because Extensions3D's inheritance diagram
+        and usage pattern is very different from that of GraphicsContext3D,
+        and the concrete subclasses need to decide how to implement the
+        various entry points. Requiring them to be placed at the
+        Extensions3D level will cause implementation details to leak into
+        the base class, which is highly undesirable. Any virtual call
+        overhead to these entry points will be negligible.
+
+        Changed call sites utilizing these extensions to call through the
+        Extensions3D object or its subclasses.
+
+        Tested:
+         - Chromium on Linux with accelerated 2D canvas and HTML5 video
+         - Chromium on Mac OS X with WebGL and CSS 3D content
+         - Safari on Mac OS X with WebGL and CSS 3D content
+
+        No new tests. Covered by existing tests.
+
+        * WebKit.gyp:
+        * public/WebGraphicsContext3D.h:
+        * src/Extensions3DChromium.cpp: Added.
+        (WebCore::Extensions3DChromium::Extensions3DChromium):
+        (WebCore::Extensions3DChromium::~Extensions3DChromium):
+        (WebCore::Extensions3DChromium::supports):
+        (WebCore::Extensions3DChromium::getGraphicsResetStatusARB):
+        (WebCore::Extensions3DChromium::mapBufferSubDataCHROMIUM):
+        (WebCore::Extensions3DChromium::unmapBufferSubDataCHROMIUM):
+        (WebCore::Extensions3DChromium::mapTexSubImage2DCHROMIUM):
+        (WebCore::Extensions3DChromium::unmapTexSubImage2DCHROMIUM):
+        (WebCore::Extensions3DChromium::copyTextureToParentTextureCHROMIUM):
+        * src/GraphicsContext3DChromium.cpp:
+        (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
+        (WebCore::GraphicsContext3DInternal::getExtensions):
+        (WebCore::GraphicsContext3DInternal::supportsExtension):
+        * src/GraphicsContext3DInternal.h:
+        * src/WebGraphicsContext3DDefaultImpl.cpp:
+        (WebKit::WebGraphicsContext3DDefaultImpl::copyTextureToParentTextureCHROMIUM):
+        (WebKit::WebGraphicsContext3DDefaultImpl::getString):
+        * src/WebGraphicsContext3DDefaultImpl.h:
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::composite):
+
 2010-11-03  Daniel Bates  <dbates at rim.com>
 
         For unnamed frames, window.name returns a generated name
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index 45ac985..4dcc61a 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -328,6 +328,7 @@
                 'src/EditorClientImpl.h',
                 'src/EventListenerWrapper.cpp',
                 'src/EventListenerWrapper.h',
+                'src/Extensions3DChromium.cpp',
                 'src/ExternalPopupMenu.cpp',
                 'src/ExternalPopupMenu.h',
                 'src/FrameLoaderClientImpl.cpp',
diff --git a/WebKit/chromium/public/WebGraphicsContext3D.h b/WebKit/chromium/public/WebGraphicsContext3D.h
index 15e6365..11dc6bf 100644
--- a/WebKit/chromium/public/WebGraphicsContext3D.h
+++ b/WebKit/chromium/public/WebGraphicsContext3D.h
@@ -134,18 +134,13 @@ public:
     // getError in the order they were added.
     virtual void synthesizeGLError(unsigned long error) = 0;
 
-    // EXT_texture_format_BGRA8888
-    virtual bool supportsBGRA() = 0;
-
     // GL_CHROMIUM_map_sub
-    virtual bool supportsMapSubCHROMIUM() = 0;
     virtual void* mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access) = 0;
     virtual void unmapBufferSubDataCHROMIUM(const void*) = 0;
     virtual void* mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access) = 0;
     virtual void unmapTexSubImage2DCHROMIUM(const void*) = 0;
 
     // GL_CHROMIUM_copy_texture_to_parent_texture
-    virtual bool supportsCopyTextureToParentTextureCHROMIUM() = 0;
     virtual void copyTextureToParentTextureCHROMIUM(unsigned texture, unsigned parentTexture) = 0;
 
     // The entry points below map directly to the OpenGL ES 2.0 API.
diff --git a/WebKit/chromium/src/Extensions3DChromium.cpp b/WebKit/chromium/src/Extensions3DChromium.cpp
new file mode 100644
index 0000000..c36040b
--- /dev/null
+++ b/WebKit/chromium/src/Extensions3DChromium.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(3D_CANVAS)
+
+#include "Extensions3DChromium.h"
+
+#include "GraphicsContext3D.h"
+#include "GraphicsContext3DInternal.h"
+
+namespace WebCore {
+
+Extensions3DChromium::Extensions3DChromium(GraphicsContext3DInternal* internal)
+    : m_internal(internal)
+{
+}
+
+Extensions3DChromium::~Extensions3DChromium()
+{
+}
+
+bool Extensions3DChromium::supports(const String& name)
+{
+    return m_internal->supportsExtension(name);
+}
+
+int Extensions3DChromium::getGraphicsResetStatusARB()
+{
+    // FIXME: implement this in GraphicsContext3DInternal / WebGraphicsContext3DInternal.
+    return GraphicsContext3D::NO_ERROR;
+}
+
+void* Extensions3DChromium::mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access)
+{
+    return m_internal->mapBufferSubDataCHROMIUM(target, offset, size, access);
+}
+
+void Extensions3DChromium::unmapBufferSubDataCHROMIUM(const void* data)
+{
+    m_internal->unmapBufferSubDataCHROMIUM(data);
+}
+
+void* Extensions3DChromium::mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access)
+{
+    return m_internal->mapTexSubImage2DCHROMIUM(target, level, xoffset, yoffset, width, height, format, type, access);
+}
+
+void Extensions3DChromium::unmapTexSubImage2DCHROMIUM(const void* data)
+{
+    m_internal->unmapTexSubImage2DCHROMIUM(data);
+}
+
+void Extensions3DChromium::copyTextureToParentTextureCHROMIUM(unsigned texture, unsigned parentTexture)
+{
+    m_internal->copyTextureToParentTextureCHROMIUM(texture, parentTexture);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(3D_CANVAS)
diff --git a/WebKit/chromium/src/GraphicsContext3DChromium.cpp b/WebKit/chromium/src/GraphicsContext3DChromium.cpp
index afc2707..c1fae99 100644
--- a/WebKit/chromium/src/GraphicsContext3DChromium.cpp
+++ b/WebKit/chromium/src/GraphicsContext3DChromium.cpp
@@ -39,6 +39,7 @@
 #include "CanvasRenderingContext.h"
 #include "Chrome.h"
 #include "ChromeClientImpl.h"
+#include "Extensions3DChromium.h"
 #include "GraphicsContext3DInternal.h"
 #include "HTMLCanvasElement.h"
 #include "HTMLImageElement.h"
@@ -83,6 +84,7 @@ namespace WebCore {
 
 GraphicsContext3DInternal::GraphicsContext3DInternal()
     : m_webViewImpl(0)
+    , m_initializedAvailableExtensions(false)
 #if PLATFORM(SKIA)
 #elif PLATFORM(CG)
     , m_renderOutput(0)
@@ -675,13 +677,31 @@ DELEGATE_TO_IMPL_1(deleteShader, unsigned)
 DELEGATE_TO_IMPL_1(deleteTexture, unsigned)
 
 DELEGATE_TO_IMPL_1(synthesizeGLError, unsigned long)
-DELEGATE_TO_IMPL_R(supportsBGRA, bool)
-DELEGATE_TO_IMPL_R(supportsMapSubCHROMIUM, bool)
+
+Extensions3D* GraphicsContext3DInternal::getExtensions()
+{
+    if (!m_extensions)
+        m_extensions = adoptPtr(new Extensions3DChromium(this));
+    return m_extensions.get();
+}
+
+bool GraphicsContext3DInternal::supportsExtension(const String& name)
+{
+    if (!m_initializedAvailableExtensions) {
+        String extensionsString = getString(GraphicsContext3D::EXTENSIONS);
+        Vector<String> availableExtensions;
+        extensionsString.split(" ", availableExtensions);
+        for (size_t i = 0; i < availableExtensions.size(); ++i)
+            m_availableExtensions.add(availableExtensions[i]);
+        m_initializedAvailableExtensions = true;
+    }
+    return m_availableExtensions.contains(name);
+}
+
 DELEGATE_TO_IMPL_4R(mapBufferSubDataCHROMIUM, unsigned, int, int, unsigned, void*)
 DELEGATE_TO_IMPL_1(unmapBufferSubDataCHROMIUM, const void*)
 DELEGATE_TO_IMPL_9R(mapTexSubImage2DCHROMIUM, unsigned, int, int, int, int, int, unsigned, unsigned, unsigned, void*)
 DELEGATE_TO_IMPL_1(unmapTexSubImage2DCHROMIUM, const void*)
-DELEGATE_TO_IMPL_R(supportsCopyTextureToParentTextureCHROMIUM, bool)
 DELEGATE_TO_IMPL_2(copyTextureToParentTextureCHROMIUM, unsigned, unsigned)
 
 //----------------------------------------------------------------------
@@ -1023,14 +1043,7 @@ DELEGATE_TO_INTERNAL_1(deleteShader, unsigned)
 DELEGATE_TO_INTERNAL_1(deleteTexture, unsigned)
 
 DELEGATE_TO_INTERNAL_1(synthesizeGLError, unsigned long)
-DELEGATE_TO_INTERNAL_R(supportsBGRA, bool)
-DELEGATE_TO_INTERNAL_R(supportsMapSubCHROMIUM, bool)
-DELEGATE_TO_INTERNAL_4R(mapBufferSubDataCHROMIUM, unsigned, int, int, unsigned, void*)
-DELEGATE_TO_INTERNAL_1(unmapBufferSubDataCHROMIUM, const void*)
-DELEGATE_TO_INTERNAL_9R(mapTexSubImage2DCHROMIUM, unsigned, int, int, int, int, int, unsigned, unsigned, unsigned, void*)
-DELEGATE_TO_INTERNAL_1(unmapTexSubImage2DCHROMIUM, const void*)
-DELEGATE_TO_INTERNAL_R(supportsCopyTextureToParentTextureCHROMIUM, bool)
-DELEGATE_TO_INTERNAL_2(copyTextureToParentTextureCHROMIUM, unsigned, unsigned)
+DELEGATE_TO_INTERNAL_R(getExtensions, Extensions3D*)
 
 bool GraphicsContext3D::isGLES2Compliant() const
 {
@@ -1047,11 +1060,6 @@ bool GraphicsContext3D::isErrorGeneratedOnOutOfBoundsAccesses() const
     return m_internal->isErrorGeneratedOnOutOfBoundsAccesses();
 }
 
-int GraphicsContext3D::getGraphicsResetStatusARB()
-{
-    return NO_ERROR;
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(3D_CANVAS)
diff --git a/WebKit/chromium/src/GraphicsContext3DInternal.h b/WebKit/chromium/src/GraphicsContext3DInternal.h
index f12fff0..17163a4 100644
--- a/WebKit/chromium/src/GraphicsContext3DInternal.h
+++ b/WebKit/chromium/src/GraphicsContext3DInternal.h
@@ -27,6 +27,7 @@
 #define GraphicsContext3DInternal_h
 
 #include "GraphicsContext3D.h"
+#include <wtf/HashSet.h>
 #include <wtf/OwnPtr.h>
 #if PLATFORM(SKIA)
 #include "SkBitmap.h"
@@ -39,6 +40,7 @@ class WebViewImpl;
 
 namespace WebCore {
 
+class Extensions3DChromium;
 #if USE(ACCELERATED_COMPOSITING)
 class WebGLLayerChromium;
 #endif
@@ -260,7 +262,9 @@ public:
 
     void synthesizeGLError(unsigned long error);
 
-    void swapBuffers();
+    // Extensions3D support.
+    Extensions3D* getExtensions();
+    bool supportsExtension(const String& name);
 
     // EXT_texture_format_BGRA8888
     bool supportsBGRA();
@@ -278,7 +282,10 @@ public:
 
 private:
     OwnPtr<WebKit::WebGraphicsContext3D> m_impl;
+    OwnPtr<Extensions3DChromium> m_extensions;
     WebKit::WebViewImpl* m_webViewImpl;
+    bool m_initializedAvailableExtensions;
+    HashSet<String> m_availableExtensions;
 #if USE(ACCELERATED_COMPOSITING)
     RefPtr<WebGLLayerChromium> m_compositingLayer;
 #endif
diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
index e805c55..8df217a 100644
--- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
+++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
@@ -40,7 +40,8 @@
 #include "WebView.h"
 #include <wtf/OwnArrayPtr.h>
 #include <wtf/PassOwnPtr.h>
-#include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
 
 #include <stdio.h>
 #include <string.h>
@@ -531,20 +532,6 @@ void WebGraphicsContext3DDefaultImpl::synthesizeGLError(unsigned long error)
     m_syntheticErrors.add(error);
 }
 
-bool WebGraphicsContext3DDefaultImpl::supportsBGRA()
-{
-    // Supported since OpenGL 1.2. However, glTexImage2D() must be modified
-    // to translate the internalFormat from GL_BGRA to GL_RGBA, since the
-    // former is not accepted by desktop GL. Return false until this is done.
-    return false;
-}
-
-bool WebGraphicsContext3DDefaultImpl::supportsMapSubCHROMIUM()
-{
-    // We don't claim support for this extension at this time
-    return false;
-}
-
 void* WebGraphicsContext3DDefaultImpl::mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access)
 {
     return 0;
@@ -563,15 +550,11 @@ void WebGraphicsContext3DDefaultImpl::unmapTexSubImage2DCHROMIUM(const void* mem
 {
 }
 
-bool WebGraphicsContext3DDefaultImpl::supportsCopyTextureToParentTextureCHROMIUM()
-{
-    // This extension requires this desktopGL-only function (GLES2 doesn't
-    // support it), so check for its existence here.
-    return glGetTexLevelParameteriv;
-}
-
 void WebGraphicsContext3DDefaultImpl::copyTextureToParentTextureCHROMIUM(unsigned id, unsigned id2)
 {
+    if (!glGetTexLevelParameteriv)
+        return;
+
     makeContextCurrent();
     glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_copyTextureToParentTextureFBO);
     glFramebufferTexture2DEXT(GL_FRAMEBUFFER,
@@ -1130,7 +1113,16 @@ WebString WebGraphicsContext3DDefaultImpl::getShaderSource(WebGLId shader)
 WebString WebGraphicsContext3DDefaultImpl::getString(unsigned long name)
 {
     makeContextCurrent();
-    return WebString::fromUTF8(reinterpret_cast<const char*>(glGetString(name)));
+    StringBuilder result;
+    result.append(reinterpret_cast<const char*>(glGetString(name)));
+    if (name == GL_EXTENSIONS) {
+        // GL_CHROMIUM_copy_texture_to_parent_texture requires this
+        // desktopGL-only function (GLES2 doesn't support it), so
+        // check for its existence here.
+        if (glGetTexLevelParameteriv)
+            result.append(" GL_CHROMIUM_copy_texture_to_parent_texture");
+    }
+    return WebString(result.toString());
 }
 
 DELEGATE_TO_GL_3(getTexParameterfv, GetTexParameterfv, unsigned long, unsigned long, float*)
diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h
index 5eebf12..c1de77c 100644
--- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h
+++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h
@@ -81,13 +81,10 @@ public:
     virtual void prepareTexture();
 
     virtual void synthesizeGLError(unsigned long error);
-    virtual bool supportsBGRA();
-    virtual bool supportsMapSubCHROMIUM();
     virtual void* mapBufferSubDataCHROMIUM(unsigned target, int offset, int size, unsigned access);
     virtual void unmapBufferSubDataCHROMIUM(const void*);
     virtual void* mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access);
     virtual void unmapTexSubImage2DCHROMIUM(const void*);
-    virtual bool supportsCopyTextureToParentTextureCHROMIUM();
     virtual void copyTextureToParentTextureCHROMIUM(unsigned texture, unsigned parentTexture);
 
     virtual void activeTexture(unsigned long texture);
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index 57d0ca4..490c620 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -52,6 +52,7 @@
 #include "DragData.h"
 #include "Editor.h"
 #include "EventHandler.h"
+#include "Extensions3D.h"
 #include "FocusController.h"
 #include "FontDescription.h"
 #include "FrameLoader.h"
@@ -1050,7 +1051,7 @@ void WebViewImpl::composite(bool finish)
     m_layerRenderer->present();
 
     GraphicsContext3D* context = m_layerRenderer->context();
-    if (context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR)
+    if (context->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR)
         reallocateRenderer();
 #endif
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list