[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 13:35:00 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 71fe7c6b10cb546ad601843d2781cc67e02f7ba0
Author: kbr at google.com <kbr at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 20 22:28:38 2010 +0000

    2010-09-20  Kenneth Russell  <kbr at google.com>
    
            Reviewed by James Robinson.
    
            [chromium] Change compositor to use GraphicsContext3D rather than GLES2Context
            https://bugs.webkit.org/show_bug.cgi?id=45912
    
            Switched Chromium's compositor to use GraphicsContext3D to issue
            its OpenGL rendering calls rather than the Chromium-specific
            GLES2Context and command buffer OpenGL implementation.
    
            The in-process software rendering path for GraphicsContext3D does
            not yet work with the compositor, at least not on Mac OS X. This
            will be worked on in subsequent bugs.
    
            Tested manually with 3D CSS, WebGL and video content on Mac OS X
            and Linux. No new tests.
    
            * src/GraphicsContext3D.cpp:
            (WebCore::GraphicsContext3DInternal::initialize):
            (WebCore::GraphicsContext3DInternal::extractWebGraphicsContext3D):
            (WebCore::GraphicsContext3D::create):
            * src/GraphicsContext3DInternal.h:
            * src/WebViewImpl.cpp:
            (WebKit::WebViewImpl::resize):
            (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
            (WebKit::WebViewImpl::gles2Context):
            (WebKit::WebViewImpl::graphicsContext3D):
            * src/WebViewImpl.h:
    2010-09-20  Kenneth Russell  <kbr at google.com>
    
            Reviewed by James Robinson.
    
            [chromium] Change compositor to use GraphicsContext3D rather than GLES2Context
            https://bugs.webkit.org/show_bug.cgi?id=45912
    
            Switched Chromium's compositor to use GraphicsContext3D to issue
            its OpenGL rendering calls rather than the Chromium-specific
            GLES2Context and command buffer OpenGL implementation.
    
            The in-process software rendering path for GraphicsContext3D does
            not yet work with the compositor, at least not on Mac OS X. This
            will be worked on in subsequent bugs.
    
            Tested manually with 3D CSS, WebGL and video content on Mac OS X
            and Linux. No new tests.
    
            * platform/graphics/chromium/Canvas2DLayerChromium.cpp:
            (WebCore::Canvas2DLayerChromium::~Canvas2DLayerChromium):
            (WebCore::Canvas2DLayerChromium::updateContents):
            * platform/graphics/chromium/CanvasLayerChromium.cpp:
            (WebCore::CanvasLayerChromium::SharedValues::SharedValues):
            (WebCore::CanvasLayerChromium::SharedValues::~SharedValues):
            (WebCore::CanvasLayerChromium::draw):
            * platform/graphics/chromium/CanvasLayerChromium.h:
            * platform/graphics/chromium/ContentLayerChromium.cpp:
            (WebCore::ContentLayerChromium::SharedValues::SharedValues):
            (WebCore::ContentLayerChromium::SharedValues::~SharedValues):
            (WebCore::ContentLayerChromium::~ContentLayerChromium):
            (WebCore::ContentLayerChromium::updateTextureRect):
            (WebCore::ContentLayerChromium::draw):
            * platform/graphics/chromium/ContentLayerChromium.h:
            * platform/graphics/chromium/DrawingBufferChromium.cpp:
            (WebCore::DrawingBuffer::publishToPlatformLayer):
            * platform/graphics/chromium/LayerChromium.cpp:
            (WebCore::loadShader):
            (WebCore::LayerChromium::SharedValues::SharedValues):
            (WebCore::LayerChromium::SharedValues::~SharedValues):
            (WebCore::LayerChromium::createShaderProgram):
            (WebCore::LayerChromium::layerRendererContext):
            (WebCore::LayerChromium::drawTexturedQuad):
            (WebCore::LayerChromium::drawDebugBorder):
            (WebCore::LayerChromium::drawAsMask):
            (WebCore::LayerChromium::prepareForDraw):
            * platform/graphics/chromium/LayerChromium.h:
            (WebCore::LayerChromium::SharedValues::context):
            * platform/graphics/chromium/LayerRendererChromium.cpp:
            (WebCore::LayerRendererChromium::create):
            (WebCore::LayerRendererChromium::LayerRendererChromium):
            (WebCore::LayerRendererChromium::context):
            (WebCore::LayerRendererChromium::debugGLCall):
            (WebCore::LayerRendererChromium::useShader):
            (WebCore::LayerRendererChromium::prepareToDrawLayers):
            (WebCore::LayerRendererChromium::updateRootLayerTextureRect):
            (WebCore::LayerRendererChromium::drawLayers):
            (WebCore::LayerRendererChromium::finish):
            (WebCore::LayerRendererChromium::present):
            (WebCore::LayerRendererChromium::getFramebufferPixels):
            (WebCore::LayerRendererChromium::createLayerTexture):
            (WebCore::LayerRendererChromium::drawLayerIntoStencilBuffer):
            (WebCore::LayerRendererChromium::drawLayersRecursive):
            (WebCore::LayerRendererChromium::drawLayer):
            (WebCore::LayerRendererChromium::scissorToRect):
            (WebCore::LayerRendererChromium::makeContextCurrent):
            (WebCore::LayerRendererChromium::resizeOnscreenContent):
            (WebCore::LayerRendererChromium::initializeSharedObjects):
            (WebCore::LayerRendererChromium::cleanupSharedObjects):
            * platform/graphics/chromium/LayerRendererChromium.h:
            * platform/graphics/chromium/VideoLayerChromium.cpp:
            (WebCore::VideoLayerChromium::createTextureRect):
            (WebCore::VideoLayerChromium::updateTextureRect):
            * platform/graphics/chromium/WebGLLayerChromium.cpp:
            (WebCore::WebGLLayerChromium::updateContents):
            * platform/graphics/gpu/SharedGraphicsContext3D.cpp:
            (WebCore::SharedGraphicsContext3D::flush):
            (WebCore::SharedGraphicsContext3D::supportsCopyTextureToParentTextureCHROMIUM):
            (WebCore::SharedGraphicsContext3D::copyTextureToParentTextureCHROMIUM):
            * platform/graphics/gpu/SharedGraphicsContext3D.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67885 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 22f561e..f1c0532 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,83 @@
+2010-09-20  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by James Robinson.
+
+        [chromium] Change compositor to use GraphicsContext3D rather than GLES2Context
+        https://bugs.webkit.org/show_bug.cgi?id=45912
+
+        Switched Chromium's compositor to use GraphicsContext3D to issue
+        its OpenGL rendering calls rather than the Chromium-specific
+        GLES2Context and command buffer OpenGL implementation.
+
+        The in-process software rendering path for GraphicsContext3D does
+        not yet work with the compositor, at least not on Mac OS X. This
+        will be worked on in subsequent bugs.
+
+        Tested manually with 3D CSS, WebGL and video content on Mac OS X
+        and Linux. No new tests.
+
+        * platform/graphics/chromium/Canvas2DLayerChromium.cpp:
+        (WebCore::Canvas2DLayerChromium::~Canvas2DLayerChromium):
+        (WebCore::Canvas2DLayerChromium::updateContents):
+        * platform/graphics/chromium/CanvasLayerChromium.cpp:
+        (WebCore::CanvasLayerChromium::SharedValues::SharedValues):
+        (WebCore::CanvasLayerChromium::SharedValues::~SharedValues):
+        (WebCore::CanvasLayerChromium::draw):
+        * platform/graphics/chromium/CanvasLayerChromium.h:
+        * platform/graphics/chromium/ContentLayerChromium.cpp:
+        (WebCore::ContentLayerChromium::SharedValues::SharedValues):
+        (WebCore::ContentLayerChromium::SharedValues::~SharedValues):
+        (WebCore::ContentLayerChromium::~ContentLayerChromium):
+        (WebCore::ContentLayerChromium::updateTextureRect):
+        (WebCore::ContentLayerChromium::draw):
+        * platform/graphics/chromium/ContentLayerChromium.h:
+        * platform/graphics/chromium/DrawingBufferChromium.cpp:
+        (WebCore::DrawingBuffer::publishToPlatformLayer):
+        * platform/graphics/chromium/LayerChromium.cpp:
+        (WebCore::loadShader):
+        (WebCore::LayerChromium::SharedValues::SharedValues):
+        (WebCore::LayerChromium::SharedValues::~SharedValues):
+        (WebCore::LayerChromium::createShaderProgram):
+        (WebCore::LayerChromium::layerRendererContext):
+        (WebCore::LayerChromium::drawTexturedQuad):
+        (WebCore::LayerChromium::drawDebugBorder):
+        (WebCore::LayerChromium::drawAsMask):
+        (WebCore::LayerChromium::prepareForDraw):
+        * platform/graphics/chromium/LayerChromium.h:
+        (WebCore::LayerChromium::SharedValues::context):
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::create):
+        (WebCore::LayerRendererChromium::LayerRendererChromium):
+        (WebCore::LayerRendererChromium::context):
+        (WebCore::LayerRendererChromium::debugGLCall):
+        (WebCore::LayerRendererChromium::useShader):
+        (WebCore::LayerRendererChromium::prepareToDrawLayers):
+        (WebCore::LayerRendererChromium::updateRootLayerTextureRect):
+        (WebCore::LayerRendererChromium::drawLayers):
+        (WebCore::LayerRendererChromium::finish):
+        (WebCore::LayerRendererChromium::present):
+        (WebCore::LayerRendererChromium::getFramebufferPixels):
+        (WebCore::LayerRendererChromium::createLayerTexture):
+        (WebCore::LayerRendererChromium::drawLayerIntoStencilBuffer):
+        (WebCore::LayerRendererChromium::drawLayersRecursive):
+        (WebCore::LayerRendererChromium::drawLayer):
+        (WebCore::LayerRendererChromium::scissorToRect):
+        (WebCore::LayerRendererChromium::makeContextCurrent):
+        (WebCore::LayerRendererChromium::resizeOnscreenContent):
+        (WebCore::LayerRendererChromium::initializeSharedObjects):
+        (WebCore::LayerRendererChromium::cleanupSharedObjects):
+        * platform/graphics/chromium/LayerRendererChromium.h:
+        * platform/graphics/chromium/VideoLayerChromium.cpp:
+        (WebCore::VideoLayerChromium::createTextureRect):
+        (WebCore::VideoLayerChromium::updateTextureRect):
+        * platform/graphics/chromium/WebGLLayerChromium.cpp:
+        (WebCore::WebGLLayerChromium::updateContents):
+        * platform/graphics/gpu/SharedGraphicsContext3D.cpp:
+        (WebCore::SharedGraphicsContext3D::flush):
+        (WebCore::SharedGraphicsContext3D::supportsCopyTextureToParentTextureCHROMIUM):
+        (WebCore::SharedGraphicsContext3D::copyTextureToParentTextureCHROMIUM):
+        * platform/graphics/gpu/SharedGraphicsContext3D.h:
+
 2010-09-20  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp b/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp
index 9826c3e..c2cde19 100644
--- a/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp
@@ -35,8 +35,7 @@
 #include "Canvas2DLayerChromium.h"
 
 #include "DrawingBuffer.h"
-
-#include <GLES2/gl2.h>
+#include "GraphicsContext3D.h"
 
 namespace WebCore {
 
@@ -54,7 +53,7 @@ Canvas2DLayerChromium::Canvas2DLayerChromium(DrawingBuffer* drawingBuffer, Graph
 Canvas2DLayerChromium::~Canvas2DLayerChromium()
 {
     if (m_textureId)
-        glDeleteTextures(1, &m_textureId);
+        layerRendererContext()->deleteTexture(m_textureId);
 }
 
 void Canvas2DLayerChromium::updateContents()
@@ -62,26 +61,27 @@ void Canvas2DLayerChromium::updateContents()
     if (!m_drawingBuffer)
         return;
     if (m_textureChanged) { // We have to generate a new backing texture.
+        GraphicsContext3D* context = layerRendererContext();
         if (m_textureId)
-            glDeleteTextures(1, &m_textureId);
-        glGenTextures(1, &m_textureId);
-        glActiveTexture(GL_TEXTURE0);
-        glBindTexture(GL_TEXTURE_2D, m_textureId);
+            context->deleteTexture(m_textureId);
+        m_textureId = context->createTexture();
+        context->activeTexture(GraphicsContext3D::TEXTURE0);
+        context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId);
         IntSize size = m_drawingBuffer->size();
-        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
-        // Set the min-mag filters to linear and wrap modes to GL_CLAMP_TO_EDGE
+        context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, size.width(), size.height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, 0);
+        // Set the min-mag filters to linear and wrap modes to GraphicsContext3D::CLAMP_TO_EDGE
         // to get around NPOT texture limitations of GLES.
-        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+        context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR);
+        context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR);
+        context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE);
+        context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE);
         m_textureChanged = false;
-        // FIXME: The glFinish() here is required because we have to make sure that the texture created in this
+        // FIXME: The finish() here is required because we have to make sure that the texture created in this
         // context (the compositor context) is actually created by the service side before the child context
-        // attempts to use it (in publishToPlatformLayer).  glFinish() is currently the only call with strong
+        // attempts to use it (in publishToPlatformLayer).  finish() is currently the only call with strong
         // enough semantics to promise this, but is actually much stronger.  Ideally we'd do something like
         // inserting a fence here and waiting for it before trying to publish.
-        glFinish();
+        context->finish();
     }
     // Update the contents of the texture used by the compositor.
     if (m_contentsDirty) {
diff --git a/WebCore/platform/graphics/chromium/CanvasLayerChromium.cpp b/WebCore/platform/graphics/chromium/CanvasLayerChromium.cpp
index 56a7262..4aef25b 100644
--- a/WebCore/platform/graphics/chromium/CanvasLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/CanvasLayerChromium.cpp
@@ -34,16 +34,16 @@
 
 #include "CanvasLayerChromium.h"
 
+#include "GraphicsContext3D.h"
 #include "LayerRendererChromium.h"
 
-#include <GLES2/gl2.h>
-
 namespace WebCore {
 
 unsigned CanvasLayerChromium::m_shaderProgramId = 0;
 
-CanvasLayerChromium::SharedValues::SharedValues()
-    : m_canvasShaderProgram(0)
+CanvasLayerChromium::SharedValues::SharedValues(GraphicsContext3D* context)
+    : m_context(context)
+    , m_canvasShaderProgram(0)
     , m_shaderSamplerLocation(-1)
     , m_shaderMatrixLocation(-1)
     , m_shaderAlphaLocation(-1)
@@ -73,15 +73,15 @@ CanvasLayerChromium::SharedValues::SharedValues()
         "  gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w) * alpha; \n"
         "}                                                   \n";
 
-    m_canvasShaderProgram = createShaderProgram(vertexShaderString, fragmentShaderString);
+    m_canvasShaderProgram = createShaderProgram(m_context, vertexShaderString, fragmentShaderString);
     if (!m_canvasShaderProgram) {
         LOG_ERROR("CanvasLayerChromium: Failed to create shader program");
         return;
     }
 
-    m_shaderSamplerLocation = glGetUniformLocation(m_canvasShaderProgram, "s_texture");
-    m_shaderMatrixLocation = glGetUniformLocation(m_canvasShaderProgram, "matrix");
-    m_shaderAlphaLocation = glGetUniformLocation(m_canvasShaderProgram, "alpha");
+    m_shaderSamplerLocation = m_context->getUniformLocation(m_canvasShaderProgram, "s_texture");
+    m_shaderMatrixLocation = m_context->getUniformLocation(m_canvasShaderProgram, "matrix");
+    m_shaderAlphaLocation = m_context->getUniformLocation(m_canvasShaderProgram, "alpha");
     ASSERT(m_shaderSamplerLocation != -1);
     ASSERT(m_shaderMatrixLocation != -1);
     ASSERT(m_shaderAlphaLocation != -1);
@@ -92,7 +92,7 @@ CanvasLayerChromium::SharedValues::SharedValues()
 CanvasLayerChromium::SharedValues::~SharedValues()
 {
     if (m_canvasShaderProgram)
-        GLC(glDeleteProgram(m_canvasShaderProgram));
+        GLC(m_context, m_context->deleteProgram(m_canvasShaderProgram));
 }
 
 CanvasLayerChromium::CanvasLayerChromium(GraphicsLayerChromium* owner)
@@ -111,11 +111,12 @@ void CanvasLayerChromium::draw()
     ASSERT(layerRenderer());
     const CanvasLayerChromium::SharedValues* sv = layerRenderer()->canvasLayerSharedValues();
     ASSERT(sv && sv->initialized());
-    GLC(glActiveTexture(GL_TEXTURE0));
-    GLC(glBindTexture(GL_TEXTURE_2D, m_textureId));
+    GraphicsContext3D* context = layerRendererContext();
+    GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0));
+    GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId));
     layerRenderer()->useShader(sv->canvasShaderProgram());
-    GLC(glUniform1i(sv->shaderSamplerLocation(), 0));
-    drawTexturedQuad(layerRenderer()->projectionMatrix(), drawTransform(),
+    GLC(context, context->uniform1i(sv->shaderSamplerLocation(), 0));
+    drawTexturedQuad(context, layerRenderer()->projectionMatrix(), drawTransform(),
                      bounds().width(), bounds().height(), drawOpacity(),
                      sv->shaderMatrixLocation(), sv->shaderAlphaLocation());
 
diff --git a/WebCore/platform/graphics/chromium/CanvasLayerChromium.h b/WebCore/platform/graphics/chromium/CanvasLayerChromium.h
index d591c73..6520b55 100644
--- a/WebCore/platform/graphics/chromium/CanvasLayerChromium.h
+++ b/WebCore/platform/graphics/chromium/CanvasLayerChromium.h
@@ -47,7 +47,7 @@ public:
 
     class SharedValues {
     public:
-        SharedValues();
+        explicit SharedValues(GraphicsContext3D*);
         ~SharedValues();
 
         unsigned canvasShaderProgram() const { return m_canvasShaderProgram; }
@@ -57,6 +57,7 @@ public:
         bool initialized() const { return m_initialized; }
 
     private:
+        GraphicsContext3D* m_context;
         unsigned m_canvasShaderProgram;
         int m_shaderSamplerLocation;
         int m_shaderMatrixLocation;
diff --git a/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
index 4928898..86be8da 100644
--- a/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
@@ -34,6 +34,7 @@
 
 #include "ContentLayerChromium.h"
 
+#include "GraphicsContext3D.h"
 #include "LayerRendererChromium.h"
 #include "RenderLayerBacking.h"
 
@@ -47,12 +48,11 @@
 #include <CoreGraphics/CGBitmapContext.h>
 #endif
 
-#include <GLES2/gl2.h>
-
 namespace WebCore {
 
-ContentLayerChromium::SharedValues::SharedValues()
-    : m_contentShaderProgram(0)
+ContentLayerChromium::SharedValues::SharedValues(GraphicsContext3D* context)
+    : m_context(context)
+    , m_contentShaderProgram(0)
     , m_shaderSamplerLocation(-1)
     , m_shaderMatrixLocation(-1)
     , m_shaderAlphaLocation(-1)
@@ -90,15 +90,15 @@ ContentLayerChromium::SharedValues::SharedValues()
 #endif
         "}                                                   \n";
 
-    m_contentShaderProgram = createShaderProgram(vertexShaderString, fragmentShaderString);
+    m_contentShaderProgram = createShaderProgram(m_context, vertexShaderString, fragmentShaderString);
     if (!m_contentShaderProgram) {
         LOG_ERROR("ContentLayerChromium: Failed to create shader program");
         return;
     }
 
-    m_shaderSamplerLocation = glGetUniformLocation(m_contentShaderProgram, "s_texture");
-    m_shaderMatrixLocation = glGetUniformLocation(m_contentShaderProgram, "matrix");
-    m_shaderAlphaLocation = glGetUniformLocation(m_contentShaderProgram, "alpha");
+    m_shaderSamplerLocation = m_context->getUniformLocation(m_contentShaderProgram, "s_texture");
+    m_shaderMatrixLocation = m_context->getUniformLocation(m_contentShaderProgram, "matrix");
+    m_shaderAlphaLocation = m_context->getUniformLocation(m_contentShaderProgram, "alpha");
     ASSERT(m_shaderSamplerLocation != -1);
     ASSERT(m_shaderMatrixLocation != -1);
     ASSERT(m_shaderAlphaLocation != -1);
@@ -109,7 +109,7 @@ ContentLayerChromium::SharedValues::SharedValues()
 ContentLayerChromium::SharedValues::~SharedValues()
 {
     if (m_contentShaderProgram)
-        GLC(glDeleteProgram(m_contentShaderProgram));
+        GLC(m_context, m_context->deleteProgram(m_contentShaderProgram));
 }
 
 
@@ -127,7 +127,7 @@ ContentLayerChromium::ContentLayerChromium(GraphicsLayerChromium* owner)
 ContentLayerChromium::~ContentLayerChromium()
 {
     if (m_contentsTexture)
-        GLC(glDeleteTextures(1, &m_contentsTexture));
+        GLC(layerRendererContext(), layerRendererContext()->deleteTexture(m_contentsTexture));
 }
 
 
@@ -236,20 +236,21 @@ void ContentLayerChromium::updateTextureRect(void* pixels, const IntSize& bitmap
     if (!pixels)
         return;
 
-    glBindTexture(GL_TEXTURE_2D, textureId);
+    GraphicsContext3D* context = layerRendererContext();
+    context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId);
 
     // If the texture id or size changed since last time then we need to tell GL
     // to re-allocate a texture.
     if (m_contentsTexture != textureId || requiredTextureSize != m_allocatedTextureSize) {
         ASSERT(bitmapSize == requiredTextureSize);
-        GLC(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, requiredTextureSize.width(), requiredTextureSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels));
+        GLC(context, context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, requiredTextureSize.width(), requiredTextureSize.height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels));
 
         m_contentsTexture = textureId;
         m_allocatedTextureSize = requiredTextureSize;
     } else {
         ASSERT(updateRect.width() <= m_allocatedTextureSize.width() && updateRect.height() <= m_allocatedTextureSize.height());
         ASSERT(updateRect.width() == bitmapSize.width() && updateRect.height() == bitmapSize.height());
-        GLC(glTexSubImage2D(GL_TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, pixels));
+        GLC(context, context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels));
     }
 
     m_dirtyRect.setSize(FloatSize());
@@ -264,11 +265,12 @@ void ContentLayerChromium::draw()
     ASSERT(layerRenderer());
     const ContentLayerChromium::SharedValues* sv = layerRenderer()->contentLayerSharedValues();
     ASSERT(sv && sv->initialized());
-    GLC(glActiveTexture(GL_TEXTURE0));
-    GLC(glBindTexture(GL_TEXTURE_2D, m_contentsTexture));
+    GraphicsContext3D* context = layerRendererContext();
+    GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0));
+    GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_contentsTexture));
     layerRenderer()->useShader(sv->contentShaderProgram());
-    GLC(glUniform1i(sv->shaderSamplerLocation(), 0));
-    drawTexturedQuad(layerRenderer()->projectionMatrix(), drawTransform(),
+    GLC(context, context->uniform1i(sv->shaderSamplerLocation(), 0));
+    drawTexturedQuad(context, layerRenderer()->projectionMatrix(), drawTransform(),
                      bounds().width(), bounds().height(), drawOpacity(),
                      sv->shaderMatrixLocation(), sv->shaderAlphaLocation());
 }
diff --git a/WebCore/platform/graphics/chromium/ContentLayerChromium.h b/WebCore/platform/graphics/chromium/ContentLayerChromium.h
index 3e15372..a79189f 100644
--- a/WebCore/platform/graphics/chromium/ContentLayerChromium.h
+++ b/WebCore/platform/graphics/chromium/ContentLayerChromium.h
@@ -55,7 +55,7 @@ public:
     // context).
     class SharedValues {
     public:
-        SharedValues();
+        explicit SharedValues(GraphicsContext3D*);
         ~SharedValues();
 
         unsigned contentShaderProgram() const { return m_contentShaderProgram; }
@@ -65,6 +65,7 @@ public:
         int initialized() const { return m_initialized; }
 
     private:
+        GraphicsContext3D* m_context;
         unsigned m_contentShaderProgram;
         int m_shaderSamplerLocation;
         int m_shaderMatrixLocation;
diff --git a/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp b/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
index 64981ee..9ce0efe 100644
--- a/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
+++ b/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
@@ -39,12 +39,6 @@
 #include "Canvas2DLayerChromium.h"
 #endif
 
-#include <GLES2/gl2.h>
-#ifndef GL_GLEXT_PROTOTYPES
-#define GL_GLEXT_PROTOTYPES 1
-#endif
-#include <GLES2/gl2ext.h>
-
 namespace WebCore {
 
 struct DrawingBufferInternal {
@@ -105,8 +99,8 @@ 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();
-    glCopyTextureToParentTexture(m_internal->offscreenColorTexture, parentTexture);
-    glFlush();
+    m_context->copyTextureToParentTextureCHROMIUM(m_internal->offscreenColorTexture, parentTexture);
+    m_context->flush();
 }
 #endif
 
diff --git a/WebCore/platform/graphics/chromium/LayerChromium.cpp b/WebCore/platform/graphics/chromium/LayerChromium.cpp
index d6eef3a..e36c69d 100644
--- a/WebCore/platform/graphics/chromium/LayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerChromium.cpp
@@ -34,6 +34,7 @@
 
 #include "LayerChromium.h"
 
+#include "GraphicsContext3D.h"
 #include "LayerRendererChromium.h"
 #if PLATFORM(SKIA)
 #include "NativeImageSkia.h"
@@ -41,8 +42,7 @@
 #endif
 #include "RenderLayerBacking.h"
 #include "skia/ext/platform_canvas.h"
-
-#include <GLES2/gl2.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
@@ -51,24 +51,26 @@ using namespace std;
 const unsigned LayerChromium::s_positionAttribLocation = 0;
 const unsigned LayerChromium::s_texCoordAttribLocation = 1;
 
-static GLuint loadShader(GLenum type, const char* shaderSource)
+static unsigned loadShader(GraphicsContext3D* context, unsigned type, const char* shaderSource)
 {
-    GLuint shader = glCreateShader(type);
+    unsigned shader = context->createShader(type);
     if (!shader)
         return 0;
-    GLC(glShaderSource(shader, 1, &shaderSource, 0));
-    GLC(glCompileShader(shader));
-    GLint compiled;
-    GLC(glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled));
+    String sourceString(shaderSource);
+    GLC(context, context->shaderSource(shader, sourceString));
+    GLC(context, context->compileShader(shader));
+    int compiled;
+    GLC(context, context->getShaderiv(shader, GraphicsContext3D::COMPILE_STATUS, &compiled));
     if (!compiled) {
-        GLC(glDeleteShader(shader));
+        GLC(context, context->deleteShader(shader));
         return 0;
     }
     return shader;
 }
 
-LayerChromium::SharedValues::SharedValues()
-    : m_quadVerticesVbo(0)
+LayerChromium::SharedValues::SharedValues(GraphicsContext3D* context)
+    : m_context(context)
+    , m_quadVerticesVbo(0)
     , m_quadElementsVbo(0)
     , m_maxTextureSize(0)
     , m_borderShaderProgram(0)
@@ -77,24 +79,22 @@ LayerChromium::SharedValues::SharedValues()
     , m_initialized(false)
 {
     // Vertex positions and texture coordinates for the 4 corners of a 1x1 quad.
-    GLfloat vertices[] = { -0.5f,  0.5f, 0.0f, 0.0f,  1.0f,
-                           -0.5f, -0.5f, 0.0f, 0.0f,  0.0f,
-                            0.5f, -0.5f, 0.0f, 1.0f,  0.0f,
-                            0.5f,  0.5f, 0.0f, 1.0f,  1.0f };
-    GLushort indices[] = { 0, 1, 2, 0, 2, 3, // The two triangles that make up the layer quad.
+    float vertices[] = { -0.5f,  0.5f, 0.0f, 0.0f,  1.0f,
+                         -0.5f, -0.5f, 0.0f, 0.0f,  0.0f,
+                         0.5f, -0.5f, 0.0f, 1.0f,  0.0f,
+                         0.5f,  0.5f, 0.0f, 1.0f,  1.0f };
+    uint16_t indices[] = { 0, 1, 2, 0, 2, 3, // The two triangles that make up the layer quad.
                            0, 1, 2, 3}; // A line path for drawing the layer border.
 
-    GLuint vboIds[2];
-    GLC(glGenBuffers(2, vboIds));
-    m_quadVerticesVbo = vboIds[0];
-    m_quadElementsVbo = vboIds[1];
-    GLC(glBindBuffer(GL_ARRAY_BUFFER, m_quadVerticesVbo));
-    GLC(glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW));
-    GLC(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_quadElementsVbo));
-    GLC(glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW));
+    GLC(m_context, m_quadVerticesVbo = m_context->createBuffer());
+    GLC(m_context, m_quadElementsVbo = m_context->createBuffer());
+    GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_quadVerticesVbo));
+    GLC(m_context, m_context->bufferData(GraphicsContext3D::ARRAY_BUFFER, sizeof(vertices), vertices, GraphicsContext3D::STATIC_DRAW));
+    GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, m_quadElementsVbo));
+    GLC(m_context, m_context->bufferData(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GraphicsContext3D::STATIC_DRAW));
 
     // Get the max texture size supported by the system.
-    GLC(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize));
+    GLC(m_context, m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &m_maxTextureSize));
 
     // Shaders for drawing the debug borders around the layers.
     char borderVertexShaderString[] =
@@ -112,14 +112,14 @@ LayerChromium::SharedValues::SharedValues()
         "  gl_FragColor = vec4(color.xyz * color.w, color.w);\n"
         "}                                                   \n";
 
-    m_borderShaderProgram = createShaderProgram(borderVertexShaderString, borderFragmentShaderString);
+    m_borderShaderProgram = createShaderProgram(m_context, borderVertexShaderString, borderFragmentShaderString);
     if (!m_borderShaderProgram) {
         LOG_ERROR("ContentLayerChromium: Failed to create shader program");
         return;
     }
 
-    m_borderShaderMatrixLocation = glGetUniformLocation(m_borderShaderProgram, "matrix");
-    m_borderShaderColorLocation = glGetUniformLocation(m_borderShaderProgram, "color");
+    m_borderShaderMatrixLocation = m_context->getUniformLocation(m_borderShaderProgram, "matrix");
+    m_borderShaderColorLocation = m_context->getUniformLocation(m_borderShaderProgram, "color");
     ASSERT(m_borderShaderMatrixLocation != -1);
     ASSERT(m_borderShaderColorLocation != -1);
 
@@ -128,11 +128,10 @@ LayerChromium::SharedValues::SharedValues()
 
 LayerChromium::SharedValues::~SharedValues()
 {
-    GLuint vboIds[2] = { m_quadVerticesVbo, m_quadElementsVbo };
-    GLC(glDeleteBuffers(2, vboIds));
-
+    GLC(m_context, m_context->deleteBuffer(m_quadVerticesVbo));
+    GLC(m_context, m_context->deleteBuffer(m_quadElementsVbo));
     if (m_borderShaderProgram)
-        GLC(glDeleteProgram(m_borderShaderProgram));
+        GLC(m_context, m_context->deleteProgram(m_borderShaderProgram));
 }
 
 
@@ -181,45 +180,45 @@ void LayerChromium::setLayerRenderer(LayerRendererChromium* renderer)
     m_layerRenderer = renderer;
 }
 
-unsigned LayerChromium::createShaderProgram(const char* vertexShaderSource, const char* fragmentShaderSource)
+unsigned LayerChromium::createShaderProgram(GraphicsContext3D* context, const char* vertexShaderSource, const char* fragmentShaderSource)
 {
-    GLuint vertexShader = loadShader(GL_VERTEX_SHADER, vertexShaderSource);
+    unsigned vertexShader = loadShader(context, GraphicsContext3D::VERTEX_SHADER, vertexShaderSource);
     if (!vertexShader) {
         LOG_ERROR("Failed to create vertex shader");
         return 0;
     }
 
-    GLuint fragmentShader = loadShader(GL_FRAGMENT_SHADER, fragmentShaderSource);
+    unsigned fragmentShader = loadShader(context, GraphicsContext3D::FRAGMENT_SHADER, fragmentShaderSource);
     if (!fragmentShader) {
-        GLC(glDeleteShader(vertexShader));
+        GLC(context, context->deleteShader(vertexShader));
         LOG_ERROR("Failed to create fragment shader");
         return 0;
     }
 
-    GLuint programObject = glCreateProgram();
+    unsigned programObject = context->createProgram();
     if (!programObject) {
         LOG_ERROR("Failed to create shader program");
         return 0;
     }
 
-    GLC(glAttachShader(programObject, vertexShader));
-    GLC(glAttachShader(programObject, fragmentShader));
+    GLC(context, context->attachShader(programObject, vertexShader));
+    GLC(context, context->attachShader(programObject, fragmentShader));
 
     // Bind the common attrib locations.
-    GLC(glBindAttribLocation(programObject, s_positionAttribLocation, "a_position"));
-    GLC(glBindAttribLocation(programObject, s_texCoordAttribLocation, "a_texCoord"));
+    GLC(context, context->bindAttribLocation(programObject, s_positionAttribLocation, "a_position"));
+    GLC(context, context->bindAttribLocation(programObject, s_texCoordAttribLocation, "a_texCoord"));
 
-    GLC(glLinkProgram(programObject));
-    GLint linked;
-    GLC(glGetProgramiv(programObject, GL_LINK_STATUS, &linked));
+    GLC(context, context->linkProgram(programObject));
+    int linked;
+    GLC(context, context->getProgramiv(programObject, GraphicsContext3D::LINK_STATUS, &linked));
     if (!linked) {
         LOG_ERROR("Failed to link shader program");
-        GLC(glDeleteProgram(programObject));
+        GLC(context, context->deleteProgram(programObject));
         return 0;
     }
 
-    GLC(glDeleteShader(vertexShader));
-    GLC(glDeleteShader(fragmentShader));
+    GLC(context, context->deleteShader(vertexShader));
+    GLC(context, context->deleteShader(fragmentShader));
     return programObject;
 }
 
@@ -393,11 +392,17 @@ void LayerChromium::toGLMatrix(float* flattened, const TransformationMatrix& m)
     flattened[15] = m.m44();
 }
 
-void LayerChromium::drawTexturedQuad(const TransformationMatrix& projectionMatrix, const TransformationMatrix& drawMatrix,
+GraphicsContext3D* LayerChromium::layerRendererContext() const
+{
+    ASSERT(layerRenderer());
+    return layerRenderer()->context();
+}
+
+void LayerChromium::drawTexturedQuad(GraphicsContext3D* context, const TransformationMatrix& projectionMatrix, const TransformationMatrix& drawMatrix,
                                      float width, float height, float opacity,
                                      int matrixLocation, int alphaLocation)
 {
-    static GLfloat glMatrix[16];
+    static float glMatrix[16];
 
     TransformationMatrix renderMatrix = drawMatrix;
 
@@ -409,17 +414,17 @@ void LayerChromium::drawTexturedQuad(const TransformationMatrix& projectionMatri
 
     toGLMatrix(&glMatrix[0], renderMatrix);
 
-    GLC(glUniformMatrix4fv(matrixLocation, 1, false, &glMatrix[0]));
+    GLC(context, context->uniformMatrix4fv(matrixLocation, false, &glMatrix[0], 1));
 
     if (alphaLocation != -1)
-        GLC(glUniform1f(alphaLocation, opacity));
+        GLC(context, context->uniform1f(alphaLocation, opacity));
 
-    GLC(glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0));
+    GLC(context, context->drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0));
 }
 
 void LayerChromium::drawDebugBorder()
 {
-    static GLfloat glMatrix[16];
+    static float glMatrix[16];
     if (!borderColor().alpha())
         return;
 
@@ -431,14 +436,15 @@ void LayerChromium::drawDebugBorder()
     renderMatrix.scale3d(bounds().width(), bounds().height(), 1);
     renderMatrix.multiply(layerRenderer()->projectionMatrix());
     toGLMatrix(&glMatrix[0], renderMatrix);
-    GLC(glUniformMatrix4fv(sv->borderShaderMatrixLocation(), 1, false, &glMatrix[0]));
+    GraphicsContext3D* context = layerRendererContext();
+    GLC(context, context->uniformMatrix4fv(sv->borderShaderMatrixLocation(), false, &glMatrix[0], 1));
 
-    GLC(glUniform4f(sv->borderShaderColorLocation(), borderColor().red() / 255.0, borderColor().green() / 255.0, borderColor().blue() / 255.0, 1));
+    GLC(context, context->uniform4f(sv->borderShaderColorLocation(), borderColor().red() / 255.0, borderColor().green() / 255.0, borderColor().blue() / 255.0, 1));
 
-    GLC(glLineWidth(borderWidth()));
+    GLC(context, context->lineWidth(borderWidth()));
 
     // The indices for the line are stored in the same array as the triangle indices.
-    GLC(glDrawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, (void*)(6 * sizeof(unsigned short))));
+    GLC(context, context->drawElements(GraphicsContext3D::LINE_LOOP, 4, GraphicsContext3D::UNSIGNED_SHORT, 6 * sizeof(unsigned short)));
 }
 
 const FloatRect LayerChromium::getDrawRect() const
@@ -465,24 +471,26 @@ void LayerChromium::drawAsMask()
     // We reuse the border shader here as all we need a single colored shader pass.
     // The color specified here is only for debug puproses as typically when we call this
     // method, writes to the color channels are disabled.
-    GLC(glUniform4f(sv->borderShaderColorLocation(), 0, 1 , 0, 0.7));
+    GraphicsContext3D* context = layerRendererContext();
+    GLC(context, context->uniform4f(sv->borderShaderColorLocation(), 0, 1 , 0, 0.7));
 
-    drawTexturedQuad(layerRenderer()->projectionMatrix(), drawTransform(),
-        bounds().width(), bounds().height(), drawOpacity(),
-        sv->borderShaderMatrixLocation(), -1);
+    drawTexturedQuad(context, layerRenderer()->projectionMatrix(), drawTransform(),
+                     bounds().width(), bounds().height(), drawOpacity(),
+                     sv->borderShaderMatrixLocation(), -1);
 }
 
 // static
 void LayerChromium::prepareForDraw(const SharedValues* sv)
 {
-    GLC(glBindBuffer(GL_ARRAY_BUFFER, sv->quadVerticesVbo()));
-    GLC(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, sv->quadElementsVbo()));
-    GLuint offset = 0;
-    GLC(glVertexAttribPointer(s_positionAttribLocation, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)offset));
-    offset += 3 * sizeof(GLfloat);
-    GLC(glVertexAttribPointer(s_texCoordAttribLocation, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)offset));
-    GLC(glEnableVertexAttribArray(s_positionAttribLocation));
-    GLC(glEnableVertexAttribArray(s_texCoordAttribLocation));
+    GraphicsContext3D* context = sv->context();
+    GLC(context, context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, sv->quadVerticesVbo()));
+    GLC(context, context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, sv->quadElementsVbo()));
+    unsigned offset = 0;
+    GLC(context, context->vertexAttribPointer(s_positionAttribLocation, 3, GraphicsContext3D::FLOAT, false, 5 * sizeof(float), offset));
+    offset += 3 * sizeof(float);
+    GLC(context, context->vertexAttribPointer(s_texCoordAttribLocation, 2, GraphicsContext3D::FLOAT, false, 5 * sizeof(float), offset));
+    GLC(context, context->enableVertexAttribArray(s_positionAttribLocation));
+    GLC(context, context->enableVertexAttribArray(s_texCoordAttribLocation));
 }
 
 }
diff --git a/WebCore/platform/graphics/chromium/LayerChromium.h b/WebCore/platform/graphics/chromium/LayerChromium.h
index 2d225da..5a493e6 100644
--- a/WebCore/platform/graphics/chromium/LayerChromium.h
+++ b/WebCore/platform/graphics/chromium/LayerChromium.h
@@ -171,9 +171,10 @@ public:
     // context).
     class SharedValues {
     public:
-        SharedValues();
+        explicit SharedValues(GraphicsContext3D*);
         ~SharedValues();
 
+        GraphicsContext3D* context() const { return m_context; }
         unsigned quadVerticesVbo() const { return m_quadVerticesVbo; }
         unsigned quadElementsVbo() const { return m_quadElementsVbo; }
         int maxTextureSize() const { return m_maxTextureSize; }
@@ -183,6 +184,7 @@ public:
         bool initialized() const { return m_initialized; }
 
     private:
+        GraphicsContext3D* m_context;
         unsigned m_quadVerticesVbo;
         unsigned m_quadElementsVbo;
         int m_maxTextureSize;
@@ -199,14 +201,15 @@ protected:
     LayerChromium(GraphicsLayerChromium* owner);
 
     LayerRendererChromium* layerRenderer() const { return m_layerRenderer; }
+    GraphicsContext3D* layerRendererContext() const;
 
-    static void drawTexturedQuad(const TransformationMatrix& projectionMatrix, const TransformationMatrix& layerMatrix,
+    static void drawTexturedQuad(GraphicsContext3D*, const TransformationMatrix& projectionMatrix, const TransformationMatrix& layerMatrix,
                                  float width, float height, float opacity,
                                  int matrixLocation, int alphaLocation);
 
     static void toGLMatrix(float*, const TransformationMatrix&);
 
-    static unsigned createShaderProgram(const char* vertexShaderSource, const char* fragmentShaderSource);
+    static unsigned createShaderProgram(GraphicsContext3D*, const char* vertexShaderSource, const char* fragmentShaderSource);
 
     IntSize m_bounds;
     FloatRect m_dirtyRect;
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
index 4fac991..116a15d 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
@@ -35,7 +35,7 @@
 #include "LayerRendererChromium.h"
 
 #include "Canvas2DLayerChromium.h"
-#include "GLES2Context.h"
+#include "GraphicsContext3D.h"
 #include "LayerChromium.h"
 #include "NotImplemented.h"
 #include "WebGLLayerChromium.h"
@@ -46,8 +46,6 @@
 #include <CoreGraphics/CGBitmapContext.h>
 #endif
 
-#include <GLES2/gl2.h>
-
 namespace WebCore {
 
 static TransformationMatrix orthoMatrix(float left, float right, float bottom, float top, float nearZ, float farZ)
@@ -75,19 +73,19 @@ static inline bool compareLayerZ(const LayerChromium* a, const LayerChromium* b)
     return transformA.m43() < transformB.m43();
 }
 
-PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(PassOwnPtr<GLES2Context> gles2Context)
+PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(PassOwnPtr<GraphicsContext3D> context)
 {
-    if (!gles2Context)
+    if (!context)
         return 0;
 
-    OwnPtr<LayerRendererChromium> layerRenderer(new LayerRendererChromium(gles2Context));
+    OwnPtr<LayerRendererChromium> layerRenderer(new LayerRendererChromium(context));
     if (!layerRenderer->hardwareCompositing())
         return 0;
 
     return layerRenderer.release();
 }
 
-LayerRendererChromium::LayerRendererChromium(PassOwnPtr<GLES2Context> gles2Context)
+LayerRendererChromium::LayerRendererChromium(PassOwnPtr<GraphicsContext3D> context)
     : m_rootLayerTextureId(0)
     , m_rootLayerTextureWidth(0)
     , m_rootLayerTextureHeight(0)
@@ -96,7 +94,7 @@ LayerRendererChromium::LayerRendererChromium(PassOwnPtr<GLES2Context> gles2Conte
     , m_needsDisplay(false)
     , m_scrollPosition(IntPoint(-1, -1))
     , m_currentShader(0)
-    , m_gles2Context(gles2Context)
+    , m_context(context)
 {
     m_hardwareCompositing = initializeSharedObjects();
 }
@@ -106,11 +104,16 @@ LayerRendererChromium::~LayerRendererChromium()
     cleanupSharedObjects();
 }
 
-void LayerRendererChromium::debugGLCall(const char* command, const char* file, int line)
+GraphicsContext3D* LayerRendererChromium::context()
 {
-    GLenum error = glGetError();
-    if (error != GL_NO_ERROR)
-        LOG_ERROR("GL command failed: File: %s\n\tLine %d\n\tcommand: %s, error %x\n", file, line, command, error);
+    return m_context.get();
+}
+
+void LayerRendererChromium::debugGLCall(GraphicsContext3D* context, const char* command, const char* file, int line)
+{
+    unsigned long error = context->getError();
+    if (error != GraphicsContext3D::NO_ERROR)
+        LOG_ERROR("GL command failed: File: %s\n\tLine %d\n\tcommand: %s, error %x\n", file, line, command, static_cast<int>(error));
 }
 
 // Creates a canvas and an associated graphics context that the root layer will
@@ -151,7 +154,7 @@ void LayerRendererChromium::setRootLayerCanvasSize(const IntSize& size)
 void LayerRendererChromium::useShader(unsigned programId)
 {
     if (programId != m_currentShader) {
-        GLC(glUseProgram(programId));
+        GLC(m_context, m_context->useProgram(programId));
         m_currentShader = programId;
     }
 }
@@ -168,7 +171,7 @@ void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, cons
 
     makeContextCurrent();
 
-    GLC(glBindTexture(GL_TEXTURE_2D, m_rootLayerTextureId));
+    GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_rootLayerTextureId));
 
     // If the size of the visible area has changed then allocate a new texture
     // to store the contents of the root layer and adjust the projection matrix
@@ -180,20 +183,20 @@ void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, cons
         m_rootLayerTextureHeight = visibleRect.height();
 
         m_projectionMatrix = orthoMatrix(0, visibleRectWidth, visibleRectHeight, 0, -1000, 1000);
-        GLC(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_rootLayerTextureWidth, m_rootLayerTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0));
+        GLC(m_context, m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, m_rootLayerTextureWidth, m_rootLayerTextureHeight, 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, 0));
     }
 
     // The GL viewport covers the entire visible area, including the scrollbars.
-    GLC(glViewport(0, 0, visibleRectWidth, visibleRectHeight));
+    GLC(m_context, m_context->viewport(0, 0, visibleRectWidth, visibleRectHeight));
 
     // Bind the common vertex attributes used for drawing all the layers.
     LayerChromium::prepareForDraw(layerSharedValues());
 
     // FIXME: These calls can be made once, when the compositor context is initialized.
-    GLC(glDisable(GL_DEPTH_TEST));
-    GLC(glDisable(GL_CULL_FACE));
-    GLC(glDepthFunc(GL_LEQUAL));
-    GLC(glClearStencil(0));
+    GLC(m_context, m_context->disable(GraphicsContext3D::DEPTH_TEST));
+    GLC(m_context, m_context->disable(GraphicsContext3D::CULL_FACE));
+    GLC(m_context, m_context->depthFunc(GraphicsContext3D::LEQUAL));
+    GLC(m_context, m_context->clearStencil(0));
 
     if (m_scrollPosition == IntPoint(-1, -1))
         m_scrollPosition = scrollPosition;
@@ -212,12 +215,12 @@ void LayerRendererChromium::prepareToDrawLayers(const IntRect& visibleRect, cons
         scrolledLayerMatrix.scale3d(1, -1, 1);
 
         useShader(m_scrollShaderProgram);
-        GLC(glUniform1i(m_scrollShaderSamplerLocation, 0));
-        LayerChromium::drawTexturedQuad(m_projectionMatrix, scrolledLayerMatrix,
+        GLC(m_context, m_context->uniform1i(m_scrollShaderSamplerLocation, 0));
+        LayerChromium::drawTexturedQuad(m_context.get(), m_projectionMatrix, scrolledLayerMatrix,
                                         visibleRect.width(), visibleRect.height(), 1,
                                         m_scrollShaderMatrixLocation, -1);
 
-        GLC(glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, contentRect.width(), contentRect.height()));
+        GLC(m_context, m_context->copyTexSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, 0, 0, contentRect.width(), contentRect.height()));
         m_scrollPosition = scrollPosition;
     } else if (abs(scrollDelta.y()) > contentRect.height() || abs(scrollDelta.x()) > contentRect.width()) {
         // Scrolling larger than the contentRect size does not preserve any of the pixels, so there is
@@ -244,7 +247,7 @@ void LayerRendererChromium::updateRootLayerTextureRect(const IntRect& updateRect
     if (!m_rootLayer)
         return;
 
-    GLC(glBindTexture(GL_TEXTURE_2D, m_rootLayerTextureId));
+    GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_rootLayerTextureId));
 
     // Update the root layer texture.
     ASSERT((updateRect.right()  <= m_rootLayerTextureWidth)
@@ -265,40 +268,40 @@ void LayerRendererChromium::updateRootLayerTextureRect(const IntRect& updateRect
 #error "Need to implement for your platform."
 #endif
     // Copy the contents of the updated rect to the root layer texture.
-    GLC(glTexSubImage2D(GL_TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, pixels));
+    GLC(m_context, m_context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels));
 }
 
 void LayerRendererChromium::drawLayers(const IntRect& visibleRect, const IntRect& contentRect)
 {
     ASSERT(m_hardwareCompositing);
 
-    glClearColor(0, 0, 1, 1);
-    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+    m_context->clearColor(0, 0, 1, 1);
+    m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT | GraphicsContext3D::DEPTH_BUFFER_BIT);
 
-    GLC(glBindTexture(GL_TEXTURE_2D, m_rootLayerTextureId));
+    GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_rootLayerTextureId));
 
     // Render the root layer using a quad that takes up the entire visible area of the window.
     // We reuse the shader program used by ContentLayerChromium.
     const ContentLayerChromium::SharedValues* contentLayerValues = contentLayerSharedValues();
     useShader(contentLayerValues->contentShaderProgram());
-    GLC(glUniform1i(contentLayerValues->shaderSamplerLocation(), 0));
+    GLC(m_context, m_context->uniform1i(contentLayerValues->shaderSamplerLocation(), 0));
     TransformationMatrix layerMatrix;
     layerMatrix.translate3d(visibleRect.width() * 0.5f, visibleRect.height() * 0.5f, 0);
-    LayerChromium::drawTexturedQuad(m_projectionMatrix, layerMatrix,
+    LayerChromium::drawTexturedQuad(m_context.get(), m_projectionMatrix, layerMatrix,
                                     visibleRect.width(), visibleRect.height(), 1,
                                     contentLayerValues->shaderMatrixLocation(), contentLayerValues->shaderAlphaLocation());
 
     // If culling is enabled then we will cull the backface.
-    GLC(glCullFace(GL_BACK));
+    GLC(m_context, m_context->cullFace(GraphicsContext3D::BACK));
     // The orthographic projection is setup such that Y starts at zero and
     // increases going down the page so we need to adjust the winding order of
     // front facing triangles.
-    GLC(glFrontFace(GL_CW));
+    GLC(m_context, m_context->frontFace(GraphicsContext3D::CW));
 
     // The shader used to render layers returns pre-multiplied alpha colors
     // so we need to send the blending mode appropriately.
-    GLC(glEnable(GL_BLEND));
-    GLC(glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA));
+    GLC(m_context, m_context->enable(GraphicsContext3D::BLEND));
+    GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA));
 
     // Set the rootVisibleRect --- used by subsequent drawLayers calls
     m_rootVisibleRect = visibleRect;
@@ -315,7 +318,7 @@ void LayerRendererChromium::drawLayers(const IntRect& visibleRect, const IntRect
         updateLayersRecursive(sublayers[i].get(), matrix, opacity);
 
     // Enable scissoring to avoid rendering composited layers over the scrollbars.
-    GLC(glEnable(GL_SCISSOR_TEST));
+    GLC(m_context, m_context->enable(GraphicsContext3D::SCISSOR_TEST));
     FloatRect scissorRect(contentRect);
 
     // The scissorRect should not include the scroll offset.
@@ -323,26 +326,29 @@ void LayerRendererChromium::drawLayers(const IntRect& visibleRect, const IntRect
     scissorToRect(scissorRect);
 
     // Clear the stencil buffer to 0.
-    GLC(glClear(GL_STENCIL_BUFFER_BIT));
+    GLC(m_context, m_context->clear(GraphicsContext3D::STENCIL_BUFFER_BIT));
     // Disable writes to the stencil buffer.
-    GLC(glStencilMask(0));
+    GLC(m_context, m_context->stencilMask(0));
 
     // Traverse the layer tree one more time to draw the layers.
     for (size_t i = 0; i < sublayers.size(); i++)
         drawLayersRecursive(sublayers[i].get(), scissorRect);
 
-    GLC(glDisable(GL_SCISSOR_TEST));
+    GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST));
 }
 
 void LayerRendererChromium::finish()
 {
-    glFinish();
+    m_context->finish();
 }
 
 void LayerRendererChromium::present()
 {
     // We're done! Time to swapbuffers!
-    m_gles2Context->swapBuffers();
+
+    // Note that currently this has the same effect as swapBuffers; we should
+    // consider exposing a different entry point on GraphicsContext3D.
+    m_context->prepareTexture();
     m_needsDisplay = false;
 }
 
@@ -356,22 +362,22 @@ void LayerRendererChromium::getFramebufferPixels(void *pixels, const IntRect& re
 
     makeContextCurrent();
 
-    GLC(glReadPixels(rect.x(), rect.y(), rect.width(), rect.height(),
-                     GL_RGBA, GL_UNSIGNED_BYTE, pixels));
+    GLC(m_context, m_context->readPixels(rect.x(), rect.y(), rect.width(), rect.height(),
+                                         GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels));
 }
 
 // FIXME: This method should eventually be replaced by a proper texture manager.
 unsigned LayerRendererChromium::createLayerTexture()
 {
-    GLuint textureId = 0;
-    GLC(glGenTextures(1, &textureId));
-    GLC(glBindTexture(GL_TEXTURE_2D, textureId));
+    unsigned textureId = 0;
+    GLC(m_context, textureId = m_context->createTexture());
+    GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId));
     // Do basic linear filtering on resize.
-    GLC(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
-    GLC(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
-    // NPOT textures in GL ES only work when the wrap mode is set to GL_CLAMP_TO_EDGE.
-    GLC(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
-    GLC(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
+    GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
+    GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
+    // NPOT textures in GL ES only work when the wrap mode is set to GraphicsContext3D::CLAMP_TO_EDGE.
+    GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
+    GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
     return textureId;
 }
 
@@ -470,18 +476,18 @@ void LayerRendererChromium::drawLayerIntoStencilBuffer(LayerChromium* layer, boo
 {
     // Enable writes to the stencil buffer and increment the stencil values
     // by one for every pixel under the current layer.
-    GLC(glStencilMask(0xff));
-    GLC(glStencilFunc(GL_ALWAYS, 1, 0xff));
-    GLenum stencilOp = (decrement ? GL_DECR : GL_INCR);
-    GLC(glStencilOp(stencilOp, stencilOp, stencilOp));
+    GLC(m_context, m_context->stencilMask(0xff));
+    GLC(m_context, m_context->stencilFunc(GraphicsContext3D::ALWAYS, 1, 0xff));
+    unsigned stencilOp = (decrement ? GraphicsContext3D::DECR : GraphicsContext3D::INCR);
+    GLC(m_context, m_context->stencilOp(stencilOp, stencilOp, stencilOp));
 
-    GLC(glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE));
+    GLC(m_context, m_context->colorMask(false, false, false, false));
 
     layer->drawAsMask();
 
     // Disable writes to the stencil buffer.
-    GLC(glStencilMask(0));
-    GLC(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE));
+    GLC(m_context, m_context->stencilMask(0));
+    GLC(m_context, m_context->colorMask(true, true, true, true));
 }
 
 // Recursively walk the layer tree and draw the layers.
@@ -498,7 +504,7 @@ void LayerRendererChromium::drawLayersRecursive(LayerChromium* layer, const Floa
     bool mustClearDepth = false;
     if (layer->preserves3D()) {
         if (!depthTestEnabledForSubtree) {
-            GLC(glEnable(GL_DEPTH_TEST));
+            GLC(m_context, m_context->enable(GraphicsContext3D::DEPTH_TEST));
             depthTestEnabledForSubtree = true;
 
             // Need to clear the depth buffer when we're done rendering this subtree.
@@ -535,7 +541,7 @@ void LayerRendererChromium::drawLayersRecursive(LayerChromium* layer, const Floa
             // is rendered, the stencil values should be all back to zero. An 8 bit stencil buffer
             // will allow us up to 255 nested clipping layers which is hopefully enough.
             if (!currentStencilValue)
-                GLC(glEnable(GL_STENCIL_TEST));
+                GLC(m_context, m_context->enable(GraphicsContext3D::STENCIL_TEST));
 
             drawLayerIntoStencilBuffer(layer, false);
 
@@ -547,7 +553,7 @@ void LayerRendererChromium::drawLayersRecursive(LayerChromium* layer, const Floa
     // currentStencilValue.
     if (didStencilDraw) {
         // The sublayers will render only if the stencil test passes.
-        GLC(glStencilFunc(GL_EQUAL, currentStencilValue, 0xff));
+        GLC(m_context, m_context->stencilFunc(GraphicsContext3D::EQUAL, currentStencilValue, 0xff));
     }
 
     // If we're using depth testing then we need to sort the children in Z to
@@ -578,8 +584,8 @@ void LayerRendererChromium::drawLayersRecursive(LayerChromium* layer, const Floa
         currentStencilValue--;
         if (!currentStencilValue) {
             // Disable stencil testing.
-            GLC(glDisable(GL_STENCIL_TEST));
-            GLC(glStencilFunc(GL_ALWAYS, 0, 0xff));
+            GLC(m_context, m_context->disable(GraphicsContext3D::STENCIL_TEST));
+            GLC(m_context, m_context->stencilFunc(GraphicsContext3D::ALWAYS, 0, 0xff));
         }
     }
 
@@ -588,8 +594,8 @@ void LayerRendererChromium::drawLayersRecursive(LayerChromium* layer, const Floa
     }
 
     if (mustClearDepth) {
-        GLC(glDisable(GL_DEPTH_TEST));
-        GLC(glClear(GL_DEPTH_BUFFER_BIT));
+        GLC(m_context, m_context->disable(GraphicsContext3D::DEPTH_TEST));
+        GLC(m_context, m_context->clear(GraphicsContext3D::DEPTH_BUFFER_BIT));
         depthTestEnabledForSubtree = false;
     }
 }
@@ -603,13 +609,13 @@ void LayerRendererChromium::drawLayer(LayerChromium* layer)
         if (layer->contentsDirty()) {
             // Update the backing texture contents for any dirty portion of the layer.
             layer->updateContents();
-            m_gles2Context->makeCurrent();
+            m_context->makeContextCurrent();
         }
 
         if (layer->doubleSided())
-            glDisable(GL_CULL_FACE);
+            m_context->disable(GraphicsContext3D::CULL_FACE);
         else
-            glEnable(GL_CULL_FACE);
+            m_context->enable(GraphicsContext3D::CULL_FACE);
 
         layer->draw();
     }
@@ -624,12 +630,13 @@ void LayerRendererChromium::scissorToRect(const FloatRect& scissorRect)
 {
     // Compute the lower left corner of the scissor rect.
     float bottom = std::max((float)m_rootVisibleRect.height() - scissorRect.bottom(), 0.f);
-    GLC(glScissor(scissorRect.x(), bottom, scissorRect.width(), scissorRect.height()));
+    GLC(m_context, m_context->scissor(scissorRect.x(), bottom, scissorRect.width(), scissorRect.height()));
 }
 
 bool LayerRendererChromium::makeContextCurrent()
 {
-    return m_gles2Context->makeCurrent();
+    m_context->makeContextCurrent();
+    return true;
 }
 
 // Checks whether a given size is within the maximum allowed texture size range.
@@ -640,6 +647,12 @@ bool LayerRendererChromium::checkTextureSize(const IntSize& textureSize)
     return true;
 }
 
+void LayerRendererChromium::resizeOnscreenContent(const IntSize& size)
+{
+    if (m_context)
+        m_context->reshape(size.width(), size.height());
+}
+
 bool LayerRendererChromium::initializeSharedObjects()
 {
     makeContextCurrent();
@@ -667,15 +680,15 @@ bool LayerRendererChromium::initializeSharedObjects()
         "  gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w); \n"
         "}                                                   \n";
 
-    m_scrollShaderProgram = LayerChromium::createShaderProgram(scrollVertexShaderString, scrollFragmentShaderString);
+    m_scrollShaderProgram = LayerChromium::createShaderProgram(m_context.get(), scrollVertexShaderString, scrollFragmentShaderString);
     if (!m_scrollShaderProgram) {
         LOG_ERROR("LayerRendererChromium: Failed to create scroll shader program");
         cleanupSharedObjects();
         return false;
     }
 
-    GLC(m_scrollShaderSamplerLocation = glGetUniformLocation(m_scrollShaderProgram, "s_texture"));
-    GLC(m_scrollShaderMatrixLocation = glGetUniformLocation(m_scrollShaderProgram, "matrix"));
+    GLC(m_context, m_scrollShaderSamplerLocation = m_context->getUniformLocation(m_scrollShaderProgram, "s_texture"));
+    GLC(m_context, m_scrollShaderMatrixLocation = m_context->getUniformLocation(m_scrollShaderProgram, "matrix"));
     if (m_scrollShaderSamplerLocation == -1 || m_scrollShaderMatrixLocation == -1) {
         LOG_ERROR("Failed to initialize scroll shader.");
         cleanupSharedObjects();
@@ -691,19 +704,19 @@ bool LayerRendererChromium::initializeSharedObjects()
     }
     // Turn off filtering for the root layer to avoid blurring from the repeated
     // writes and reads to the framebuffer that happen while scrolling.
-    GLC(glBindTexture(GL_TEXTURE_2D, m_rootLayerTextureId));
-    GLC(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
-    GLC(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
+    GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_rootLayerTextureId));
+    GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::NEAREST));
+    GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::NEAREST));
 
     // Get the max texture size supported by the system.
-    GLC(glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize));
+    GLC(m_context, m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &m_maxTextureSize));
 
     // Get the number of bits available in the stencil buffer.
-    GLC(glGetIntegerv(GL_STENCIL_BITS, &m_numStencilBits));
+    GLC(m_context, m_context->getIntegerv(GraphicsContext3D::STENCIL_BITS, &m_numStencilBits));
 
-    m_layerSharedValues = adoptPtr(new LayerChromium::SharedValues());
-    m_contentLayerSharedValues = adoptPtr(new ContentLayerChromium::SharedValues());
-    m_canvasLayerSharedValues = adoptPtr(new CanvasLayerChromium::SharedValues());
+    m_layerSharedValues = adoptPtr(new LayerChromium::SharedValues(m_context.get()));
+    m_contentLayerSharedValues = adoptPtr(new ContentLayerChromium::SharedValues(m_context.get()));
+    m_canvasLayerSharedValues = adoptPtr(new CanvasLayerChromium::SharedValues(m_context.get()));
     if (!m_layerSharedValues->initialized() || !m_contentLayerSharedValues->initialized() || !m_canvasLayerSharedValues->initialized()) {
         cleanupSharedObjects();
         return false;
@@ -721,12 +734,12 @@ void LayerRendererChromium::cleanupSharedObjects()
     m_canvasLayerSharedValues.clear();
 
     if (m_scrollShaderProgram) {
-        GLC(glDeleteProgram(m_scrollShaderProgram));
+        GLC(m_context, m_context->deleteProgram(m_scrollShaderProgram));
         m_scrollShaderProgram = 0;
     }
 
     if (m_rootLayerTextureId) {
-        GLC(glDeleteTextures(1, &m_rootLayerTextureId));
+        GLC(m_context, m_context->deleteTexture(m_rootLayerTextureId));
         m_rootLayerTextureId = 0;
     }
 }
diff --git a/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
index f4bd6f3..c733228 100644
--- a/WebCore/platform/graphics/chromium/LayerRendererChromium.h
+++ b/WebCore/platform/graphics/chromium/LayerRendererChromium.h
@@ -51,16 +51,18 @@
 
 namespace WebCore {
 
-class GLES2Context;
+class GraphicsContext3D;
 
 // Class that handles drawing of composited render layers using GL.
 class LayerRendererChromium : public Noncopyable {
 public:
-    static PassOwnPtr<LayerRendererChromium> create(PassOwnPtr<GLES2Context> gles2Context);
+    static PassOwnPtr<LayerRendererChromium> create(PassOwnPtr<GraphicsContext3D> graphicsContext3D);
 
-    LayerRendererChromium(PassOwnPtr<GLES2Context> gles2Context);
+    LayerRendererChromium(PassOwnPtr<GraphicsContext3D> graphicsContext3D);
     ~LayerRendererChromium();
 
+    GraphicsContext3D* context();
+
     // updates size of root texture, if needed, and scrolls the backbuffer.
     void prepareToDrawLayers(const IntRect& visibleRect, const IntRect& contentRect, const IntPoint& scrollPosition);
 
@@ -89,7 +91,7 @@ public:
 
     unsigned createLayerTexture();
 
-    static void debugGLCall(const char* command, const char* file, int line);
+    static void debugGLCall(GraphicsContext3D*, const char* command, const char* file, int line);
 
     const TransformationMatrix& projectionMatrix() const { return m_projectionMatrix; }
 
@@ -101,6 +103,8 @@ public:
     const ContentLayerChromium::SharedValues* contentLayerSharedValues() const { return m_contentLayerSharedValues.get(); }
     const CanvasLayerChromium::SharedValues* canvasLayerSharedValues() const { return m_canvasLayerSharedValues.get(); }
 
+    void resizeOnscreenContent(const IntSize&);
+
     IntSize rootLayerTextureSize() const { return IntSize(m_rootLayerTextureWidth, m_rootLayerTextureHeight); }
     void getFramebufferPixels(void *pixels, const IntRect& rect);
 
@@ -167,7 +171,7 @@ private:
     OwnPtr<ContentLayerChromium::SharedValues> m_contentLayerSharedValues;
     OwnPtr<CanvasLayerChromium::SharedValues> m_canvasLayerSharedValues;
 
-    OwnPtr<GLES2Context> m_gles2Context;
+    OwnPtr<GraphicsContext3D> m_context;
 };
 
 // Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL
@@ -176,9 +180,9 @@ private:
 #define DEBUG_GL_CALLS 0
 
 #if DEBUG_GL_CALLS && !defined ( NDEBUG )
-#define GLC(x) { (x), LayerRendererChromium::debugGLCall(#x, __FILE__, __LINE__); }
+#define GLC(context, x) { (x), LayerRendererChromium::debugGLCall(context, #x, __FILE__, __LINE__); }
 #else
-#define GLC(x) (x)
+#define GLC(context, x) (x)
 #endif
 
 
diff --git a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
index c0da285..0fb1bb4 100644
--- a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
@@ -33,14 +33,11 @@
 #if USE(ACCELERATED_COMPOSITING)
 #include "VideoLayerChromium.h"
 
+#include "GraphicsContext3D.h"
 #include "LayerRendererChromium.h"
 #include "RenderLayerBacking.h"
 #include "skia/ext/platform_canvas.h"
 
-#include <GLES2/gl2.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GLES2/gl2ext.h>
-
 #if PLATFORM(SKIA)
 #include "NativeImageSkia.h"
 #include "PlatformContextSkia.h"
@@ -153,9 +150,10 @@ void VideoLayerChromium::createTextureRect(const IntSize& requiredTextureSize, c
     if (!pixels)
         return;
 
-    glBindTexture(GL_TEXTURE_2D, textureId);
+    GraphicsContext3D* context = layerRendererContext();
+    context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId);
     ASSERT(bitmapSize == requiredTextureSize);
-    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, requiredTextureSize.width(), requiredTextureSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+    context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, requiredTextureSize.width(), requiredTextureSize.height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels);
 
     m_contentsTexture = textureId;
     m_allocatedTextureSize = requiredTextureSize;
@@ -174,11 +172,13 @@ void VideoLayerChromium::updateTextureRect(const IntRect& updateRect, unsigned t
     SkBitmap::Config skiaConfig = skiaBitmap->config();
 
     if (skiaConfig == SkBitmap::kARGB_8888_Config) {
-        glBindTexture(GL_TEXTURE_2D, textureId);
-        void* mem = glMapTexSubImage2D(GL_TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, GL_WRITE_ONLY);
+        GraphicsContext3D* context = layerRendererContext();
+        context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId);
+        ASSERT(context->supportsMapSubCHROMIUM());
+        void* mem = context->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, GraphicsContext3D::WRITE_ONLY);
         skiaBitmap->setPixels(mem);
         m_owner->paintGraphicsLayerContents(*m_graphicsContext, updateRect);
-        glUnmapTexSubImage2D(mem);
+        context->unmapTexSubImage2DCHROMIUM(mem);
     }
 
     updateCompleted();
diff --git a/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp b/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp
index 411f416..2055ae6 100644
--- a/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp
@@ -36,7 +36,6 @@
 
 #include "GraphicsContext3D.h"
 #include "LayerRendererChromium.h"
-#include <GLES2/gl2.h>
 
 namespace WebCore {
 
@@ -53,15 +52,16 @@ WebGLLayerChromium::WebGLLayerChromium(GraphicsLayerChromium* owner)
 
 void WebGLLayerChromium::updateContents()
 {
+    GraphicsContext3D* rendererContext = layerRendererContext();
     ASSERT(m_context);
     if (m_textureChanged) {
-        glBindTexture(GL_TEXTURE_2D, m_textureId);
+        rendererContext->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId);
         // Set the min-mag filters to linear and wrap modes to GL_CLAMP_TO_EDGE
         // to get around NPOT texture limitations of GLES.
-        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+        rendererContext->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR);
+        rendererContext->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR);
+        rendererContext->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE);
+        rendererContext->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE);
         m_textureChanged = false;
     }
     // Update the contents of the texture used by the compositor.
diff --git a/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp b/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp
index f4ab79e..7629735 100644
--- a/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp
+++ b/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp
@@ -114,6 +114,11 @@ void SharedGraphicsContext3D::getIntegerv(unsigned long pname, int* value)
     m_context->getIntegerv(pname, value);
 }
 
+void SharedGraphicsContext3D::flush()
+{
+    m_context->flush();
+}
+
 unsigned SharedGraphicsContext3D::createFramebuffer()
 {
     return m_context->createFramebuffer();
@@ -164,6 +169,17 @@ 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);
+}
+
 Texture* SharedGraphicsContext3D::createTexture(NativeImagePtr ptr, Texture::Format format, int width, int height)
 {
     RefPtr<Texture> texture = m_textures.get(ptr);
diff --git a/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h b/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h
index fcacb9e..3ba3c52 100644
--- a/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h
+++ b/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h
@@ -70,6 +70,7 @@ public:
     void drawArrays(unsigned long mode, long first, long count);
     unsigned long getError();
     void getIntegerv(unsigned long pname, int* value);
+    void flush();
 
     unsigned createFramebuffer();
     unsigned createTexture();
@@ -98,6 +99,10 @@ 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/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index ce9c19c..ee8e7f7 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,5 +1,35 @@
 2010-09-20  Kenneth Russell  <kbr at google.com>
 
+        Reviewed by James Robinson.
+
+        [chromium] Change compositor to use GraphicsContext3D rather than GLES2Context
+        https://bugs.webkit.org/show_bug.cgi?id=45912
+
+        Switched Chromium's compositor to use GraphicsContext3D to issue
+        its OpenGL rendering calls rather than the Chromium-specific
+        GLES2Context and command buffer OpenGL implementation.
+
+        The in-process software rendering path for GraphicsContext3D does
+        not yet work with the compositor, at least not on Mac OS X. This
+        will be worked on in subsequent bugs.
+
+        Tested manually with 3D CSS, WebGL and video content on Mac OS X
+        and Linux. No new tests.
+
+        * src/GraphicsContext3D.cpp:
+        (WebCore::GraphicsContext3DInternal::initialize):
+        (WebCore::GraphicsContext3DInternal::extractWebGraphicsContext3D):
+        (WebCore::GraphicsContext3D::create):
+        * src/GraphicsContext3DInternal.h:
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::resize):
+        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+        (WebKit::WebViewImpl::gles2Context):
+        (WebKit::WebViewImpl::graphicsContext3D):
+        * src/WebViewImpl.h:
+
+2010-09-20  Kenneth Russell  <kbr at google.com>
+
         Reviewed by Dimitri Glazkov.
 
         [chromium] Roll forward Chromium DEPS to pick up WebGraphicsContext3D implementation changes
diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp
index 027b4e4..c78d334 100644
--- a/WebKit/chromium/src/GraphicsContext3D.cpp
+++ b/WebKit/chromium/src/GraphicsContext3D.cpp
@@ -100,8 +100,7 @@ GraphicsContext3DInternal::~GraphicsContext3DInternal()
 #endif
 }
 
-bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs,
-                                           HostWindow* hostWindow)
+bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, bool renderDirectlyToHostWindow)
 {
     WebKit::WebGraphicsContext3D::Attributes webAttributes;
     webAttributes.alpha = attrs.alpha;
@@ -120,7 +119,7 @@ bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs,
 
     if (!m_webViewImpl)
         return false;
-    if (!webContext->initialize(webAttributes, m_webViewImpl)) {
+    if (!webContext->initialize(webAttributes, m_webViewImpl, renderDirectlyToHostWindow)) {
         delete webContext;
         return false;
     }
@@ -132,6 +131,13 @@ bool GraphicsContext3DInternal::initialize(GraphicsContext3D::Attributes attrs,
     return true;
 }
 
+WebKit::WebGraphicsContext3D* GraphicsContext3DInternal::extractWebGraphicsContext3D(GraphicsContext3D* context)
+{
+    if (!context)
+        return 0;
+    return context->m_internal->m_impl.get();
+}
+
 PlatformGraphicsContext3D GraphicsContext3DInternal::platformGraphicsContext3D() const
 {
     return m_impl.get();
@@ -797,14 +803,11 @@ GraphicsContext3D::~GraphicsContext3D()
 
 PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
 {
-    // FIXME: must pass down renderStyle argument when switching compositor to GraphicsContext3D.
-    if (renderStyle == RenderDirectlyToHostWindow)
-        return 0;
     OwnPtr<GraphicsContext3DInternal> internal = adoptPtr(new GraphicsContext3DInternal());
-    if (!internal->initialize(attrs, hostWindow)) {
+    if (!internal->initialize(attrs, hostWindow, renderStyle == RenderDirectlyToHostWindow)) {
         return 0;
     }
-    PassOwnPtr<GraphicsContext3D> result = new GraphicsContext3D(attrs, hostWindow, false);
+    PassOwnPtr<GraphicsContext3D> result = new GraphicsContext3D(attrs, hostWindow, renderStyle == RenderDirectlyToHostWindow);
     result->m_internal = internal.release();
     return result;
 }
diff --git a/WebKit/chromium/src/GraphicsContext3DInternal.h b/WebKit/chromium/src/GraphicsContext3DInternal.h
index c2393fc..f12fff0 100644
--- a/WebKit/chromium/src/GraphicsContext3DInternal.h
+++ b/WebKit/chromium/src/GraphicsContext3DInternal.h
@@ -48,7 +48,12 @@ public:
     GraphicsContext3DInternal();
     ~GraphicsContext3DInternal();
 
-    bool initialize(GraphicsContext3D::Attributes, HostWindow*);
+    bool initialize(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, bool renderDirectlyToHostWindow);
+
+    // Helper function to provide access to the lower-level WebGraphicsContext3D,
+    // which is needed for subordinate contexts like WebGL's to share resources
+    // with the compositor's context.
+    static WebKit::WebGraphicsContext3D* extractWebGraphicsContext3D(GraphicsContext3D* context);
 
     PlatformGraphicsContext3D platformGraphicsContext3D() const;
     Platform3DObject platformTexture() const;
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index a7bead4..a1c6578 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -56,10 +56,9 @@
 #include "FrameLoader.h"
 #include "FrameTree.h"
 #include "FrameView.h"
-#include "GLES2Context.h"
-#include "GLES2ContextInternal.h"
 #include "GraphicsContext.h"
 #include "GraphicsContext3D.h"
+#include "GraphicsContext3DInternal.h"
 #include "HTMLInputElement.h"
 #include "HTMLMediaElement.h"
 #include "HitTestResult.h"
@@ -927,9 +926,9 @@ void WebViewImpl::resize(const WebSize& newSize)
     }
 
 #if OS(DARWIN)
-    if (m_gles2Context) {
-        m_gles2Context->resizeOnscreenContent(WebSize(std::max(1, m_size.width),
-                                                      std::max(1, m_size.height)));
+    if (m_layerRenderer) {
+        m_layerRenderer->resizeOnscreenContent(WebCore::IntSize(std::max(1, m_size.width),
+                                                                std::max(1, m_size.height)));
     }
 #endif
 }
@@ -2303,7 +2302,13 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
         return;
 
     if (active) {
-        m_layerRenderer = LayerRendererChromium::create(getOnscreenGLES2Context());
+        OwnPtr<GraphicsContext3D> context = m_temporaryOnscreenGraphicsContext3D.release();
+        if (!context) {
+            context = GraphicsContext3D::create(GraphicsContext3D::Attributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
+            if (context)
+                context->reshape(std::max(1, m_size.width), std::max(1, m_size.height));
+        }
+        m_layerRenderer = LayerRendererChromium::create(context.release());
         if (m_layerRenderer) {
             m_isAcceleratedCompositingActive = true;
         } else {
@@ -2413,14 +2418,6 @@ void WebViewImpl::doComposite()
 #endif
 
 
-PassOwnPtr<GLES2Context> WebViewImpl::getOnscreenGLES2Context()
-{
-    WebGLES2Context* context = gles2Context();
-    if (!context)
-        return 0;
-    return GLES2Context::create(GLES2ContextInternal::create(context, false));
-}
-
 SharedGraphicsContext3D* WebViewImpl::getSharedGraphicsContext3D()
 {
     if (!m_sharedContext3D) {
@@ -2434,32 +2431,32 @@ SharedGraphicsContext3D* WebViewImpl::getSharedGraphicsContext3D()
     return m_sharedContext3D.get();
 }
 
-// Returns the GLES2 context associated with this View. If one doesn't exist
-// it will get created first.
 WebGLES2Context* WebViewImpl::gles2Context()
 {
-    if (!m_gles2Context) {
-        m_gles2Context = webKitClient()->createGLES2Context();
-        if (!m_gles2Context)
-            return 0;
-
-        if (!m_gles2Context->initialize(this, 0)) {
-            m_gles2Context.clear();
-            return 0;
-        }
-
-#if OS(DARWIN)
-        m_gles2Context->resizeOnscreenContent(WebSize(std::max(1, m_size.width),
-                                                      std::max(1, m_size.height)));
-#endif
-    }
-    return m_gles2Context.get();
+    return 0;
 }
 
 WebGraphicsContext3D* WebViewImpl::graphicsContext3D()
 {
-    // FIXME: implement this.
+#if USE(ACCELERATED_COMPOSITING)
+    GraphicsContext3D* context = 0;
+    if (m_layerRenderer)
+        context = m_layerRenderer->context();
+    else if (m_temporaryOnscreenGraphicsContext3D)
+        context = m_temporaryOnscreenGraphicsContext3D.get();
+    else {
+        GraphicsContext3D::Attributes attributes;
+        m_temporaryOnscreenGraphicsContext3D = GraphicsContext3D::create(GraphicsContext3D::Attributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
+#if OS(DARWIN)
+        if (m_temporaryOnscreenGraphicsContext3D)
+            m_temporaryOnscreenGraphicsContext3D->reshape(std::max(1, m_size.width), std::max(1, m_size.height));
+#endif
+        context = m_temporaryOnscreenGraphicsContext3D.get();
+    }
+    return GraphicsContext3DInternal::extractWebGraphicsContext3D(context);
+#else
     return 0;
+#endif
 }
 
 } // namespace WebKit
diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h
index 6e02f62..bbd25a2 100644
--- a/WebKit/chromium/src/WebViewImpl.h
+++ b/WebKit/chromium/src/WebViewImpl.h
@@ -31,7 +31,6 @@
 #ifndef WebViewImpl_h
 #define WebViewImpl_h
 
-#include "WebGLES2Context.h"
 #include "WebNavigationPolicy.h"
 #include "WebPoint.h"
 #include "WebRect.h"
@@ -44,6 +43,7 @@
 #include "ContextMenuClientImpl.h"
 #include "DragClientImpl.h"
 #include "EditorClientImpl.h"
+#include "GraphicsContext3D.h"
 #include "GraphicsLayer.h"
 #include "InspectorClientImpl.h"
 #include "IntRect.h"
@@ -56,7 +56,6 @@
 namespace WebCore {
 class ChromiumDataObject;
 class Frame;
-class GLES2Context;
 class HistoryItem;
 class HitTestResult;
 class KeyboardEvent;
@@ -333,14 +332,8 @@ public:
     void scrollRootLayerRect(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& clipRect);
     void invalidateRootLayerRect(const WebCore::IntRect&);
 #endif
-    // Onscreen contexts display to the screen associated with this view.
-    // Offscreen contexts render offscreen but can share resources with the
-    // onscreen context and thus can be composited.
-    // FIXME: remove this once the compositor is switched to use GraphicsContext3D.
-    PassOwnPtr<WebCore::GLES2Context> getOnscreenGLES2Context();
-
-    // Returns an onscreen context
-    // FIXME: remove this once the compositor is switched to use GraphicsContext3D.
+    // FIXME: remove this method once the compositor is fully switched
+    // over to GraphicsContext3D.
     virtual WebGLES2Context* gles2Context();
 
     // Returns the onscreen 3D context used by the compositor. This is
@@ -543,8 +536,10 @@ private:
 #if ENABLE(INPUT_SPEECH)
     SpeechInputClientImpl m_speechInputClient;
 #endif
-
-    OwnPtr<WebGLES2Context> m_gles2Context;
+    // If we attempt to fetch the on-screen GraphicsContext3D before
+    // the compositor has been turned on, we need to instantiate it
+    // early. This member holds on to the GC3D in this case.
+    OwnPtr<WebCore::GraphicsContext3D> m_temporaryOnscreenGraphicsContext3D;
 
     RefPtr<WebCore::SharedGraphicsContext3D> m_sharedContext3D;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list