Changeset 119313 in webkit


Ignore:
Timestamp:
Jun 1, 2012 11:07:26 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[chromium] Software compositor initialization and base classes
https://bugs.webkit.org/show_bug.cgi?id=87920

Patch by Alexandre Elias <aelias@google.com> on 2012-06-01
Reviewed by James Robinson.

Source/Platform:

Add a new setting to force software compositing. In this mode,
no GraphicsContext3D should ever be created.

  • chromium/public/WebLayerTreeView.h:

(WebKit::WebLayerTreeView::Settings::Settings):
(Settings):

Source/WebCore:

This introduces new wrapper class CCGraphicsContext and base class
CCRenderer which will be used for software compositing support.
If no GraphicsContext3D is available, early return for now.

No new tests. (No-op change in 3d mode.)

  • platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp:

(WebCore::BitmapCanvasLayerTextureUpdater::Texture::updateRect):
(WebCore::BitmapCanvasLayerTextureUpdater::updateTextureRect):

  • platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h:

(Texture):
(BitmapCanvasLayerTextureUpdater):

  • platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp:

(WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect):
(WebCore::BitmapSkPictureCanvasLayerTextureUpdater::updateTextureRect):

  • platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h:

(Texture):
(BitmapSkPictureCanvasLayerTextureUpdater):

  • platform/graphics/chromium/CanvasLayerTextureUpdater.h:
  • platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp:

(WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect):
(WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect):

  • platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h:

(Texture):
(FrameBufferSkPictureCanvasLayerTextureUpdater):

  • platform/graphics/chromium/ImageLayerChromium.cpp:

(WebCore::ImageLayerTextureUpdater::Texture::updateRect):
(WebCore::ImageLayerTextureUpdater::updateTextureRect):

  • platform/graphics/chromium/LayerChromium.h:

(WebCore):

  • platform/graphics/chromium/LayerRendererChromium.cpp:

(WebCore::CCRenderer::toGLMatrix):
(WebCore):
(WebCore::LayerRendererChromium::create):
(WebCore::CCRenderer::CCRenderer):
(WebCore::LayerRendererChromium::LayerRendererChromium):
(WebCore::LayerRendererChromium::copyPlaneToTexture):
(WebCore::LayerRendererChromium::drawHeadsUpDisplay):
(WebCore::LayerRendererChromium::getFramebufferTexture):
(WebCore::LayerRendererChromium::bindFramebufferToTexture):

  • platform/graphics/chromium/LayerRendererChromium.h:

(CCRenderer):
(WebCore::CCRenderer::~CCRenderer):
(WebCore::CCRenderer::ccContext):
(WebCore::CCRenderer::settings):
(WebCore::CCRenderer::viewportSize):
(WebCore::CCRenderer::viewportWidth):
(WebCore::CCRenderer::viewportHeight):
(WebCore::CCRenderer::projectionMatrix):
(WebCore::CCRenderer::windowMatrix):
(WebCore::CCRenderer::sharedGeometryQuad):
(WebCore):
(LayerRendererChromium):

  • platform/graphics/chromium/LayerTextureSubImage.cpp:

(WebCore::LayerTextureSubImage::upload):
(WebCore::LayerTextureSubImage::uploadWithTexSubImage):
(WebCore::LayerTextureSubImage::uploadWithMapTexSubImage):

  • platform/graphics/chromium/LayerTextureSubImage.h:

(WebCore):
(LayerTextureSubImage):

  • platform/graphics/chromium/LayerTextureUpdater.h:

(WebCore):
(Texture):

  • platform/graphics/chromium/ManagedTexture.cpp:

(WebCore::ManagedTexture::bindTexture):
(WebCore::ManagedTexture::framebufferTexture2D):

  • platform/graphics/chromium/ManagedTexture.h:

(WebCore):
(ManagedTexture):

  • platform/graphics/chromium/RenderSurfaceChromium.cpp:
  • platform/graphics/chromium/TextureCopier.cpp:

(WebCore::AcceleratedTextureCopier::copyTexture):

  • platform/graphics/chromium/TextureCopier.h:

(TextureCopier):
(AcceleratedTextureCopier):

  • platform/graphics/chromium/TextureUploader.h:

(TextureUploader):

  • platform/graphics/chromium/ThrottledTextureUploader.cpp:

(WebCore::ThrottledTextureUploader::uploadTexture):

  • platform/graphics/chromium/ThrottledTextureUploader.h:

(ThrottledTextureUploader):

  • platform/graphics/chromium/cc/CCGraphicsContext.h: Copied from Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h.

(WebCore):
(CCGraphicsContext):
(WebCore::CCGraphicsContext::create2D):
(WebCore::CCGraphicsContext::create3D):
(WebCore::CCGraphicsContext::context3D):
(WebCore::CCGraphicsContext::CCGraphicsContext):

  • platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp:

(WebCore::CCHeadsUpDisplay::draw):

  • platform/graphics/chromium/cc/CCLayerImpl.cpp:

(WebCore::CCLayerImpl::willDraw):
(WebCore::CCLayerImpl::bindContentsTexture):

  • platform/graphics/chromium/cc/CCLayerImpl.h:

(WebCore):
(CCLayerImpl):

  • platform/graphics/chromium/cc/CCLayerTreeHost.cpp:

(WebCore::CCLayerTreeHost::createContext):
(WebCore::CCLayerTreeHost::context):

  • platform/graphics/chromium/cc/CCLayerTreeHost.h:

(CCLayerTreeHostClient):
(WebCore::CCSettings::CCSettings):
(CCSettings):
(CCLayerTreeHost):

  • platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:

(WebCore::CCLayerTreeHostImpl::context):
(WebCore::CCLayerTreeHostImpl::initializeLayerRenderer):

  • platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:

(CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::layerRenderer):

  • platform/graphics/chromium/cc/CCProxy.h:

(WebCore):
(CCProxy):

  • platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp:

(WebCore::CCScrollbarLayerImpl::willDraw):

  • platform/graphics/chromium/cc/CCScrollbarLayerImpl.h:

(CCScrollbarLayerImpl):

  • platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:

(WebCore::CCSingleThreadProxy::context):
(WebCore::CCSingleThreadProxy::initializeContext):
(WebCore::CCSingleThreadProxy::recreateContext):

  • platform/graphics/chromium/cc/CCSingleThreadProxy.h:

(CCSingleThreadProxy):

  • platform/graphics/chromium/cc/CCTextureUpdater.cpp:

(WebCore::CCTextureUpdater::update):

  • platform/graphics/chromium/cc/CCTextureUpdater.h:

(CCTextureUpdater):

  • platform/graphics/chromium/cc/CCThreadProxy.cpp:

(WebCore::CCThreadProxy::context):
(WebCore::CCThreadProxy::initializeContext):
(WebCore::CCThreadProxy::recreateContext):
(WebCore::CCThreadProxy::beginFrame):
(WebCore::CCThreadProxy::initializeContextOnImplThread):
(WebCore::CCThreadProxy::recreateContextOnImplThread):

  • platform/graphics/chromium/cc/CCThreadProxy.h:

(CCThreadProxy):

  • platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:

(WebCore::CCVideoLayerImpl::willDraw):
(WebCore::CCVideoLayerImpl::willDrawInternal):
(WebCore::CCVideoLayerImpl::reserveTextures):

  • platform/graphics/chromium/cc/CCVideoLayerImpl.h:

(CCVideoLayerImpl):

Source/WebKit/chromium:

Add a new setting to force software compositing. In this mode,
no GraphicsContext3D should ever be created.

  • public/WebSettings.h:
  • src/WebLayerTreeView.cpp:

(WebKit::WebLayerTreeView::Settings::operator CCSettings):
(WebKit::WebLayerTreeView::context):

  • src/WebLayerTreeViewImpl.cpp:
  • src/WebSettingsImpl.cpp:

(WebKit::WebSettingsImpl::WebSettingsImpl):
(WebKit::WebSettingsImpl::setForceSoftwareCompositing):
(WebKit):

  • src/WebSettingsImpl.h:

(WebSettingsImpl):
(WebKit::WebSettingsImpl::forceSoftwareCompositing):

  • src/WebViewImpl.cpp:

(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
(WebKit::WebViewImpl::createCompositorGraphicsContext3D):
(WebKit::WebViewImpl::createContext3D):

  • tests/CCLayerTreeHostImplTest.cpp:

(WebKitTests::CCLayerTreeHostImplTest::createContext):
(WebKitTests::TEST_F):

  • tests/CCLayerTreeHostTest.cpp:

(WTF::CCLayerTreeHostTestAtomicCommit::commitCompleteOnCCThread):
(WTF::CCLayerTreeHostTestAtomicCommit::drawLayersOnCCThread):
(WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::commitCompleteOnCCThread):
(WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::drawLayersOnCCThread):

  • tests/CCTiledLayerTestCommon.cpp:

(WebKitTests::FakeLayerTextureUpdater::Texture::updateRect):

  • tests/CCTiledLayerTestCommon.h:

(Texture):
(WebKitTests::FakeTextureCopier::copyTexture):
(WebKitTests::FakeTextureUploader::uploadTexture):

  • tests/Canvas2DLayerChromiumTest.cpp:

(Canvas2DLayerChromiumTest::fullLifecycleTest):

  • tests/FakeCCLayerTreeHostClient.h:
  • tests/LayerRendererChromiumTest.cpp:

(FakeLayerRendererChromium::FakeLayerRendererChromium):
(LayerRendererChromiumTest::LayerRendererChromiumTest):
(LayerRendererChromiumTest):
(TEST):

  • tests/TextureCopierTest.cpp:
  • tests/TiledLayerChromiumTest.cpp:

(WTF::TEST):

Location:
trunk/Source
Files:
1 added
61 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/Platform/ChangeLog

    r119258 r119313  
     12012-06-01  Alexandre Elias  <aelias@google.com>
     2
     3        [chromium] Software compositor initialization and base classes
     4        https://bugs.webkit.org/show_bug.cgi?id=87920
     5
     6        Reviewed by James Robinson.
     7
     8        Add a new setting to force software compositing.  In this mode,
     9        no GraphicsContext3D should ever be created.
     10
     11        * chromium/public/WebLayerTreeView.h:
     12        (WebKit::WebLayerTreeView::Settings::Settings):
     13        (Settings):
     14
    1152012-06-01  Mark Pilgrim  <pilgrim@chromium.org>
    216
  • trunk/Source/Platform/chromium/public/WebLayerTreeView.h

    r117535 r119313  
    5151        Settings()
    5252            : acceleratePainting(false)
     53            , forceSoftwareCompositing(false)
    5354            , showFPSCounter(false)
    5455            , showPlatformLayerTree(false)
     
    6566
    6667        bool acceleratePainting;
     68        bool forceSoftwareCompositing;
    6769        bool showFPSCounter;
    6870        bool showPlatformLayerTree;
  • trunk/Source/WebCore/ChangeLog

    r119311 r119313  
     12012-06-01  Alexandre Elias  <aelias@google.com>
     2
     3        [chromium] Software compositor initialization and base classes
     4        https://bugs.webkit.org/show_bug.cgi?id=87920
     5
     6        Reviewed by James Robinson.
     7
     8        This introduces new wrapper class CCGraphicsContext and base class
     9        CCRenderer which will be used for software compositing support.
     10        If no GraphicsContext3D is available, early return for now.
     11
     12        No new tests. (No-op change in 3d mode.)
     13
     14        * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp:
     15        (WebCore::BitmapCanvasLayerTextureUpdater::Texture::updateRect):
     16        (WebCore::BitmapCanvasLayerTextureUpdater::updateTextureRect):
     17        * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h:
     18        (Texture):
     19        (BitmapCanvasLayerTextureUpdater):
     20        * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp:
     21        (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect):
     22        (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::updateTextureRect):
     23        * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h:
     24        (Texture):
     25        (BitmapSkPictureCanvasLayerTextureUpdater):
     26        * platform/graphics/chromium/CanvasLayerTextureUpdater.h:
     27        * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp:
     28        (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect):
     29        (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect):
     30        * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h:
     31        (Texture):
     32        (FrameBufferSkPictureCanvasLayerTextureUpdater):
     33        * platform/graphics/chromium/ImageLayerChromium.cpp:
     34        (WebCore::ImageLayerTextureUpdater::Texture::updateRect):
     35        (WebCore::ImageLayerTextureUpdater::updateTextureRect):
     36        * platform/graphics/chromium/LayerChromium.h:
     37        (WebCore):
     38        * platform/graphics/chromium/LayerRendererChromium.cpp:
     39        (WebCore::CCRenderer::toGLMatrix):
     40        (WebCore):
     41        (WebCore::LayerRendererChromium::create):
     42        (WebCore::CCRenderer::CCRenderer):
     43        (WebCore::LayerRendererChromium::LayerRendererChromium):
     44        (WebCore::LayerRendererChromium::copyPlaneToTexture):
     45        (WebCore::LayerRendererChromium::drawHeadsUpDisplay):
     46        (WebCore::LayerRendererChromium::getFramebufferTexture):
     47        (WebCore::LayerRendererChromium::bindFramebufferToTexture):
     48        * platform/graphics/chromium/LayerRendererChromium.h:
     49        (CCRenderer):
     50        (WebCore::CCRenderer::~CCRenderer):
     51        (WebCore::CCRenderer::ccContext):
     52        (WebCore::CCRenderer::settings):
     53        (WebCore::CCRenderer::viewportSize):
     54        (WebCore::CCRenderer::viewportWidth):
     55        (WebCore::CCRenderer::viewportHeight):
     56        (WebCore::CCRenderer::projectionMatrix):
     57        (WebCore::CCRenderer::windowMatrix):
     58        (WebCore::CCRenderer::sharedGeometryQuad):
     59        (WebCore):
     60        (LayerRendererChromium):
     61        * platform/graphics/chromium/LayerTextureSubImage.cpp:
     62        (WebCore::LayerTextureSubImage::upload):
     63        (WebCore::LayerTextureSubImage::uploadWithTexSubImage):
     64        (WebCore::LayerTextureSubImage::uploadWithMapTexSubImage):
     65        * platform/graphics/chromium/LayerTextureSubImage.h:
     66        (WebCore):
     67        (LayerTextureSubImage):
     68        * platform/graphics/chromium/LayerTextureUpdater.h:
     69        (WebCore):
     70        (Texture):
     71        * platform/graphics/chromium/ManagedTexture.cpp:
     72        (WebCore::ManagedTexture::bindTexture):
     73        (WebCore::ManagedTexture::framebufferTexture2D):
     74        * platform/graphics/chromium/ManagedTexture.h:
     75        (WebCore):
     76        (ManagedTexture):
     77        * platform/graphics/chromium/RenderSurfaceChromium.cpp:
     78        * platform/graphics/chromium/TextureCopier.cpp:
     79        (WebCore::AcceleratedTextureCopier::copyTexture):
     80        * platform/graphics/chromium/TextureCopier.h:
     81        (TextureCopier):
     82        (AcceleratedTextureCopier):
     83        * platform/graphics/chromium/TextureUploader.h:
     84        (TextureUploader):
     85        * platform/graphics/chromium/ThrottledTextureUploader.cpp:
     86        (WebCore::ThrottledTextureUploader::uploadTexture):
     87        * platform/graphics/chromium/ThrottledTextureUploader.h:
     88        (ThrottledTextureUploader):
     89        * platform/graphics/chromium/cc/CCGraphicsContext.h: Copied from Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h.
     90        (WebCore):
     91        (CCGraphicsContext):
     92        (WebCore::CCGraphicsContext::create2D):
     93        (WebCore::CCGraphicsContext::create3D):
     94        (WebCore::CCGraphicsContext::context3D):
     95        (WebCore::CCGraphicsContext::CCGraphicsContext):
     96        * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp:
     97        (WebCore::CCHeadsUpDisplay::draw):
     98        * platform/graphics/chromium/cc/CCLayerImpl.cpp:
     99        (WebCore::CCLayerImpl::willDraw):
     100        (WebCore::CCLayerImpl::bindContentsTexture):
     101        * platform/graphics/chromium/cc/CCLayerImpl.h:
     102        (WebCore):
     103        (CCLayerImpl):
     104        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
     105        (WebCore::CCLayerTreeHost::createContext):
     106        (WebCore::CCLayerTreeHost::context):
     107        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
     108        (CCLayerTreeHostClient):
     109        (WebCore::CCSettings::CCSettings):
     110        (CCSettings):
     111        (CCLayerTreeHost):
     112        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
     113        (WebCore::CCLayerTreeHostImpl::context):
     114        (WebCore::CCLayerTreeHostImpl::initializeLayerRenderer):
     115        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
     116        (CCLayerTreeHostImpl):
     117        (WebCore::CCLayerTreeHostImpl::layerRenderer):
     118        * platform/graphics/chromium/cc/CCProxy.h:
     119        (WebCore):
     120        (CCProxy):
     121        * platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp:
     122        (WebCore::CCScrollbarLayerImpl::willDraw):
     123        * platform/graphics/chromium/cc/CCScrollbarLayerImpl.h:
     124        (CCScrollbarLayerImpl):
     125        * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
     126        (WebCore::CCSingleThreadProxy::context):
     127        (WebCore::CCSingleThreadProxy::initializeContext):
     128        (WebCore::CCSingleThreadProxy::recreateContext):
     129        * platform/graphics/chromium/cc/CCSingleThreadProxy.h:
     130        (CCSingleThreadProxy):
     131        * platform/graphics/chromium/cc/CCTextureUpdater.cpp:
     132        (WebCore::CCTextureUpdater::update):
     133        * platform/graphics/chromium/cc/CCTextureUpdater.h:
     134        (CCTextureUpdater):
     135        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
     136        (WebCore::CCThreadProxy::context):
     137        (WebCore::CCThreadProxy::initializeContext):
     138        (WebCore::CCThreadProxy::recreateContext):
     139        (WebCore::CCThreadProxy::beginFrame):
     140        (WebCore::CCThreadProxy::initializeContextOnImplThread):
     141        (WebCore::CCThreadProxy::recreateContextOnImplThread):
     142        * platform/graphics/chromium/cc/CCThreadProxy.h:
     143        (CCThreadProxy):
     144        * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
     145        (WebCore::CCVideoLayerImpl::willDraw):
     146        (WebCore::CCVideoLayerImpl::willDrawInternal):
     147        (WebCore::CCVideoLayerImpl::reserveTextures):
     148        * platform/graphics/chromium/cc/CCVideoLayerImpl.h:
     149        (CCVideoLayerImpl):
     150
    11512012-06-01  Sheriff Bot  <webkit.review.bot@gmail.com>
    2152
  • trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp

    r114827 r119313  
    4747}
    4848
    49 void BitmapCanvasLayerTextureUpdater::Texture::updateRect(GraphicsContext3D* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect)
     49void BitmapCanvasLayerTextureUpdater::Texture::updateRect(CCGraphicsContext* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect)
    5050{
    5151    textureUpdater()->updateTextureRect(context, allocator, texture(), sourceRect, destRect);
     
    9696}
    9797
    98 void BitmapCanvasLayerTextureUpdater::updateTextureRect(GraphicsContext3D* context, TextureAllocator* allocator, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
     98void BitmapCanvasLayerTextureUpdater::updateTextureRect(CCGraphicsContext* context, TextureAllocator* allocator, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
    9999{
    100100    PlatformCanvas::AutoLocker locker(&m_canvas);
  • trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h

    r114827 r119313  
    4848        virtual ~Texture();
    4949
    50         virtual void updateRect(GraphicsContext3D*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect);
     50        virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect);
    5151
    5252    private:
     
    6262    virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat);
    6363    virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale, IntRect& resultingOpaqueRect);
    64     void updateTextureRect(GraphicsContext3D*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);
     64    void updateTextureRect(CCGraphicsContext*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);
    6565
    6666    virtual void setOpaque(bool);
  • trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp

    r114827 r119313  
    5353}
    5454
    55 void BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect(GraphicsContext3D* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect)
     55void BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCGraphicsContext* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect)
    5656{
    5757    texture()->bindTexture(context, allocator);
     
    104104}
    105105
    106 void BitmapSkPictureCanvasLayerTextureUpdater::updateTextureRect(GraphicsContext3D* context, GC3Denum format, const IntRect& destRect, const uint8_t* pixels)
     106void BitmapSkPictureCanvasLayerTextureUpdater::updateTextureRect(CCGraphicsContext* context, GC3Denum format, const IntRect& destRect, const uint8_t* pixels)
    107107{
    108108    m_texSubImage.upload(pixels, destRect, destRect, destRect, format, context);
  • trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h

    r114827 r119313  
    4545
    4646        virtual void prepareRect(const IntRect& sourceRect);
    47         virtual void updateRect(GraphicsContext3D*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect);
     47        virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect);
    4848
    4949    private:
     
    6161    virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale, IntRect& resultingOpaqueRect);
    6262    void paintContentsRect(SkCanvas*, const IntRect& sourceRect);
    63     void updateTextureRect(GraphicsContext3D*, GC3Denum format, const IntRect& destRect, const uint8_t* pixels);
     63    void updateTextureRect(CCGraphicsContext*, GC3Denum format, const IntRect& destRect, const uint8_t* pixels);
    6464
    6565private:
  • trunk/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h

    r114827 r119313  
    3434namespace WebCore {
    3535
    36 class GraphicsContext3D;
    3736class LayerPainterChromium;
    3837class PlatformContextSkia;
  • trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp

    r112193 r119313  
    6767}
    6868
    69 void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect(GraphicsContext3D* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect)
     69void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCGraphicsContext* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect)
    7070{
    7171    textureUpdater()->updateTextureRect(context, allocator, texture(), sourceRect, destRect);
     
    9797}
    9898
    99 void FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect(GraphicsContext3D* context, TextureAllocator* allocator, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
     99void FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect(CCGraphicsContext* context, TextureAllocator* allocator, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
    100100{
     101    GraphicsContext3D* context3d = context->context3D();
     102    if (!context3d) {
     103        // FIXME: Implement this path for software compositing.
     104        return;
     105    }
     106
    101107    // Make sure ganesh uses the correct GL context.
    102     context->makeContextCurrent();
     108    context3d->makeContextCurrent();
    103109    // Notify ganesh to sync its internal GL state.
    104     context->grContext()->resetContext();
     110    context3d->grContext()->resetContext();
    105111
    106112    // Create an accelerated canvas to draw on.
    107     OwnPtr<SkCanvas> canvas = createAcceleratedCanvas(context, allocator, texture);
     113    OwnPtr<SkCanvas> canvas = createAcceleratedCanvas(context3d, allocator, texture);
    108114
    109115    // The compositor expects the textures to be upside-down so it can flip
     
    121127
    122128    // Flush ganesh context so that all the rendered stuff appears on the texture.
    123     context->grContext()->flush();
     129    context3d->grContext()->flush();
    124130}
    125131
  • trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h

    r110267 r119313  
    4444        virtual ~Texture();
    4545
    46         virtual void updateRect(GraphicsContext3D*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect);
     46        virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect);
    4747
    4848    private:
     
    5757    virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager*);
    5858    virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat);
    59     void updateTextureRect(GraphicsContext3D*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);
     59    void updateTextureRect(CCGraphicsContext*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);
    6060
    6161private:
  • trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp

    r113809 r119313  
    5555        }
    5656
    57         virtual void updateRect(GraphicsContext3D* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect)
     57        virtual void updateRect(CCGraphicsContext* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect)
    5858        {
    5959            textureUpdater()->updateTextureRect(context, allocator, texture(), sourceRect, destRect);
     
    8989    }
    9090
    91     virtual void updateTextureRect(GraphicsContext3D* context, TextureAllocator* allocator, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
     91    virtual void updateTextureRect(CCGraphicsContext* context, TextureAllocator* allocator, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
    9292    {
    9393        texture->bindTexture(context, allocator);
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h

    r119311 r119313  
    6363class CCLayerTreeHost;
    6464class CCTextureUpdater;
    65 class GraphicsContext3D;
    6665class ScrollbarLayerChromium;
    6766
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

    r119178 r119313  
    161161    virtual void beginUploads() { }
    162162    virtual void endUploads() { }
    163     virtual void uploadTexture(GraphicsContext3D* context, LayerTextureUpdater::Texture* texture, TextureAllocator* allocator, const IntRect sourceRect, const IntRect destRect) { texture->updateRect(context, allocator, sourceRect, destRect); }
     163    virtual void uploadTexture(CCGraphicsContext* context, LayerTextureUpdater::Texture* texture, TextureAllocator* allocator, const IntRect sourceRect, const IntRect destRect) { texture->updateRect(context, allocator, sourceRect, destRect); }
    164164
    165165protected:
     
    218218
    219219
    220 PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(LayerRendererChromiumClient* client, PassRefPtr<GraphicsContext3D> context, TextureUploaderOption textureUploaderSetting)
     220PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(CCRendererClient* client, PassRefPtr<GraphicsContext3D> context, TextureUploaderOption textureUploaderSetting)
    221221{
    222222    OwnPtr<LayerRendererChromium> layerRenderer(adoptPtr(new LayerRendererChromium(client, context, textureUploaderSetting)));
     
    227227}
    228228
    229 LayerRendererChromium::LayerRendererChromium(LayerRendererChromiumClient* client,
     229LayerRendererChromium::LayerRendererChromium(CCRendererClient* client,
    230230                                             PassRefPtr<GraphicsContext3D> context,
    231231                                             TextureUploaderOption textureUploaderSetting)
    232     : m_client(client)
     232    : CCRenderer(client)
    233233    , m_currentRenderSurface(0)
    234234    , m_currentManagedTexture(0)
    235235    , m_offscreenFramebufferId(0)
     236    , m_sharedGeometryQuad(FloatRect(-0.5f, -0.5f, 1.0f, 1.0f))
    236237    , m_context(context)
    237238    , m_defaultRenderSurface(0)
    238     , m_sharedGeometryQuad(FloatRect(-0.5f, -0.5f, 1.0f, 1.0f))
    239239    , m_isViewportChanged(false)
    240240    , m_isFramebufferDiscarded(false)
    241241    , m_textureUploaderSetting(textureUploaderSetting)
    242242{
     243    ASSERT(m_context.get());
    243244}
    244245
    245246class ContextLostCallbackAdapter : public GraphicsContext3D::ContextLostCallback {
    246247public:
    247     static PassOwnPtr<ContextLostCallbackAdapter> create(LayerRendererChromiumClient* client)
     248    static PassOwnPtr<ContextLostCallbackAdapter> create(CCRendererClient* client)
    248249    {
    249250        return adoptPtr(new ContextLostCallbackAdapter(client));
     
    256257
    257258private:
    258     explicit ContextLostCallbackAdapter(LayerRendererChromiumClient* client)
     259    explicit ContextLostCallbackAdapter(CCRendererClient* client)
    259260        : m_client(client) { }
    260261
    261     LayerRendererChromiumClient* m_client;
     262    CCRendererClient* m_client;
    262263};
    263264
     
    10781079    CCVideoLayerImpl::Texture& texture = quad->textures()[index];
    10791080    TextureAllocator* allocator = renderSurfaceTextureAllocator();
    1080     texture.m_texture->bindTexture(context(), allocator);
     1081    RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(m_context);
     1082    texture.m_texture->bindTexture(ccContext.get(), allocator);
    10811083    GC3Denum format = texture.m_texture->format();
    10821084    IntSize dimensions = texture.m_texture->size();
     
    12181220    ASSERT(program && program->initialized());
    12191221    GLC(m_context, m_context->activeTexture(GraphicsContext3D::TEXTURE0));
    1220     hudTexture->bindTexture(m_context.get(), renderSurfaceTextureAllocator());
     1222    RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(m_context);
     1223    hudTexture->bindTexture(ccContext.get(), renderSurfaceTextureAllocator());
    12211224    GLC(m_context, m_context->useProgram(program->program()));
    12221225    GLC(m_context, m_context->uniform1i(program->fragmentShader().samplerLocation(), 0));
     
    14431446        return false;
    14441447
    1445     texture->bindTexture(m_context.get(), m_renderSurfaceTextureAllocator.get());
     1448    RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(m_context);
     1449    texture->bindTexture(ccContext.get(), m_renderSurfaceTextureAllocator.get());
    14461450    GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, texture->format(),
    14471451                                             deviceRect.x(), deviceRect.y(), deviceRect.width(), deviceRect.height(), 0));
     
    14851489    GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_offscreenFramebufferId));
    14861490
    1487     texture->framebufferTexture2D(m_context.get(), m_renderSurfaceTextureAllocator.get());
     1491    RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(m_context);
     1492    texture->framebufferTexture2D(ccContext.get(), m_renderSurfaceTextureAllocator.get());
    14881493
    14891494#if !defined ( NDEBUG )
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h

    r119178 r119313  
    3535#if USE(ACCELERATED_COMPOSITING)
    3636
    37 #include "FloatQuad.h"
    38 #include "IntRect.h"
    3937#include "TextureCopier.h"
    4038#include "ThrottledTextureUploader.h"
    4139#include "TrackingTextureAllocator.h"
    42 #include "cc/CCLayerTreeHost.h"
    43 #include <wtf/HashMap.h>
    44 #include <wtf/Noncopyable.h>
     40#include "cc/CCRenderer.h"
    4541#include <wtf/PassOwnPtr.h>
    46 #include <wtf/PassRefPtr.h>
    47 #include <wtf/Vector.h>
    4842
    4943namespace WebCore {
     
    5347class CCDrawQuad;
    5448class CCIOSurfaceDrawQuad;
    55 class CCRenderPass;
    5649class CCRenderSurfaceDrawQuad;
    5750class CCSolidColorDrawQuad;
     
    6558class ScopedEnsureFramebufferAllocation;
    6659
    67 class LayerRendererChromiumClient {
    68 public:
    69     virtual const IntSize& deviceViewportSize() const = 0;
    70     virtual const CCSettings& settings() const = 0;
    71     virtual void didLoseContext() = 0;
    72     virtual void onSwapBuffersComplete() = 0;
    73     virtual void setFullRootLayerDamage() = 0;
    74     virtual void setContentsMemoryAllocationLimitBytes(size_t) = 0;
    75 };
    76 
    7760enum TextureUploaderOption { ThrottledUploader, UnthrottledUploader };
    7861
    7962// Class that handles drawing of composited render layers using GL.
    80 class LayerRendererChromium {
     63class LayerRendererChromium : public CCRenderer {
    8164    WTF_MAKE_NONCOPYABLE(LayerRendererChromium);
    8265public:
    83     static PassOwnPtr<LayerRendererChromium> create(LayerRendererChromiumClient*, PassRefPtr<GraphicsContext3D>, TextureUploaderOption);
    84 
    85     ~LayerRendererChromium();
    86 
    87     const CCSettings& settings() const { return m_client->settings(); }
    88     const LayerRendererCapabilities& capabilities() const { return m_capabilities; }
     66    static PassOwnPtr<LayerRendererChromium> create(CCRendererClient*, PassRefPtr<GraphicsContext3D>, TextureUploaderOption);
     67
     68    virtual ~LayerRendererChromium();
     69
     70    virtual const LayerRendererCapabilities& capabilities() const OVERRIDE { return m_capabilities; }
    8971
    9072    GraphicsContext3D* context();
    91     bool contextSupportsMapSub() const { return m_capabilities.usingMapSub; }
    92 
    93     void viewportChanged();
    94 
    95     void beginDrawingFrame(CCRenderSurface* defaultRenderSurface);
    96     void drawRenderPass(const CCRenderPass*);
    97     void finishDrawingFrame();
    98 
    99     void drawHeadsUpDisplay(ManagedTexture*, const IntSize& hudSize);
     73
     74    virtual void viewportChanged() OVERRIDE;
     75
     76    const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; }
     77
     78    virtual void beginDrawingFrame(CCRenderSurface* defaultRenderSurface) OVERRIDE;
     79    virtual void drawRenderPass(const CCRenderPass*) OVERRIDE;
     80    virtual void finishDrawingFrame() OVERRIDE;
     81
     82    virtual void drawHeadsUpDisplay(ManagedTexture*, const IntSize& hudSize) OVERRIDE;
    10083
    10184    // waits for rendering to finish
    102     void finish();
    103 
    104     void doNoOp();
     85    virtual void finish() OVERRIDE;
     86
     87    virtual void doNoOp() OVERRIDE;
    10588    // puts backbuffer onscreen
    106     bool swapBuffers(const IntRect& subBuffer);
     89    virtual bool swapBuffers(const IntRect& subBuffer) OVERRIDE;
    10790
    10891    static void debugGLCall(GraphicsContext3D*, const char* command, const char* file, int line);
    10992
    110     const WebKit::WebTransformationMatrix& projectionMatrix() const { return m_projectionMatrix; }
    111     const WebKit::WebTransformationMatrix& windowMatrix() const { return m_windowMatrix; }
    112 
    11393    const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(); }
    114     const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; }
    115 
    116 
    117     void getFramebufferPixels(void *pixels, const IntRect&);
     94
     95
     96    virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE;
    11897    bool getFramebufferTexture(ManagedTexture*, const IntRect& deviceRect);
    11998
    120     TextureManager* renderSurfaceTextureManager() const { return m_renderSurfaceTextureManager.get(); }
    121     TextureCopier* textureCopier() const { return m_textureCopier.get(); }
    122     TextureUploader* textureUploader() const { return m_textureUploader.get(); }
    123     TextureAllocator* renderSurfaceTextureAllocator() const { return m_renderSurfaceTextureAllocator.get(); }
    124     TextureAllocator* contentsTextureAllocator() const { return m_contentsTextureAllocator.get(); }
    125 
    126     void setScissorToRect(const IntRect&);
    127 
    128     bool isContextLost();
    129 
    130     void setVisible(bool);
    131 
    132     GC3Denum bestTextureFormat();
    133 
    134     static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&);
     99    virtual TextureManager* renderSurfaceTextureManager() const OVERRIDE { return m_renderSurfaceTextureManager.get(); }
     100    virtual TextureCopier* textureCopier() const OVERRIDE { return m_textureCopier.get(); }
     101    virtual TextureUploader* textureUploader() const OVERRIDE { return m_textureUploader.get(); }
     102    virtual TextureAllocator* renderSurfaceTextureAllocator() const OVERRIDE { return m_renderSurfaceTextureAllocator.get(); }
     103    virtual TextureAllocator* contentsTextureAllocator() const OVERRIDE { return m_contentsTextureAllocator.get(); }
     104
     105    virtual void setScissorToRect(const IntRect&) OVERRIDE;
     106
     107    virtual bool isContextLost() OVERRIDE;
     108
     109    virtual void setVisible(bool) OVERRIDE;
     110
    135111    void drawTexturedQuad(const WebKit::WebTransformationMatrix& layerMatrix,
    136112                          float width, float height, float opacity, const FloatQuad&,
     
    144120    bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; }
    145121
    146     LayerRendererChromium(LayerRendererChromiumClient*, PassRefPtr<GraphicsContext3D>, TextureUploaderOption);
     122    LayerRendererChromium(CCRendererClient*, PassRefPtr<GraphicsContext3D>, TextureUploaderOption);
    147123    bool initialize();
    148124
    149125private:
    150     const IntSize& viewportSize() { return m_client->deviceViewportSize(); }
    151     int viewportWidth() { return viewportSize().width(); }
    152     int viewportHeight() { return viewportSize().height(); }
     126    static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&);
    153127
    154128    void drawQuad(const CCDrawQuad*, const FloatRect& surfaceDamageRect);
     
    192166    void onSwapBuffersComplete();
    193167
    194     LayerRendererChromiumClient* m_client;
    195 
    196168    LayerRendererCapabilities m_capabilities;
    197 
    198     WebKit::WebTransformationMatrix m_projectionMatrix;
    199     WebKit::WebTransformationMatrix m_windowMatrix;
    200169
    201170    CCRenderSurface* m_currentRenderSurface;
     
    204173
    205174    OwnPtr<GeometryBinding> m_sharedGeometry;
     175    FloatQuad m_sharedGeometryQuad;
    206176
    207177    // This block of bindings defines all of the programs used by the compositor itself.
     
    298268    CCRenderSurface* m_defaultRenderSurface;
    299269
    300     FloatQuad m_sharedGeometryQuad;
    301 
    302270    bool m_isViewportChanged;
    303271    bool m_isFramebufferDiscarded;
  • trunk/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.cpp

    r95901 r119313  
    3131
    3232#include "Extensions3DChromium.h"
    33 #include "GraphicsContext3D.h"
    3433#include "TraceEvent.h"
     34#include "cc/CCGraphicsContext.h"
    3535
    3636namespace WebCore {
     
    5656void LayerTextureSubImage::upload(const uint8_t* image, const IntRect& imageRect,
    5757                                  const IntRect& sourceRect, const IntRect& destRect,
    58                                   GC3Denum format, GraphicsContext3D* context)
     58                                  GC3Denum format, CCGraphicsContext* context)
    5959{
    6060    if (m_useMapTexSubImage)
     
    6666void LayerTextureSubImage::uploadWithTexSubImage(const uint8_t* image, const IntRect& imageRect,
    6767                                                 const IntRect& sourceRect, const IntRect& destRect,
    68                                                  GC3Denum format, GraphicsContext3D* context)
     68                                                 GC3Denum format, CCGraphicsContext* context)
    6969{
    7070    TRACE_EVENT("LayerTextureSubImage::uploadWithTexSubImage", this, 0);
     
    8888        pixelSource = &m_subImage[0];
    8989    }
    90     context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, pixelSource);
     90
     91    GraphicsContext3D* context3d = context->context3D();
     92    if (!context3d) {
     93        // FIXME: Implement this path for software compositing.
     94        return;
     95    }
     96    context3d->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, pixelSource);
    9197}
    9298
    9399void LayerTextureSubImage::uploadWithMapTexSubImage(const uint8_t* image, const IntRect& imageRect,
    94100                                                    const IntRect& sourceRect, const IntRect& destRect,
    95                                                     GC3Denum format, GraphicsContext3D* context)
     101                                                    GC3Denum format, CCGraphicsContext* context)
    96102{
    97103    TRACE_EVENT("LayerTextureSubImage::uploadWithMapTexSubImage", this, 0);
     104    GraphicsContext3D* context3d = context->context3D();
     105    if (!context3d) {
     106        // FIXME: Implement this path for software compositing.
     107        return;
     108    }
     109
    98110    // Offset from image-rect to source-rect.
    99111    IntPoint offset(sourceRect.x() - imageRect.x(), sourceRect.y() - imageRect.y());
    100112
    101113    // Upload tile data via a mapped transfer buffer
    102     Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context->getExtensions());
     114    Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context3d->getExtensions());
    103115    uint8_t* pixelDest = static_cast<uint8_t*>(extensions->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY));
    104116
  • trunk/Source/WebCore/platform/graphics/chromium/LayerTextureSubImage.h

    r95901 r119313  
    3737namespace WebCore {
    3838
    39 class GraphicsContext3D;
     39class CCGraphicsContext;
    4040
    4141class LayerTextureSubImage {
     
    4747    void upload(const uint8_t* image, const IntRect& imageRect,
    4848                const IntRect& sourceRect, const IntRect& destRect,
    49                 GC3Denum format, GraphicsContext3D*);
     49                GC3Denum format, CCGraphicsContext*);
    5050
    5151private:
    5252    void uploadWithTexSubImage(const uint8_t* image, const IntRect& imageRect,
    5353                               const IntRect& sourceRect, const IntRect& destRect,
    54                                GC3Denum format, GraphicsContext3D*);
     54                               GC3Denum format, CCGraphicsContext*);
    5555    void uploadWithMapTexSubImage(const uint8_t* image, const IntRect& imageRect,
    5656                                  const IntRect& sourceRect, const IntRect& destRect,
    57                                   GC3Denum format, GraphicsContext3D*);
     57                                  GC3Denum format, CCGraphicsContext*);
    5858
    5959    bool m_useMapTexSubImage;
     
    6565#endif // USE(ACCELERATED_COMPOSITING)
    6666#endif // LayerTextureSubImage_h
    67 
  • trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h

    r114827 r119313  
    3232#include "ManagedTexture.h"
    3333#include "GraphicsTypes3D.h"
     34#include "cc/CCGraphicsContext.h"
    3435#include <wtf/RefCounted.h>
    3536
    3637namespace WebCore {
    3738
    38 class GraphicsContext3D;
     39class CCGraphicsContext;
    3940class IntRect;
    4041class IntSize;
     
    5152        ManagedTexture* texture() { return m_texture.get(); }
    5253        virtual void prepareRect(const IntRect& /* sourceRect */) { }
    53         virtual void updateRect(GraphicsContext3D*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) = 0;
     54        virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) = 0;
    5455    protected:
    5556        explicit Texture(PassOwnPtr<ManagedTexture> texture) : m_texture(texture) { }
  • trunk/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp

    r107014 r119313  
    3131#include "GraphicsContext3D.h"
    3232#include "TextureManager.h"
     33#include "cc/CCGraphicsContext.h"
    3334
    3435namespace WebCore {
     
    118119}
    119120
    120 void ManagedTexture::bindTexture(GraphicsContext3D* context, TextureAllocator* allocator)
     121void ManagedTexture::bindTexture(CCGraphicsContext* context, TextureAllocator* allocator)
    121122{
    122123    allocate(allocator);
    123     context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId);
     124    GraphicsContext3D* context3d = context->context3D();
     125    if (!context3d) {
     126        // FIXME: Implement this path for software compositing.
     127        return;
     128    }
     129    context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId);
    124130}
    125131
    126 void ManagedTexture::framebufferTexture2D(GraphicsContext3D* context, TextureAllocator* allocator)
     132void ManagedTexture::framebufferTexture2D(CCGraphicsContext* context, TextureAllocator* allocator)
    127133{
    128134    allocate(allocator);
    129     context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_textureId, 0);
     135    GraphicsContext3D* context3d = context->context3D();
     136    if (!context3d) {
     137        // FIXME: Implement this path for software compositing.
     138        return;
     139    }
     140    context3d->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_textureId, 0);
    130141}
    131142
  • trunk/Source/WebCore/platform/graphics/chromium/ManagedTexture.h

    r106891 r119313  
    3636namespace WebCore {
    3737
    38 class GraphicsContext3D;
     38class CCGraphicsContext;
    3939
    4040class ManagedTexture {
     
    5959
    6060    void allocate(TextureAllocator*);
    61     void bindTexture(GraphicsContext3D*, TextureAllocator*);
    62     void framebufferTexture2D(GraphicsContext3D*, TextureAllocator*);
     61    void bindTexture(CCGraphicsContext*, TextureAllocator*);
     62    void framebufferTexture2D(CCGraphicsContext*, TextureAllocator*);
    6363
    6464    IntSize size() const { return m_size; }
  • trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp

    r118803 r119313  
    3131
    3232#include "FilterOperations.h"
    33 #include "GraphicsContext3D.h"
    3433#include "LayerChromium.h"
    3534#include "LayerRendererChromium.h"
  • trunk/Source/WebCore/platform/graphics/chromium/TextureCopier.cpp

    r115285 r119313  
    6262}
    6363
    64 void AcceleratedTextureCopier::copyTexture(GraphicsContext3D* context, unsigned sourceTextureId, unsigned destTextureId, const IntSize& size)
     64void AcceleratedTextureCopier::copyTexture(CCGraphicsContext* ccContext, unsigned sourceTextureId, unsigned destTextureId, const IntSize& size)
    6565{
    6666    TRACE_EVENT("TextureCopier::copyTexture", this, 0);
     67
     68    GraphicsContext3D* context = ccContext->context3D();
     69    if (!context) {
     70        // FIXME: Implement this path for software compositing.
     71        return;
     72    }
    6773
    6874    // Note: this code does not restore the viewport, bound program, 2D texture, framebuffer, buffer or blend enable.
  • trunk/Source/WebCore/platform/graphics/chromium/TextureCopier.h

    r112286 r119313  
    2929#include "ProgramBinding.h"
    3030#include "ShaderChromium.h"
     31#include "cc/CCGraphicsContext.h"
    3132#include <wtf/PassRefPtr.h>
    3233
     
    3839    // must be complete and have a base level of |size| dimensions. The color formats do not need
    3940    // to match, but |destTextureId| must have a renderable format.
    40     virtual void copyTexture(GraphicsContext3D*, unsigned sourceTextureId, unsigned destTextureId, const IntSize&) = 0;
     41    virtual void copyTexture(CCGraphicsContext*, unsigned sourceTextureId, unsigned destTextureId, const IntSize&) = 0;
    4142
    4243protected:
     
    5556    virtual ~AcceleratedTextureCopier();
    5657
    57     virtual void copyTexture(GraphicsContext3D*, unsigned sourceTextureId, unsigned destTextureId, const IntSize&);
     58    virtual void copyTexture(CCGraphicsContext*, unsigned sourceTextureId, unsigned destTextureId, const IntSize&);
    5859
    5960protected:
  • trunk/Source/WebCore/platform/graphics/chromium/TextureUploader.h

    r116351 r119313  
    3737    virtual void beginUploads() = 0;
    3838    virtual void endUploads() = 0;
    39     virtual void uploadTexture(GraphicsContext3D*, LayerTextureUpdater::Texture*, TextureAllocator*, const IntRect sourceRect, const IntRect destRect) = 0;
     39    virtual void uploadTexture(CCGraphicsContext*, LayerTextureUpdater::Texture*, TextureAllocator*, const IntRect sourceRect, const IntRect destRect) = 0;
    4040};
    4141
  • trunk/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.cpp

    r116351 r119313  
    125125}
    126126
    127 void ThrottledTextureUploader::uploadTexture(GraphicsContext3D* context, LayerTextureUpdater::Texture* texture, TextureAllocator* allocator, const IntRect sourceRect, const IntRect destRect)
     127void ThrottledTextureUploader::uploadTexture(CCGraphicsContext* context, LayerTextureUpdater::Texture* texture, TextureAllocator* allocator, const IntRect sourceRect, const IntRect destRect)
    128128{
    129129    texture->updateRect(context, allocator, sourceRect, destRect);
  • trunk/Source/WebCore/platform/graphics/chromium/ThrottledTextureUploader.h

    r116351 r119313  
    4848    virtual void beginUploads() OVERRIDE;
    4949    virtual void endUploads() OVERRIDE;
    50     virtual void uploadTexture(GraphicsContext3D*, LayerTextureUpdater::Texture*, TextureAllocator*, const IntRect sourceRect, const IntRect destRect) OVERRIDE;
     50    virtual void uploadTexture(CCGraphicsContext*, LayerTextureUpdater::Texture*, TextureAllocator*, const IntRect sourceRect, const IntRect destRect) OVERRIDE;
    5151
    5252private:
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h

    r119312 r119313  
    2424 */
    2525
    26 #ifndef CCIOSurfaceLayerImpl_h
    27 #define CCIOSurfaceLayerImpl_h
     26#ifndef CCGraphicsContext_h
     27#define CCGraphicsContext_h
    2828
    29 #include "IntSize.h"
    30 #include "cc/CCLayerImpl.h"
     29#include "GraphicsContext3D.h"
     30#include <wtf/PassRefPtr.h>
    3131
    3232namespace WebCore {
    3333
    34 class CCIOSurfaceLayerImpl : public CCLayerImpl {
     34class GraphicsContext3D;
     35
     36class CCGraphicsContext : public RefCounted<CCGraphicsContext> {
    3537public:
    36     static PassOwnPtr<CCIOSurfaceLayerImpl> create(int id)
     38    static PassRefPtr<CCGraphicsContext> create2D()
    3739    {
    38         return adoptPtr(new CCIOSurfaceLayerImpl(id));
     40        return adoptRef(new CCGraphicsContext());
    3941    }
    40     virtual ~CCIOSurfaceLayerImpl();
     42    static PassRefPtr<CCGraphicsContext> create3D(PassRefPtr<GraphicsContext3D> context3D)
     43    {
     44        return adoptRef(new CCGraphicsContext(context3D));
     45    }
    4146
    42     void setIOSurfaceProperties(unsigned ioSurfaceId, const IntSize&);
    43 
    44     virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE;
    45 
    46     virtual void willDraw(LayerRendererChromium*) OVERRIDE;
    47     virtual void didLoseContext() OVERRIDE;
    48 
    49     virtual void dumpLayerProperties(TextStream&, int indent) const OVERRIDE;
     47    GraphicsContext3D* context3D() { return m_context3D.get(); }
    5048
    5149private:
    52     explicit CCIOSurfaceLayerImpl(int);
     50    CCGraphicsContext() { }
     51    explicit CCGraphicsContext(PassRefPtr<GraphicsContext3D> context3D)
     52        : m_context3D(context3D) { }
    5353
    54     virtual const char* layerTypeAsString() const OVERRIDE { return "IOSurfaceLayer"; }
    55 
    56     unsigned m_ioSurfaceId;
    57     IntSize m_ioSurfaceSize;
    58     bool m_ioSurfaceChanged;
    59     unsigned m_ioSurfaceTextureId;
     54    RefPtr<GraphicsContext3D> m_context3D;
    6055};
    6156
    6257}
    6358
    64 #endif // CCIOSurfaceLayerImpl_h
     59#endif // CCGraphicsContext_h
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp

    r114963 r119313  
    7070void CCHeadsUpDisplay::draw(CCLayerTreeHostImpl* layerTreeHostImpl)
    7171{
    72     LayerRendererChromium* layerRenderer = layerTreeHostImpl->layerRenderer();
    73     GraphicsContext3D* context = layerRenderer->context();
     72    CCRenderer* layerRenderer = layerTreeHostImpl->layerRenderer();
     73    GraphicsContext3D* context = layerTreeHostImpl->context()->context3D();
     74    if (!context) {
     75        // FIXME: Implement this path for software compositing.
     76        return;
     77    }
    7478    if (!m_hudTexture)
    7579        m_hudTexture = ManagedTexture::create(layerRenderer->renderSurfaceTextureManager());
     
    102106        PlatformCanvas::AutoLocker locker(&canvas);
    103107
    104         m_hudTexture->bindTexture(context, layerRenderer->renderSurfaceTextureAllocator());
     108        m_hudTexture->bindTexture(layerTreeHostImpl->context(), layerRenderer->renderSurfaceTextureAllocator());
    105109        bool uploadedViaMap = false;
    106         if (layerRenderer->contextSupportsMapSub()) {
     110        if (layerRenderer->capabilities().usingMapSub) {
    107111            Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context->getExtensions());
    108112            uint8_t* pixelDest = static_cast<uint8_t*>(extensions->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, hudSize.width(), hudSize.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY));
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp

    r115509 r119313  
    5454}
    5555
    56 void CCIOSurfaceLayerImpl::willDraw(LayerRendererChromium* layerRenderer)
     56void CCIOSurfaceLayerImpl::willDraw(CCRenderer* layerRenderer, CCGraphicsContext* context)
    5757{
    58     CCLayerImpl::willDraw(layerRenderer);
     58    CCLayerImpl::willDraw(layerRenderer, context);
    5959
    6060    if (m_ioSurfaceChanged) {
    61         GraphicsContext3D* context = layerRenderer->context();
    62         Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context->getExtensions());
     61        GraphicsContext3D* context3d = context->context3D();
     62        if (!context3d) {
     63            // FIXME: Implement this path for software compositing.
     64            return;
     65        }
     66        Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context3d->getExtensions());
    6367        ASSERT(extensions->supports("GL_CHROMIUM_iosurface"));
    6468        ASSERT(extensions->supports("GL_ARB_texture_rectangle"));
    6569
    6670        if (!m_ioSurfaceTextureId)
    67             m_ioSurfaceTextureId = context->createTexture();
     71            m_ioSurfaceTextureId = context3d->createTexture();
    6872
    69         GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0));
    70         GLC(context, context->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, m_ioSurfaceTextureId));
    71         GLC(context, context->texParameteri(Extensions3D::TEXTURE_RECTANGLE_ARB, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
    72         GLC(context, context->texParameteri(Extensions3D::TEXTURE_RECTANGLE_ARB, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
    73         GLC(context, context->texParameteri(Extensions3D::TEXTURE_RECTANGLE_ARB, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
    74         GLC(context, context->texParameteri(Extensions3D::TEXTURE_RECTANGLE_ARB, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
     73        GLC(context3d, context3d->activeTexture(GraphicsContext3D::TEXTURE0));
     74        GLC(context3d, context3d->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, m_ioSurfaceTextureId));
     75        GLC(context3d, context3d->texParameteri(Extensions3D::TEXTURE_RECTANGLE_ARB, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
     76        GLC(context3d, context3d->texParameteri(Extensions3D::TEXTURE_RECTANGLE_ARB, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
     77        GLC(context3d, context3d->texParameteri(Extensions3D::TEXTURE_RECTANGLE_ARB, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
     78        GLC(context3d, context3d->texParameteri(Extensions3D::TEXTURE_RECTANGLE_ARB, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
    7579        extensions->texImageIOSurface2DCHROMIUM(Extensions3D::TEXTURE_RECTANGLE_ARB,
    7680                                                m_ioSurfaceSize.width(),
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h

    r115509 r119313  
    4444    virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE;
    4545
    46     virtual void willDraw(LayerRendererChromium*) OVERRIDE;
     46    virtual void willDraw(CCRenderer*, CCGraphicsContext*) OVERRIDE;
    4747    virtual void didLoseContext() OVERRIDE;
    4848
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp

    r119178 r119313  
    3030#include "cc/CCLayerImpl.h"
    3131
    32 #include "GraphicsContext3D.h"
    3332#include "LayerChromium.h"
    3433#include "LayerRendererChromium.h"
     
    146145}
    147146
    148 void CCLayerImpl::willDraw(LayerRendererChromium*)
     147void CCLayerImpl::willDraw(CCRenderer*, CCGraphicsContext*)
    149148{
    150149#ifndef NDEBUG
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h

    r119311 r119313  
    4444namespace WebCore {
    4545
     46class CCGraphicsContext;
    4647class CCLayerSorter;
    4748class CCQuadCuller;
     49class CCRenderer;
    4850class LayerChromium;
    49 class LayerRendererChromium;
    5051
    5152class CCLayerImpl : public CCLayerAnimationControllerClient {
     
    8485    // the layer is destroyed. To enforce this, any class that overrides
    8586    // willDraw/didDraw must call the base class version.
    86     virtual void willDraw(LayerRendererChromium*);
     87    virtual void willDraw(CCRenderer*, CCGraphicsContext*);
    8788    virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) { }
    8889    virtual void didDraw();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp

    r119178 r119313  
    266266}
    267267
    268 PassRefPtr<GraphicsContext3D> CCLayerTreeHost::createContext()
    269 {
    270     return m_client->createContext();
     268PassRefPtr<CCGraphicsContext> CCLayerTreeHost::createContext()
     269{
     270    RefPtr<CCGraphicsContext> context;
     271    if (settings().forceSoftwareCompositing)
     272        return CCGraphicsContext::create2D();
     273    return CCGraphicsContext::create3D(m_client->createContext3D());
    271274}
    272275
     
    286289
    287290// Temporary hack until WebViewImpl context creation gets simplified
    288 GraphicsContext3D* CCLayerTreeHost::context()
     291CCGraphicsContext* CCLayerTreeHost::context()
    289292{
    290293    return m_proxy->context();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h

    r119178 r119313  
    3232#include "RateLimiter.h"
    3333#include "cc/CCAnimationEvents.h"
     34#include "cc/CCGraphicsContext.h"
    3435#include "cc/CCLayerTreeHostCommon.h"
    3536#include "cc/CCProxy.h"
     
    6061    virtual void layout() = 0;
    6162    virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) = 0;
    62     virtual PassRefPtr<GraphicsContext3D> createContext() = 0;
     63    virtual PassRefPtr<GraphicsContext3D> createContext3D() = 0;
    6364    virtual void didRecreateContext(bool success) = 0;
    6465    virtual void willCommit() = 0;
     
    7778    CCSettings()
    7879            : acceleratePainting(false)
     80            , forceSoftwareCompositing(false)
    7981            , showFPSCounter(false)
    8082            , showPlatformLayerTree(false)
     
    9395
    9496    bool acceleratePainting;
     97    bool forceSoftwareCompositing;
    9598    bool showFPSCounter;
    9699    bool showPlatformLayerTree;
     
    160163    void finishCommitOnImplThread(CCLayerTreeHostImpl*);
    161164    void commitComplete();
    162     PassRefPtr<GraphicsContext3D> createContext();
     165    PassRefPtr<CCGraphicsContext> createContext();
    163166    virtual PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl(CCLayerTreeHostImplClient*);
    164167    void didLoseContext();
     
    187190    // NOTE: The returned value can only be used to make GL calls or make the
    188191    // context current on the thread the compositor is running on!
    189     GraphicsContext3D* context();
     192    CCGraphicsContext* context();
    190193
    191194    // Composites and attempts to read back the result into the provided
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp

    r119178 r119313  
    2828
    2929#include "Extensions3D.h"
    30 #include "GraphicsContext3D.h"
    3130#include "LayerRendererChromium.h"
    3231#include "TraceEvent.h"
     
    168167}
    169168
    170 GraphicsContext3D* CCLayerTreeHostImpl::context()
    171 {
    172     return m_layerRenderer ? m_layerRenderer->context() : 0;
     169CCGraphicsContext* CCLayerTreeHostImpl::context()
     170{
     171    return m_context.get();
    173172}
    174173
     
    332331            pass->appendQuadsForRenderSurfaceLayer(*it, &occlusionTracker);
    333332        else if (it.representsItself() && !it->visibleLayerRect().isEmpty()) {
    334             it->willDraw(m_layerRenderer.get());
     333            it->willDraw(m_layerRenderer.get(), context());
    335334            pass->appendQuadsForLayer(*it, &occlusionTracker, hadMissingTiles);
    336335        }
     
    548547}
    549548
    550 bool CCLayerTreeHostImpl::initializeLayerRenderer(PassRefPtr<GraphicsContext3D> context, TextureUploaderOption textureUploader)
    551 {
     549bool CCLayerTreeHostImpl::initializeLayerRenderer(PassRefPtr<CCGraphicsContext> context, TextureUploaderOption textureUploader)
     550{
     551    GraphicsContext3D* context3d = context->context3D();
     552    if (!context3d) {
     553        // FIXME: Implement this path for software compositing.
     554        return false;
     555    }
     556
    552557    OwnPtr<LayerRendererChromium> layerRenderer;
    553     layerRenderer = LayerRendererChromium::create(this, context, textureUploader);
     558    layerRenderer = LayerRendererChromium::create(this, context3d, textureUploader);
    554559
    555560    // Since we now have a new context/layerRenderer, we cannot continue to use the old
     
    561566
    562567    m_layerRenderer = layerRenderer.release();
     568    if (m_layerRenderer)
     569        m_context = context;
    563570
    564571    if (!m_visible && m_layerRenderer)
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h

    r119178 r119313  
    6464
    6565// CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering state
    66 class CCLayerTreeHostImpl : public CCInputHandlerClient, LayerRendererChromiumClient {
     66class CCLayerTreeHostImpl : public CCInputHandlerClient, CCRendererClient {
    6767    WTF_MAKE_NONCOPYABLE(CCLayerTreeHostImpl);
    6868    typedef Vector<CCLayerImpl*> CCLayerList;
     
    104104    void didDrawAllLayers(const FrameData&);
    105105
    106     // LayerRendererChromiumClient implementation
     106    // CCRendererClient implementation
    107107    virtual const IntSize& deviceViewportSize() const OVERRIDE { return m_deviceViewportSize; }
    108108    virtual const CCSettings& settings() const OVERRIDE { return m_settings; }
     
    114114    // Implementation
    115115    bool canDraw();
    116     GraphicsContext3D* context();
     116    CCGraphicsContext* context();
    117117
    118118    String layerTreeAsText() const;
     
    122122    int frameNumber() const { return m_frameNumber; }
    123123
    124     bool initializeLayerRenderer(PassRefPtr<GraphicsContext3D>, TextureUploaderOption);
     124    bool initializeLayerRenderer(PassRefPtr<CCGraphicsContext>, TextureUploaderOption);
    125125    bool isContextLost();
    126     LayerRendererChromium* layerRenderer() { return m_layerRenderer.get(); }
     126    CCRenderer* layerRenderer() { return m_layerRenderer.get(); }
    127127    const LayerRendererCapabilities& layerRendererCapabilities() const;
    128128    TextureAllocator* contentsTextureAllocator() const;
     
    210210    void dumpRenderSurfaces(TextStream&, int indent, const CCLayerImpl*) const;
    211211
    212     OwnPtr<LayerRendererChromium> m_layerRenderer;
     212    RefPtr<CCGraphicsContext> m_context;
     213    OwnPtr<CCRenderer> m_layerRenderer;
    213214    OwnPtr<CCLayerImpl> m_rootLayerImpl;
    214215    CCLayerImpl* m_scrollLayerImpl;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h

    r118383 r119313  
    3636class CCFontAtlas;
    3737class CCThread;
    38 class GraphicsContext3D;
     38class CCGraphicsContext;
    3939struct LayerRendererCapabilities;
    4040
     
    114114
    115115    // Temporary hack while render_widget still does scheduling for CCLayerTreeHostMainThreadI
    116     virtual GraphicsContext3D* context() = 0;
     116    virtual CCGraphicsContext* context() = 0;
    117117
    118118    // Testing hooks
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp

    r115278 r119313  
    5151}
    5252
    53 void CCScrollbarLayerImpl::willDraw(LayerRendererChromium* layerRenderer)
    54 {
    55     CCLayerImpl::willDraw(layerRenderer);
     53void CCScrollbarLayerImpl::willDraw(CCRenderer* layerRenderer, CCGraphicsContext* context)
     54{
     55    CCLayerImpl::willDraw(layerRenderer, context);
    5656
    5757    if (bounds().isEmpty() || contentBounds().isEmpty())
     
    7878    {
    7979        PlatformCanvas::AutoLocker locker(&canvas);
    80         GraphicsContext3D* context = layerRenderer->context();
    8180        m_texture->bindTexture(context, layerRenderer->renderSurfaceTextureAllocator());
    8281
    8382        // FIXME: Skia uses BGRA actually, we correct that with the swizzle pixel shader.
    84         GLC(context, context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, m_texture->format(), canvas.size().width(), canvas.size().height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels()));
     83        GraphicsContext3D* context3d = context->context3D();
     84        if (!context3d) {
     85            // FIXME: Implement this path for software compositing.
     86            return;
     87        }
     88
     89        GLC(context3d, context3d->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, m_texture->format(), canvas.size().width(), canvas.size().height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels()));
    8590    }
    8691}
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h

    r113902 r119313  
    6060    void setScrollLayer(CCLayerImpl* scrollLayer) { m_scrollLayer = scrollLayer; }
    6161
    62     virtual void willDraw(LayerRendererChromium*) OVERRIDE;
     62    virtual void willDraw(CCRenderer*, CCGraphicsContext*) OVERRIDE;
    6363    virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE;
    6464    virtual void didDraw() OVERRIDE;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp

    r119173 r119313  
    2727#include "cc/CCSingleThreadProxy.h"
    2828
    29 #include "GraphicsContext3D.h"
    3029#include "LayerRendererChromium.h"
    3130#include "TraceEvent.h"
     
    113112}
    114113
    115 GraphicsContext3D* CCSingleThreadProxy::context()
     114CCGraphicsContext* CCSingleThreadProxy::context()
    116115{
    117116    ASSERT(CCProxy::isMainThread());
     
    140139{
    141140    ASSERT(CCProxy::isMainThread());
    142     RefPtr<GraphicsContext3D> context = m_layerTreeHost->createContext();
     141    RefPtr<CCGraphicsContext> context = m_layerTreeHost->createContext();
    143142    if (!context)
    144143        return false;
     
    177176    ASSERT(m_contextLost);
    178177
    179     RefPtr<GraphicsContext3D> context = m_layerTreeHost->createContext();
     178    RefPtr<CCGraphicsContext> context = m_layerTreeHost->createContext();
    180179    if (!context)
    181180        return false;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h

    r119173 r119313  
    4646    virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE;
    4747    virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double duration) OVERRIDE;
    48     virtual GraphicsContext3D* context() OVERRIDE;
     48    virtual CCGraphicsContext* context() OVERRIDE;
    4949    virtual void finishAllRendering() OVERRIDE;
    5050    virtual bool isStarted() const OVERRIDE;
     
    9898    // Holds on to the context between initializeContext() and initializeLayerRenderer() calls. Shouldn't
    9999    // be used for anything else.
    100     RefPtr<GraphicsContext3D> m_contextBeforeInitialization;
     100    RefPtr<CCGraphicsContext> m_contextBeforeInitialization;
    101101
    102102    OwnPtr<CCSingleThreadProxyAnimationTimer> m_animationTimer;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp

    r116351 r119313  
    9393}
    9494
    95 void CCTextureUpdater::update(GraphicsContext3D* context, TextureAllocator* allocator, TextureCopier* copier, TextureUploader* uploader, size_t count)
     95void CCTextureUpdater::update(CCGraphicsContext* context, TextureAllocator* allocator, TextureCopier* copier, TextureUploader* uploader, size_t count)
    9696{
    9797    size_t index;
     
    143143    // before letting the main thread proceed as it may make draw calls to the source texture of one of
    144144    // our copy operations.
    145     if (m_copyEntries.size() || m_managedCopyEntries.size())
    146         context->flush();
     145    if (m_copyEntries.size() || m_managedCopyEntries.size()) {
     146        GraphicsContext3D* context3d = context->context3D();
     147        if (context3d)
     148            context3d->flush();
     149        // FIXME: Implement this path for software compositing.
     150    }
    147151
    148152    // If no entries left to process, auto-clear.
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h

    r116351 r119313  
    3333namespace WebCore {
    3434
    35 class GraphicsContext3D;
    3635class TextureAllocator;
    3736class TextureCopier;
     
    5150
    5251    // Update some textures.
    53     void update(GraphicsContext3D*, TextureAllocator*, TextureCopier*, TextureUploader*, size_t count);
     52    void update(CCGraphicsContext*, TextureAllocator*, TextureCopier*, TextureUploader*, size_t count);
    5453
    5554    void clear();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp

    r118513 r119313  
    153153}
    154154
    155 GraphicsContext3D* CCThreadProxy::context()
     155CCGraphicsContext* CCThreadProxy::context()
    156156{
    157157    return 0;
     
    177177{
    178178    TRACE_EVENT("CCThreadProxy::initializeContext", this, 0);
    179     RefPtr<GraphicsContext3D> context = m_layerTreeHost->createContext();
     179    RefPtr<CCGraphicsContext> context = m_layerTreeHost->createContext();
    180180    if (!context)
    181181        return false;
     
    183183
    184184    // Leak the context pointer so we can transfer ownership of it to the other side...
    185     GraphicsContext3D* contextPtr = context.release().leakRef();
     185    CCGraphicsContext* contextPtr = context.release().leakRef();
    186186    ASSERT(contextPtr->hasOneRef());
    187187
     
    230230
    231231    // Try to create the context.
    232     RefPtr<GraphicsContext3D> context = m_layerTreeHost->createContext();
     232    RefPtr<CCGraphicsContext> context = m_layerTreeHost->createContext();
    233233    if (!context)
    234234        return false;
    235     if (CCLayerTreeHost::needsFilterContext())
     235    if (CCLayerTreeHost::needsFilterContext() && !m_layerTreeHost->settings().forceSoftwareCompositing)
    236236        if (!SharedGraphicsContext3D::createForImplThread())
    237237            return false;
     
    240240
    241241    // Leak the context pointer so we can transfer ownership of it to the other side...
    242     GraphicsContext3D* contextPtr = context.release().leakRef();
     242    CCGraphicsContext* contextPtr = context.release().leakRef();
    243243    ASSERT(contextPtr->hasOneRef());
    244244
     
    477477    }
    478478
    479     if (CCLayerTreeHost::needsFilterContext() && !SharedGraphicsContext3D::haveForImplThread())
     479    if (CCLayerTreeHost::needsFilterContext() && !m_layerTreeHost->settings().forceSoftwareCompositing && !SharedGraphicsContext3D::haveForImplThread())
    480480        SharedGraphicsContext3D::createForImplThread();
    481481
     
    808808}
    809809
    810 void CCThreadProxy::initializeContextOnImplThread(GraphicsContext3D* context)
     810void CCThreadProxy::initializeContextOnImplThread(CCGraphicsContext* context)
    811811{
    812812    TRACE_EVENT("CCThreadProxy::initializeContextOnImplThread", this, 0);
     
    865865}
    866866
    867 void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, GraphicsContext3D* contextPtr, bool* recreateSucceeded, LayerRendererCapabilities* capabilities)
     867void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, CCGraphicsContext* contextPtr, bool* recreateSucceeded, LayerRendererCapabilities* capabilities)
    868868{
    869869    TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread");
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h

    r118383 r119313  
    5454    virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE;
    5555    virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double duration) OVERRIDE;
    56     virtual GraphicsContext3D* context() OVERRIDE;
     56    virtual CCGraphicsContext* context() OVERRIDE;
    5757    virtual void finishAllRendering() OVERRIDE;
    5858    virtual bool isStarted() const OVERRIDE;
     
    137137    void initializeImplOnImplThread(CCCompletionEvent*);
    138138    void setSurfaceReadyOnImplThread();
    139     void initializeContextOnImplThread(GraphicsContext3D*);
     139    void initializeContextOnImplThread(CCGraphicsContext*);
    140140    void initializeLayerRendererOnImplThread(CCCompletionEvent*, bool* initializeSucceeded, LayerRendererCapabilities*);
    141141    void layerTreeHostClosedOnImplThread(CCCompletionEvent*);
    142142    void setFullRootLayerDamageOnImplThread();
    143143    void acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEvent*);
    144     void recreateContextOnImplThread(CCCompletionEvent*, GraphicsContext3D*, bool* recreateSucceeded, LayerRendererCapabilities*);
     144    void recreateContextOnImplThread(CCCompletionEvent*, CCGraphicsContext*, bool* recreateSucceeded, LayerRendererCapabilities*);
    145145    CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool forcedDraw);
    146146    void setFontAtlasOnImplThread(PassOwnPtr<CCFontAtlas>);
     
    169169    RefPtr<CCScopedThreadProxy> m_mainThreadProxy;
    170170
    171     // Holds on to the GraphicsContext3D we might use for compositing in between initializeContext()
     171    // Holds on to the context we might use for compositing in between initializeContext()
    172172    // and initializeLayerRenderer() calls.
    173     RefPtr<GraphicsContext3D> m_contextBeforeInitializationOnImplThread;
     173    RefPtr<CCGraphicsContext> m_contextBeforeInitializationOnImplThread;
    174174
    175175    // Set when the main thread is waiting on a scheduledActionBeginFrame to be issued.
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp

    r116979 r119313  
    129129}
    130130
    131 void CCVideoLayerImpl::willDraw(LayerRendererChromium* layerRenderer)
     131void CCVideoLayerImpl::willDraw(CCRenderer* layerRenderer, CCGraphicsContext* context)
    132132{
    133133    ASSERT(CCProxy::isImplThread());
    134     CCLayerImpl::willDraw(layerRenderer);
     134    CCLayerImpl::willDraw(layerRenderer, context);
    135135
    136136    // Explicitly lock and unlock the provider mutex so it can be held from
     
    149149}
    150150
    151 void CCVideoLayerImpl::willDrawInternal(LayerRendererChromium* layerRenderer)
     151void CCVideoLayerImpl::willDrawInternal(CCRenderer* layerRenderer)
    152152{
    153153    ASSERT(CCProxy::isImplThread());
     
    245245}
    246246
    247 bool CCVideoLayerImpl::reserveTextures(const WebKit::WebVideoFrame& frame, GC3Denum format, LayerRendererChromium* layerRenderer)
     247bool CCVideoLayerImpl::reserveTextures(const WebKit::WebVideoFrame& frame, GC3Denum format, CCRenderer* layerRenderer)
    248248{
    249249    if (frame.planes() > MaxPlanes)
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h

    r115403 r119313  
    4949    virtual ~CCVideoLayerImpl();
    5050
    51     virtual void willDraw(LayerRendererChromium*) OVERRIDE;
     51    virtual void willDraw(CCRenderer*, CCGraphicsContext*) OVERRIDE;
    5252    virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE;
    5353    virtual void didDraw() OVERRIDE;
     
    8282    virtual const char* layerTypeAsString() const OVERRIDE { return "VideoLayer"; }
    8383
    84     void willDrawInternal(LayerRendererChromium*);
    85     bool reserveTextures(const WebKit::WebVideoFrame&, GC3Denum format, LayerRendererChromium*);
     84    void willDrawInternal(CCRenderer*);
     85    bool reserveTextures(const WebKit::WebVideoFrame&, GC3Denum format, CCRenderer*);
    8686
    8787    // Guards the destruction of m_provider and the frame that it provides
  • trunk/Source/WebKit/chromium/ChangeLog

    r119311 r119313  
     12012-06-01  Alexandre Elias  <aelias@google.com>
     2
     3        [chromium] Software compositor initialization and base classes
     4        https://bugs.webkit.org/show_bug.cgi?id=87920
     5
     6        Reviewed by James Robinson.
     7
     8        Add a new setting to force software compositing.  In this mode,
     9        no GraphicsContext3D should ever be created.
     10
     11        * public/WebSettings.h:
     12        * src/WebLayerTreeView.cpp:
     13        (WebKit::WebLayerTreeView::Settings::operator CCSettings):
     14        (WebKit::WebLayerTreeView::context):
     15        * src/WebLayerTreeViewImpl.cpp:
     16        * src/WebSettingsImpl.cpp:
     17        (WebKit::WebSettingsImpl::WebSettingsImpl):
     18        (WebKit::WebSettingsImpl::setForceSoftwareCompositing):
     19        (WebKit):
     20        * src/WebSettingsImpl.h:
     21        (WebSettingsImpl):
     22        (WebKit::WebSettingsImpl::forceSoftwareCompositing):
     23        * src/WebViewImpl.cpp:
     24        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
     25        (WebKit::WebViewImpl::createCompositorGraphicsContext3D):
     26        (WebKit::WebViewImpl::createContext3D):
     27        * tests/CCLayerTreeHostImplTest.cpp:
     28        (WebKitTests::CCLayerTreeHostImplTest::createContext):
     29        (WebKitTests::TEST_F):
     30        * tests/CCLayerTreeHostTest.cpp:
     31        (WTF::CCLayerTreeHostTestAtomicCommit::commitCompleteOnCCThread):
     32        (WTF::CCLayerTreeHostTestAtomicCommit::drawLayersOnCCThread):
     33        (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::commitCompleteOnCCThread):
     34        (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::drawLayersOnCCThread):
     35        * tests/CCTiledLayerTestCommon.cpp:
     36        (WebKitTests::FakeLayerTextureUpdater::Texture::updateRect):
     37        * tests/CCTiledLayerTestCommon.h:
     38        (Texture):
     39        (WebKitTests::FakeTextureCopier::copyTexture):
     40        (WebKitTests::FakeTextureUploader::uploadTexture):
     41        * tests/Canvas2DLayerChromiumTest.cpp:
     42        (Canvas2DLayerChromiumTest::fullLifecycleTest):
     43        * tests/FakeCCLayerTreeHostClient.h:
     44        * tests/LayerRendererChromiumTest.cpp:
     45        (FakeLayerRendererChromium::FakeLayerRendererChromium):
     46        (LayerRendererChromiumTest::LayerRendererChromiumTest):
     47        (LayerRendererChromiumTest):
     48        (TEST):
     49        * tests/TextureCopierTest.cpp:
     50        * tests/TiledLayerChromiumTest.cpp:
     51        (WTF::TEST):
     52
    1532012-06-01  Sheriff Bot  <webkit.review.bot@gmail.com>
    254
  • trunk/Source/WebKit/chromium/public/WebSettings.h

    r118707 r119313  
    115115    virtual void setAcceleratedCompositingEnabled(bool) = 0;
    116116    virtual void setForceCompositingMode(bool) = 0;
     117    virtual void setForceSoftwareCompositing(bool) = 0;
    117118    virtual void setMockScrollbarsEnabled(bool) = 0;
    118119    virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool) = 0;
     
    157158    virtual void setSyncXHRInDocumentsEnabled(bool) = 0;
    158159
     160    virtual bool forceSoftwareCompositing() const = 0;
     161
    159162protected:
    160163    ~WebSettings() { }
  • trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp

    r118563 r119313  
    4242    CCSettings settings;
    4343    settings.acceleratePainting = acceleratePainting;
     44    settings.forceSoftwareCompositing = forceSoftwareCompositing;
    4445    settings.showFPSCounter = showFPSCounter;
    4546    settings.showPlatformLayerTree = showPlatformLayerTree;
     
    162163WebGraphicsContext3D* WebLayerTreeView::context()
    163164{
    164     return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_private->layerTreeHost()->context());
     165    return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_private->layerTreeHost()->context()->context3D());
    165166}
    166167
  • trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp

    r118563 r119313  
    5555    virtual void layout() OVERRIDE { m_client->layout(); }
    5656    virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE { m_client->applyScrollAndScale(scrollDelta, pageScale); }
    57     virtual PassRefPtr<WebCore::GraphicsContext3D> createContext() OVERRIDE
     57    virtual PassRefPtr<WebCore::GraphicsContext3D> createContext3D() OVERRIDE
    5858    {
    5959        OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(m_client->createContext3D());
  • trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp

    r118707 r119313  
    4848WebSettingsImpl::WebSettingsImpl(Settings* settings)
    4949    : m_settings(settings)
     50    , m_forceSoftwareCompositing(false)
    5051    , m_showFPSCounter(false)
    5152    , m_showPlatformLayerTree(false)
     
    389390}
    390391
     392void WebSettingsImpl::setForceSoftwareCompositing(bool enabled)
     393{
     394    m_forceSoftwareCompositing = enabled;
     395}
     396
    391397void WebSettingsImpl::setMockScrollbarsEnabled(bool enabled)
    392398{
  • trunk/Source/WebKit/chromium/src/WebSettingsImpl.h

    r118707 r119313  
    110110    virtual void setAcceleratedCompositingEnabled(bool);
    111111    virtual void setForceCompositingMode(bool);
     112    virtual void setForceSoftwareCompositing(bool);
    112113    virtual void setMockScrollbarsEnabled(bool);
    113114    virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool);
     
    159160    WebSize defaultTileSize() const { return m_defaultTileSize; }
    160161    WebSize maxUntiledLayerSize() const { return m_maxUntiledLayerSize; }
     162    virtual bool forceSoftwareCompositing() const { return m_forceSoftwareCompositing; }
    161163
    162164private:
    163165    WebCore::Settings* m_settings;
     166    bool m_forceSoftwareCompositing;
    164167    bool m_showFPSCounter;
    165168    bool m_showPlatformLayerTree;
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r119085 r119313  
    34483448        layerTreeViewSettings.showPlatformLayerTree = settingsImpl()->showPlatformLayerTree();
    34493449        layerTreeViewSettings.showPaintRects = settingsImpl()->showPaintRects();
     3450        layerTreeViewSettings.forceSoftwareCompositing = settings()->forceSoftwareCompositing();
    34503451
    34513452        layerTreeViewSettings.perTilePainting = page()->settings()->perTileDrawingEnabled();
     
    34963497PassOwnPtr<WebKit::WebGraphicsContext3D> WebViewImpl::createCompositorGraphicsContext3D()
    34973498{
     3499    if (settings()->forceSoftwareCompositing())
     3500        CRASH();
     3501
    34983502    // Explicitly disable antialiasing for the compositor. As of the time of
    34993503    // this writing, the only platform that supported antialiasing for the
     
    35193523WebKit::WebGraphicsContext3D* WebViewImpl::createContext3D()
    35203524{
     3525    if (settings()->forceSoftwareCompositing())
     3526        CRASH();
     3527
    35213528    OwnPtr<WebKit::WebGraphicsContext3D> webContext;
    35223529
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp

    r116979 r119313  
    108108
    109109protected:
    110     PassRefPtr<GraphicsContext3D> createContext()
    111     {
    112         return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3D()), GraphicsContext3D::RenderDirectlyToHostWindow);
     110    PassRefPtr<CCGraphicsContext> createContext()
     111    {
     112        return CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3D()), GraphicsContext3D::RenderDirectlyToHostWindow));
    113113    }
    114114
     
    417417    }
    418418
    419     virtual void willDraw(LayerRendererChromium*)
     419    virtual void willDraw(CCRenderer*, CCGraphicsContext*)
    420420    {
    421421        m_willDrawCalled = true;
     
    989989    ReshapeTrackerContext* reshapeTracker = new ReshapeTrackerContext();
    990990    RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(reshapeTracker), GraphicsContext3D::RenderDirectlyToHostWindow);
    991     m_hostImpl->initializeLayerRenderer(context, UnthrottledUploader);
     991    RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context);
     992    m_hostImpl->initializeLayerRenderer(ccContext, UnthrottledUploader);
    992993
    993994    CCLayerImpl* root = new FakeDrawableCCLayerImpl(1);
     
    10321033    PartialSwapTrackerContext* partialSwapTracker = new PartialSwapTrackerContext();
    10331034    RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(partialSwapTracker), GraphicsContext3D::RenderDirectlyToHostWindow);
     1035    RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context);
    10341036
    10351037    // This test creates its own CCLayerTreeHostImpl, so
     
    10381040    settings.partialSwapEnabled = true;
    10391041    OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(settings, this);
    1040     layerTreeHostImpl->initializeLayerRenderer(context, UnthrottledUploader);
     1042    layerTreeHostImpl->initializeLayerRenderer(ccContext, UnthrottledUploader);
    10411043    layerTreeHostImpl->setViewportSize(IntSize(500, 500));
    10421044
     
    11521154{
    11531155    // The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects.
    1154     m_hostImpl->initializeLayerRenderer(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow), UnthrottledUploader);
     1156    m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow)), UnthrottledUploader);
    11551157    m_hostImpl->finishAllRendering();
    11561158}
     
    13571359    // Lose the context, replacing it with a StrictWebGraphicsContext3D, that
    13581360    // will warn if any resource from the previous context gets used.
    1359     m_hostImpl->initializeLayerRenderer(StrictWebGraphicsContext3D::createGraphicsContext(), UnthrottledUploader);
     1361    m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(StrictWebGraphicsContext3D::createGraphicsContext()), UnthrottledUploader);
    13601362    EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
    13611363    m_hostImpl->drawLayers(frame);
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp

    r119311 r119313  
    296296    }
    297297
    298     virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE
     298    virtual PassRefPtr<GraphicsContext3D> createContext3D() OVERRIDE
    299299    {
    300300        return m_testHooks->createContext();
     
    21552155    virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl)
    21562156    {
    2157         CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()));
     2157        CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D()));
    21582158
    21592159        switch (impl->sourceFrameNumber()) {
     
    21892189    virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
    21902190    {
    2191         CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()));
     2191        CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D()));
    21922192
    21932193        // Number of textures used for draw should always be one.
     
    22592259    virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl)
    22602260    {
    2261         CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()));
     2261        CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D()));
    22622262
    22632263        switch (impl->sourceFrameNumber()) {
     
    23282328    virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
    23292329    {
    2330         CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()));
     2330        CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D()));
    23312331
    23322332        // Number of textures used for drawing should two except for frame 4
  • trunk/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp

    r114827 r119313  
    4141}
    4242
    43 void FakeLayerTextureUpdater::Texture::updateRect(GraphicsContext3D*, TextureAllocator* allocator, const IntRect&, const IntRect&)
     43void FakeLayerTextureUpdater::Texture::updateRect(CCGraphicsContext*, TextureAllocator* allocator, const IntRect&, const IntRect&)
    4444{
    4545    if (allocator)
  • trunk/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h

    r116351 r119313  
    2626#define CCTiledLayerTestCommon_h
    2727
    28 #include "GraphicsContext3D.h"
    2928#include "IntRect.h"
    3029#include "IntSize.h"
     
    3534#include "TextureUploader.h"
    3635#include "TiledLayerChromium.h"
     36#include "cc/CCGraphicsContext.h"
    3737#include "cc/CCTextureUpdater.h"
    3838#include "cc/CCTiledLayerImpl.h"
     
    4949        virtual ~Texture();
    5050
    51         virtual void updateRect(WebCore::GraphicsContext3D*, WebCore::TextureAllocator* , const WebCore::IntRect&, const WebCore::IntRect&);
     51        virtual void updateRect(WebCore::CCGraphicsContext*, WebCore::TextureAllocator* , const WebCore::IntRect&, const WebCore::IntRect&);
    5252        virtual void prepareRect(const WebCore::IntRect&);
    5353
     
    157157class FakeTextureCopier : public WebCore::TextureCopier {
    158158public:
    159     virtual void copyTexture(WebCore::GraphicsContext3D*, unsigned, unsigned, const WebCore::IntSize&) { }
     159    virtual void copyTexture(WebCore::CCGraphicsContext*, unsigned, unsigned, const WebCore::IntSize&) { }
    160160};
    161161
     
    165165    virtual void beginUploads() { }
    166166    virtual void endUploads() { }
    167     virtual void uploadTexture(WebCore::GraphicsContext3D* context, WebCore::LayerTextureUpdater::Texture* texture, WebCore::TextureAllocator* allocator, const WebCore::IntRect sourceRect, const WebCore::IntRect destRect) { texture->updateRect(context, allocator, sourceRect, destRect); }
     167    virtual void uploadTexture(WebCore::CCGraphicsContext* context, WebCore::LayerTextureUpdater::Texture* texture, WebCore::TextureAllocator* allocator, const WebCore::IntRect sourceRect, const WebCore::IntRect destRect) { texture->updateRect(context, allocator, sourceRect, destRect); }
    168168};
    169169
  • trunk/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp

    r116351 r119313  
    8686class MockTextureCopier : public TextureCopier {
    8787public:
    88     MOCK_METHOD4(copyTexture, void(GraphicsContext3D*, unsigned, unsigned, const IntSize&));
     88    MOCK_METHOD4(copyTexture, void(CCGraphicsContext*, unsigned, unsigned, const IntSize&));
    8989};
    9090
     
    9494    MOCK_METHOD0(beginUploads, void());
    9595    MOCK_METHOD0(endUploads, void());
    96     MOCK_METHOD5(uploadTexture, void(GraphicsContext3D*, LayerTextureUpdater::Texture*, TextureAllocator*, const IntRect, const IntRect));
     96    MOCK_METHOD5(uploadTexture, void(CCGraphicsContext*, LayerTextureUpdater::Texture*, TextureAllocator*, const IntRect, const IntRect));
    9797};
    9898
     
    106106
    107107        RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
     108        RefPtr<CCGraphicsContext> ccMainContext = CCGraphicsContext::create3D(mainContext);
    108109        RefPtr<GraphicsContext3D> implContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
     110        RefPtr<CCGraphicsContext> ccImplContext = CCGraphicsContext::create3D(implContext);
    109111
    110112        MockCanvasContext& mainMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(mainContext.get()));
     
    141143                EXPECT_CALL(allocatorMock, createTexture(size, GraphicsContext3D::RGBA))
    142144                    .WillOnce(Return(frontTextureId));
    143                 EXPECT_CALL(copierMock, copyTexture(implContext.get(), backTextureId, frontTextureId, size));
     145                EXPECT_CALL(copierMock, copyTexture(ccImplContext.get(), backTextureId, frontTextureId, size));
    144146                EXPECT_CALL(implMock, flush());
    145147
     
    165167            EXPECT_EQ(0u, static_cast<CCTextureLayerImpl*>(layerImpl.get())->textureId());
    166168
    167             updater.update(implContext.get(), &allocatorMock, &copierMock, &uploaderMock, 1);
     169            updater.update(ccImplContext.get(), &allocatorMock, &copierMock, &uploaderMock, 1);
    168170            canvas->pushPropertiesTo(layerImpl.get());
    169171
  • trunk/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h

    r118513 r119313  
    4040    virtual void layout() OVERRIDE { }
    4141    virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) OVERRIDE { }
    42     virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE
     42    virtual PassRefPtr<GraphicsContext3D> createContext3D() OVERRIDE
    4343    {
    4444        GraphicsContext3D::Attributes attrs;
  • trunk/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp

    r119160 r119313  
    6262};
    6363
    64 class FakeLayerRendererChromiumClient : public LayerRendererChromiumClient {
    65 public:
    66     FakeLayerRendererChromiumClient()
     64class FakeCCRendererClient : public CCRendererClient {
     65public:
     66    FakeCCRendererClient()
    6767        : m_setFullRootLayerDamageCount(0)
    6868        , m_rootLayer(CCLayerImpl::create(1))
     
    7171    }
    7272
    73     // LayerRendererChromiumClient methods.
     73    // CCRendererClient methods.
    7474    virtual const IntSize& deviceViewportSize() const OVERRIDE { static IntSize fakeSize; return fakeSize; }
    7575    virtual const CCSettings& settings() const OVERRIDE { static CCSettings fakeSettings; return fakeSettings; }
     
    9292class FakeLayerRendererChromium : public LayerRendererChromium {
    9393public:
    94     FakeLayerRendererChromium(LayerRendererChromiumClient* client, PassRefPtr<GraphicsContext3D> context) : LayerRendererChromium(client, context, UnthrottledUploader) { }
     94    FakeLayerRendererChromium(CCRendererClient* client, PassRefPtr<GraphicsContext3D> context) : LayerRendererChromium(client, context, UnthrottledUploader) { }
    9595
    9696    // LayerRendererChromium methods.
     
    127127    RefPtr<GraphicsContext3D> m_context;
    128128    FrameCountingMemoryAllocationSettingContext& m_mockContext;
    129     FakeLayerRendererChromiumClient m_mockClient;
     129    FakeCCRendererClient m_mockClient;
    130130    FakeLayerRendererChromium m_layerRendererChromium;
    131131};
     
    271271TEST(LayerRendererChromiumTest2, initializationDoesNotMakeSynchronousCalls)
    272272{
    273     FakeLayerRendererChromiumClient mockClient;
     273    FakeCCRendererClient mockClient;
    274274    FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ForbidSynchronousCallContext), GraphicsContext3D::RenderDirectlyToHostWindow));
    275275
     
    312312TEST(LayerRendererChromiumTest2, initializationWithQuicklyLostContextDoesNotAssert)
    313313{
    314     FakeLayerRendererChromiumClient mockClient;
     314    FakeCCRendererClient mockClient;
    315315    FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new LoseContextOnFirstGetContext), GraphicsContext3D::RenderDirectlyToHostWindow));
    316316
  • trunk/Source/WebKit/chromium/tests/TextureCopierTest.cpp

    r112286 r119313  
    5555    RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
    5656    MockContext& mockContext = *static_cast<MockContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()));
     57    RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context);
    5758
    5859    {
     
    8081    IntSize size(256, 128);
    8182    OwnPtr<AcceleratedTextureCopier> copier(AcceleratedTextureCopier::create(context));
    82     copier->copyTexture(context.get(), sourceTextureId, destTextureId, size);
     83    copier->copyTexture(ccContext.get(), sourceTextureId, destTextureId, size);
    8384}
    8485
  • trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp

    r119178 r119313  
    674674    FakeTextureUploader fakeUploader;
    675675    RefPtr<GraphicsContext3D> context = createCompositorMockGraphicsContext3D(GraphicsContext3D::Attributes());
     676    RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context);
    676677
    677678    // The tile size is 100x100, so this invalidates and then paints two tiles.
     
    679680    layer->invalidateRect(IntRect(0, 0, 100, 200));
    680681    layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
    681     updater.update(context.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
     682    updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
    682683    layer->pushPropertiesTo(layerImpl.get());
    683684
     
    692693    // the LayerTextureUpdater.
    693694    layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
    694     updater.update(context.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
     695    updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
    695696    EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount());
    696697
     
    700701    layer->fakeLayerTextureUpdater()->clearPrepareCount();
    701702    layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
    702     updater.update(context.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
     703    updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
    703704    EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount());
    704705    layer->fakeLayerTextureUpdater()->clearPrepareCount();
    705706    // The layer should still be invalid as updateLayerRect invoked invalidate.
    706707    layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0);
    707     updater.update(context.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
     708    updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000);
    708709    EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount());
    709710}
Note: See TracChangeset for help on using the changeset viewer.