Changeset 112286 in webkit


Ignore:
Timestamp:
Mar 27, 2012 11:18:42 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[chromium] Add TextureCopier for copying texture contents
https://bugs.webkit.org/show_bug.cgi?id=80870

Patch by Sami Kyostila <skyostil@chromium.org> on 2012-03-27
Reviewed by Stephen White.

Source/WebCore:

This patch introduces a TextureCopier class whose job is to copy the
contents from one GL texture to another using the most efficient means
for the current GPU. This version uses render-to-texture to do the copy,
but a path based on EXT_framebuffer_blit can be added later.

The class is intended to replace the use of image path operations such
as glCopyTex{Sub}Image2D for duplicating texture contents. The reason is
that such functions may not be very well optimized in some -- mainly
mobile -- GPU drivers.

With this patch the new copier is used just for Canvas2D layer
presentation, but another potential use is for WebGL layer presentation.

Test: webkit_unit_tests: TextureCopierTest

  • WebCore.gypi:
  • platform/graphics/chromium/Canvas2DLayerChromium.cpp:

(WebCore::Canvas2DLayerChromium::Canvas2DLayerChromium):
(WebCore::Canvas2DLayerChromium::~Canvas2DLayerChromium):
(WebCore::Canvas2DLayerChromium::updateCompositorResources):

  • platform/graphics/chromium/Canvas2DLayerChromium.h:

(Canvas2DLayerChromium):

  • platform/graphics/chromium/LayerRendererChromium.cpp:

(WebCore::LayerRendererChromium::initializeSharedObjects):

  • platform/graphics/chromium/LayerRendererChromium.h:

(WebCore):
(WebCore::LayerRendererChromium::textureCopier):
(LayerRendererChromium):

  • platform/graphics/chromium/ShaderChromium.cpp:

(WebCore::VertexShaderPosTexIdentity::getShaderString):
(WebCore):
(WebCore::FragmentShaderRGBATexCopy::getShaderString):

  • platform/graphics/chromium/ShaderChromium.h:

(VertexShaderPosTexIdentity):
(WebCore::VertexShaderPosTexIdentity::init):
(WebCore):
(FragmentShaderRGBATexCopy):

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

(WebCore):
(WebCore::AcceleratedTextureCopier::AcceleratedTextureCopier):
(WebCore::AcceleratedTextureCopier::~AcceleratedTextureCopier):
(WebCore::AcceleratedTextureCopier::copyTexture):

  • platform/graphics/chromium/TextureCopier.h: Added.

(WebCore):
(TextureCopier):
(WebCore::TextureCopier::~TextureCopier):
(AcceleratedTextureCopier):
(WebCore::AcceleratedTextureCopier::create):

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

(WebCore::CCSingleThreadProxy::doCommit):

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

(WebCore::CCTextureUpdater::CCTextureUpdater):

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

(WebCore):
(CCTextureUpdater):
(WebCore::CCTextureUpdater::copier):

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

(WebCore::CCThreadProxy::beginFrameCompleteOnImplThread):

Source/WebKit/chromium:

Add new test for TextureCopier.

  • WebKit.gypi:
  • tests/Canvas2DLayerChromiumTest.cpp:
  • tests/TextureCopierTest.cpp: Added.
  • tests/TiledLayerChromiumTest.cpp:

(FakeTextureCopier):
(WTF::FakeTextureCopier::copyTexture):
(WTF):
(WTF::TEST):

Location:
trunk/Source
Files:
3 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r112284 r112286  
     12012-03-27  Sami Kyostila  <skyostil@chromium.org>
     2
     3        [chromium] Add TextureCopier for copying texture contents
     4        https://bugs.webkit.org/show_bug.cgi?id=80870
     5
     6        Reviewed by Stephen White.
     7
     8        This patch introduces a TextureCopier class whose job is to copy the
     9        contents from one GL texture to another using the most efficient means
     10        for the current GPU. This version uses render-to-texture to do the copy,
     11        but a path based on EXT_framebuffer_blit can be added later.
     12
     13        The class is intended to replace the use of image path operations such
     14        as glCopyTex{Sub}Image2D for duplicating texture contents. The reason is
     15        that such functions may not be very well optimized in some -- mainly
     16        mobile -- GPU drivers.
     17
     18        With this patch the new copier is used just for Canvas2D layer
     19        presentation, but another potential use is for WebGL layer presentation.
     20
     21        Test: webkit_unit_tests: TextureCopierTest
     22
     23        * WebCore.gypi:
     24        * platform/graphics/chromium/Canvas2DLayerChromium.cpp:
     25        (WebCore::Canvas2DLayerChromium::Canvas2DLayerChromium):
     26        (WebCore::Canvas2DLayerChromium::~Canvas2DLayerChromium):
     27        (WebCore::Canvas2DLayerChromium::updateCompositorResources):
     28        * platform/graphics/chromium/Canvas2DLayerChromium.h:
     29        (Canvas2DLayerChromium):
     30        * platform/graphics/chromium/LayerRendererChromium.cpp:
     31        (WebCore::LayerRendererChromium::initializeSharedObjects):
     32        * platform/graphics/chromium/LayerRendererChromium.h:
     33        (WebCore):
     34        (WebCore::LayerRendererChromium::textureCopier):
     35        (LayerRendererChromium):
     36        * platform/graphics/chromium/ShaderChromium.cpp:
     37        (WebCore::VertexShaderPosTexIdentity::getShaderString):
     38        (WebCore):
     39        (WebCore::FragmentShaderRGBATexCopy::getShaderString):
     40        * platform/graphics/chromium/ShaderChromium.h:
     41        (VertexShaderPosTexIdentity):
     42        (WebCore::VertexShaderPosTexIdentity::init):
     43        (WebCore):
     44        (FragmentShaderRGBATexCopy):
     45        * platform/graphics/chromium/TextureCopier.cpp: Added.
     46        (WebCore):
     47        (WebCore::AcceleratedTextureCopier::AcceleratedTextureCopier):
     48        (WebCore::AcceleratedTextureCopier::~AcceleratedTextureCopier):
     49        (WebCore::AcceleratedTextureCopier::copyTexture):
     50        * platform/graphics/chromium/TextureCopier.h: Added.
     51        (WebCore):
     52        (TextureCopier):
     53        (WebCore::TextureCopier::~TextureCopier):
     54        (AcceleratedTextureCopier):
     55        (WebCore::AcceleratedTextureCopier::create):
     56        * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
     57        (WebCore::CCSingleThreadProxy::doCommit):
     58        * platform/graphics/chromium/cc/CCTextureUpdater.cpp:
     59        (WebCore::CCTextureUpdater::CCTextureUpdater):
     60        * platform/graphics/chromium/cc/CCTextureUpdater.h:
     61        (WebCore):
     62        (CCTextureUpdater):
     63        (WebCore::CCTextureUpdater::copier):
     64        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
     65        (WebCore::CCThreadProxy::beginFrameCompleteOnImplThread):
     66
    1672012-03-27  Levi Weintraub  <leviw@chromium.org>
    268
  • trunk/Source/WebCore/WebCore.gypi

    r112224 r112286  
    35263526            'platform/graphics/chromium/TrackingTextureAllocator.cpp',
    35273527            'platform/graphics/chromium/TrackingTextureAllocator.h',
     3528            'platform/graphics/chromium/TextureCopier.cpp',
     3529            'platform/graphics/chromium/TextureCopier.h',
    35283530            'platform/graphics/chromium/TextureManager.cpp',
    35293531            'platform/graphics/chromium/TextureManager.h',
  • trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp

    r112165 r112286  
    3838#include "GraphicsContext3D.h"
    3939#include "LayerRendererChromium.h" // For the GLC() macro
     40#include "TextureCopier.h"
    4041#include "cc/CCLayerTreeHost.h"
    4142#include "cc/CCTextureLayerImpl.h"
     
    5758    , m_size(size)
    5859    , m_backTextureId(0)
    59     , m_fbo(0)
    6060    , m_useDoubleBuffering(CCProxy::hasImplThread())
    6161    , m_canvas(0)
    6262{
    63     if (m_useDoubleBuffering)
    64         GLC(m_context, m_fbo = m_context->createFramebuffer());
    6563}
    6664
    6765Canvas2DLayerChromium::~Canvas2DLayerChromium()
    6866{
    69     if (m_useDoubleBuffering && m_fbo)
    70        GLC(m_context, m_context->deleteFramebuffer(m_fbo));
    7167    if (m_context && layerTreeHost())
    7268        layerTreeHost()->stopRateLimiter(m_context.get());
     
    139135        return;
    140136
    141     m_frontTexture->bindTexture(context, updater.allocator());
    142 
    143     GLC(context, context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo));
    144     GLC(context, context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_backTextureId, 0));
    145     // FIXME: The copy operation will fail if the m_backTexture is allocated as BGRA since glCopyTex(Sub)Image2D doesn't
    146     //        support the BGRA format. See bug https://bugs.webkit.org/show_bug.cgi?id=75142
    147     GLC(context, context->copyTexSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, 0, 0, m_size.width(), m_size.height()));
    148     GLC(context, context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0));
    149     GLC(context, context->flush());
     137    m_frontTexture->allocate(updater.allocator());
     138    updater.copier()->copyTexture(context, m_backTextureId, m_frontTexture->textureId(), m_size);
    150139}
    151140
  • trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h

    r110945 r112286  
    7373    IntSize m_size;
    7474    unsigned m_backTextureId;
    75     Platform3DObject m_fbo;
    7675    // When m_useDoubleBuffering is true, the compositor will draw using a copy of the
    7776    // canvas' backing texture. This option should be used with the compositor doesn't
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

    r111968 r112286  
    4646#include "RenderSurfaceChromium.h"
    4747#include "TextStream.h"
     48#include "TextureCopier.h"
    4849#include "TextureManager.h"
    4950#include "TraceEvent.h"
     
    12981299                                                           TextureManager::reclaimLimitBytes(viewportSize()),
    12991300                                                           m_capabilities.maxTextureSize);
     1301    m_textureCopier = AcceleratedTextureCopier::create(m_context.get());
    13001302    m_contentsTextureAllocator = TrackingTextureAllocator::create(m_context.get());
    13011303    m_renderSurfaceTextureAllocator = TrackingTextureAllocator::create(m_context.get());
     
    16101612    if (m_offscreenFramebufferId)
    16111613        GLC(m_context.get(), m_context->deleteFramebuffer(m_offscreenFramebufferId));
     1614    m_textureCopier.clear();
    16121615
    16131616    releaseRenderSurfaceTextures();
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h

    r111777 r112286  
    3939#include "IntRect.h"
    4040#include "LayerChromium.h"
     41#include "TextureCopier.h"
    4142#include "TrackingTextureAllocator.h"
    4243#include "VideoLayerChromium.h"
     
    6061class GeometryBinding;
    6162class GraphicsContext3D;
    62 class TrackingTextureAllocator;
    6363class LayerRendererSwapBuffersCompleteCallbackAdapter;
    6464class ScopedEnsureFramebufferAllocation;
     
    143143
    144144    TextureManager* renderSurfaceTextureManager() const { return m_renderSurfaceTextureManager.get(); }
     145    TextureCopier* textureCopier() const { return m_textureCopier.get(); }
    145146    TextureAllocator* renderSurfaceTextureAllocator() const { return m_renderSurfaceTextureAllocator.get(); }
    146147    TextureAllocator* contentsTextureAllocator() const { return m_contentsTextureAllocator.get(); }
     
    250251
    251252    OwnPtr<TextureManager> m_renderSurfaceTextureManager;
     253    OwnPtr<AcceleratedTextureCopier> m_textureCopier;
    252254    OwnPtr<TrackingTextureAllocator> m_contentsTextureAllocator;
    253255    OwnPtr<TrackingTextureAllocator> m_renderSurfaceTextureAllocator;
  • trunk/Source/WebCore/platform/graphics/chromium/ShaderChromium.cpp

    r108675 r112286  
    189189}
    190190
     191String VertexShaderPosTexIdentity::getShaderString() const
     192{
     193    return SHADER(
     194        attribute vec4 a_position;
     195        varying vec2 v_texCoord;
     196        void main()
     197        {
     198            gl_Position = a_position;
     199            v_texCoord = (a_position.xy + vec2(1.0)) * 0.5;
     200        }
     201    );
     202}
     203
    191204void VertexShaderQuad::init(GraphicsContext3D* context, unsigned program)
    192205{
     
    411424}
    412425
     426String FragmentShaderRGBATex::getShaderString() const
     427{
     428    return SHADER(
     429        precision mediump float;
     430        varying vec2 v_texCoord;
     431        uniform sampler2D s_texture;
     432        void main()
     433        {
     434            gl_FragColor = texture2D(s_texture, v_texCoord);
     435        }
     436    );
     437}
     438
    413439String FragmentShaderRGBATexSwizzleAlpha::getShaderString() const
    414440{
  • trunk/Source/WebCore/platform/graphics/chromium/ShaderChromium.h

    r110267 r112286  
    9696};
    9797
     98class VertexShaderPosTexIdentity {
     99public:
     100    void init(GraphicsContext3D*, unsigned program) { }
     101    String getShaderString() const;
     102};
     103
    98104class VertexShaderPosTexTransform {
    99105public:
     
    214220};
    215221
     222class FragmentShaderRGBATex : public FragmentTexOpaqueBinding {
     223public:
     224    String getShaderString() const;
     225};
     226
    216227// Swizzles the red and blue component of sampled texel with alpha.
    217228class FragmentShaderRGBATexSwizzleAlpha : public FragmentTexAlphaBinding {
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp

    r112191 r112286  
    203203
    204204        m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get());
    205         CCTextureUpdater updater(m_layerTreeHostImpl->contentsTextureAllocator());
     205        CCTextureUpdater updater(m_layerTreeHostImpl->contentsTextureAllocator(), m_layerTreeHostImpl->layerRenderer()->textureCopier());
    206206        m_layerTreeHost->updateCompositorResources(m_layerTreeHostImpl->context(), updater);
    207207        updater.update(m_layerTreeHostImpl->context(), numeric_limits<size_t>::max());
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp

    r107177 r112286  
    3838namespace WebCore {
    3939
    40 CCTextureUpdater::CCTextureUpdater(TextureAllocator* allocator)
     40CCTextureUpdater::CCTextureUpdater(TextureAllocator* allocator, TextureCopier* copier)
    4141    : m_allocator(allocator)
     42    , m_copier(copier)
    4243    , m_entryIndex(0)
    4344{
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h

    r107177 r112286  
    3535class GraphicsContext3D;
    3636class TextureAllocator;
     37class TextureCopier;
    3738
    3839class CCTextureUpdater {
    3940public:
    40     CCTextureUpdater(TextureAllocator*);
     41    CCTextureUpdater(TextureAllocator*, TextureCopier*);
    4142    ~CCTextureUpdater();
    4243
     
    5253
    5354    TextureAllocator* allocator() { return m_allocator; }
     55    TextureCopier* copier() { return m_copier; }
    5456
    5557private:
     
    6365
    6466    TextureAllocator* m_allocator;
     67    TextureCopier* m_copier;
    6568    size_t m_entryIndex;
    6669    Vector<UpdateEntry> m_entries;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp

    r112191 r112286  
    2828
    2929#include "GraphicsContext3D.h"
     30#include "LayerRendererChromium.h"
    3031#include "SharedGraphicsContext3D.h"
    3132#include "TraceEvent.h"
     
    504505
    505506    ASSERT(!m_currentTextureUpdaterOnImplThread);
    506     m_currentTextureUpdaterOnImplThread = adoptPtr(new CCTextureUpdater(m_layerTreeHostImpl->contentsTextureAllocator()));
     507    m_currentTextureUpdaterOnImplThread = adoptPtr(new CCTextureUpdater(m_layerTreeHostImpl->contentsTextureAllocator(), m_layerTreeHostImpl->layerRenderer()->textureCopier()));
    507508    m_layerTreeHost->updateCompositorResources(m_layerTreeHostImpl->context(), *m_currentTextureUpdaterOnImplThread);
    508509
  • trunk/Source/WebKit/chromium/ChangeLog

    r112278 r112286  
     12012-03-27  Sami Kyostila  <skyostil@chromium.org>
     2
     3        [chromium] Add TextureCopier for copying texture contents
     4        https://bugs.webkit.org/show_bug.cgi?id=80870
     5
     6        Reviewed by Stephen White.
     7
     8        Add new test for TextureCopier.
     9
     10        * WebKit.gypi:
     11        * tests/Canvas2DLayerChromiumTest.cpp:
     12        * tests/TextureCopierTest.cpp: Added.
     13        * tests/TiledLayerChromiumTest.cpp:
     14        (FakeTextureCopier):
     15        (WTF::FakeTextureCopier::copyTexture):
     16        (WTF):
     17        (WTF::TEST):
     18
    1192012-03-27  Stephen White  <senorblanco@chromium.org>
    220
  • trunk/Source/WebKit/chromium/WebKit.gypi

    r111777 r112286  
    120120            'tests/RenderTableCellTest.cpp',
    121121            'tests/ScrollbarLayerChromiumTest.cpp',
     122            'tests/TextureCopierTest.cpp',
    122123            'tests/TextureManagerTest.cpp',
    123124            'tests/TiledLayerChromiumTest.cpp',
  • trunk/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp

    r111112 r112286  
    3232#include "GraphicsContext3DPrivate.h"
    3333#include "Region.h"
     34#include "TextureCopier.h"
    3435#include "TextureManager.h"
    3536#include "WebCompositor.h"
     
    9394};
    9495
     96class MockTextureCopier : public TextureCopier {
     97public:
     98    MOCK_METHOD4(copyTexture, void(GraphicsContext3D*, unsigned, unsigned, const IntSize&));
     99};
     100
    95101class Canvas2DLayerChromiumTest : public Test {
    96102protected:
     
    102108        RefPtr<GraphicsContext3D> implContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
    103109
    104         MockCanvasContext& mainMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(mainContext.get()));
    105         MockCanvasContext& implMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(implContext.get()));
    106 
    107110        MockTextureAllocator allocatorMock;
    108         CCTextureUpdater updater(&allocatorMock);
     111        MockTextureCopier copierMock;
     112        CCTextureUpdater updater(&allocatorMock, &copierMock);
    109113
    110114        const IntSize size(300, 150);
     
    121125        const WebGLId backTextureId = 1;
    122126        const WebGLId frontTextureId = 2;
    123         const WebGLId fboId = 3;
    124127        {
    125128            InSequence sequence;
     
    128131            // compositor.
    129132            if (threaded) {
    130                 // Setup Canvas2DLayerChromium (on the main thread).
    131                 EXPECT_CALL(mainMock, createFramebuffer())
    132                     .WillOnce(Return(fboId));
    133 
    134133                // Create texture and do the copy (on the impl thread).
    135134                EXPECT_CALL(allocatorMock, createTexture(size, GraphicsContext3D::RGBA))
    136135                    .WillOnce(Return(frontTextureId));
    137                 EXPECT_CALL(implMock, bindTexture(GraphicsContext3D::TEXTURE_2D, frontTextureId));
    138                 EXPECT_CALL(implMock, bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, fboId));
    139                 EXPECT_CALL(implMock, framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, backTextureId, 0));
    140                 EXPECT_CALL(implMock, copyTexSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, 0, 0, 300, 150));
    141                 EXPECT_CALL(implMock, bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0));
    142 
    143                 // Teardown Canvas2DLayerChromium.
    144                 EXPECT_CALL(mainMock, deleteFramebuffer(fboId));
     136                EXPECT_CALL(copierMock, copyTexture(implContext.get(), backTextureId, frontTextureId, size));
    145137
    146138                // Teardown TextureManager.
  • trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp

    r112049 r112286  
    3232#include "LayerTextureUpdater.h"
    3333#include "Region.h"
     34#include "TextureCopier.h"
    3435#include "TextureManager.h"
    3536#include "WebCompositor.h"
     
    7475    virtual unsigned createTexture(const IntSize&, GC3Denum) { return 1; }
    7576    virtual void deleteTexture(unsigned, const IntSize&, GC3Denum) { }
     77};
     78
     79class FakeTextureCopier : public TextureCopier {
     80public:
     81    virtual void copyTexture(GraphicsContext3D*, unsigned, unsigned, const IntSize&) { }
    7682};
    7783
     
    244250}
    245251
     252class FakeCCTextureUpdater : public CCTextureUpdater {
     253public:
     254    explicit FakeCCTextureUpdater()
     255        : CCTextureUpdater(&m_textureAllocator, &m_textureCopier)
     256    {
     257    }
     258
     259    FakeTextureAllocator& textureAllocator()
     260    {
     261        return m_textureAllocator;
     262    }
     263
     264protected:
     265    FakeTextureAllocator m_textureAllocator;
     266    FakeTextureCopier m_textureCopier;
     267};
     268
    246269TEST(TiledLayerChromiumTest, pushDirtyTiles)
    247270{
     
    251274    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
    252275
    253     FakeTextureAllocator textureAllocator;
    254     CCTextureUpdater updater(&textureAllocator);
     276    FakeCCTextureUpdater updater;
    255277
    256278    // The tile size is 100x100, so this invalidates and then paints two tiles.
     
    287309    TestCCOcclusionTracker occluded;
    288310
    289     FakeTextureAllocator textureAllocator;
    290     CCTextureUpdater updater(&textureAllocator);
     311    FakeCCTextureUpdater updater;
    291312
    292313    // The tile size is 100x100, so this invalidates and then paints two tiles.
     
    333354    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
    334355
    335     FakeTextureAllocator textureAllocator;
    336     CCTextureUpdater updater(&textureAllocator);
     356    FakeCCTextureUpdater updater;
    337357
    338358    // The tile size is 100x100, so this invalidates and then paints two tiles.
     
    347367    EXPECT_TRUE(layerImpl->hasTileAt(0, 1));
    348368
    349     textureManager->evictAndDeleteAllTextures(&textureAllocator);
     369    textureManager->evictAndDeleteAllTextures(&updater.textureAllocator());
    350370    textureManager->setMaxMemoryLimitBytes(4*1024*1024);
    351371    textureManager->setPreferredMemoryLimitBytes(4*1024*1024);
     
    375395    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
    376396
    377     FakeTextureAllocator textureAllocator;
    378     CCTextureUpdater updater(&textureAllocator);
     397    FakeCCTextureUpdater updater;
    379398
    380399    // The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center.
     
    434453    OwnPtr<FakeCCTiledLayerImpl> layerImpl2(adoptPtr(new FakeCCTiledLayerImpl(0)));
    435454
    436     FakeTextureAllocator textureAllocator;
    437     CCTextureUpdater updater(&textureAllocator);
     455    FakeCCTextureUpdater updater;
    438456
    439457    // For this test we have two layers. layer1 exhausts most texture memory, leaving room for 2 more tiles from
     
    515533    TestCCOcclusionTracker occluded;
    516534
    517     FakeTextureAllocator textureAllocator;
    518     CCTextureUpdater updater(&textureAllocator);
     535    FakeCCTextureUpdater updater;
    519536
    520537    // The tile size is 100x100, so this invalidates one occluded tile, culls it during paint, but prepaints it.
     
    541558    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
    542559
    543     FakeTextureAllocator textureAllocator;
    544     CCTextureUpdater updater(&textureAllocator);
     560    FakeCCTextureUpdater updater;
    545561
    546562    // The tile size is 100x100, so this invalidates and then paints two tiles.
     
    568584    OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(0)));
    569585
    570     FakeTextureAllocator textureAllocator;
    571     CCTextureUpdater updater(&textureAllocator);
     586    FakeCCTextureUpdater updater;
    572587
    573588    layer1->setBounds(IntSize(100, 200));
     
    604619    OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(0)));
    605620
    606     FakeTextureAllocator textureAllocator;
    607     CCTextureUpdater updater(&textureAllocator);
     621    FakeCCTextureUpdater updater;
    608622
    609623    layer1->setBounds(IntSize(100, 200));
     
    646660    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
    647661
    648     FakeTextureAllocator textureAllocator;
    649     CCTextureUpdater updater(&textureAllocator);
     662    FakeCCTextureUpdater updater;
    650663
    651664    // This invalidates 9 tiles and then paints one visible tile.
     
    682695    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
    683696
    684     FakeTextureAllocator textureAllocator;
    685     CCTextureUpdater updater(&textureAllocator);
     697    FakeCCTextureUpdater updater;
    686698
    687699    // The layer's bounds are empty.
     
    725737    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
    726738
    727     FakeTextureAllocator textureAllocator;
    728     CCTextureUpdater updater(&textureAllocator);
     739    FakeCCTextureUpdater updater;
    729740
    730741    // Pretend the layer is animating.
     
    774785    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
    775786
    776     FakeTextureAllocator textureAllocator;
    777     CCTextureUpdater updater(&textureAllocator);
     787    FakeCCTextureUpdater updater;
    778788
    779789    // Invalidate the layer but make none of it visible, so nothing paints.
     
    829839    DebugScopedSetImplThread implThread;
    830840
    831     FakeTextureAllocator textureAllocator;
    832     CCTextureUpdater updater(&textureAllocator);
     841    FakeCCTextureUpdater updater;
    833842
    834843    int tileWidth = FakeTiledLayerChromium::tileSize().width();
     
    887896    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
    888897
    889     FakeTextureAllocator textureAllocator;
    890     CCTextureUpdater updater(&textureAllocator);
     898    FakeCCTextureUpdater updater;
    891899
    892900    // The tile size is 100x100, so this invalidates and then paints two tiles.
     
    929937    RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(textureManager.get()));
    930938
    931     FakeTextureAllocator textureAllocator;
    932     CCTextureUpdater updater(&textureAllocator);
     939    FakeCCTextureUpdater updater;
    933940
    934941    IntRect layerBounds(0, 0, 300, 200);
     
    967974    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
    968975
    969     FakeTextureAllocator textureAllocator;
    970     CCTextureUpdater updater(&textureAllocator);
     976    FakeCCTextureUpdater updater;
    971977
    972978    // Create a layer with one tile.
     
    10381044    childLayer->invalidateRect(contentRect);
    10391045
    1040     FakeTextureAllocator textureAllocator;
    1041     CCTextureUpdater updater(&textureAllocator);
     1046    FakeCCTextureUpdater updater;
    10421047
    10431048    ccLayerTreeHost->setRootLayer(rootLayer);
     
    10971102    layer->invalidateRect(contentRect);
    10981103
    1099     FakeTextureAllocator textureAllocator;
    1100     CCTextureUpdater updater(&textureAllocator);
     1104    FakeCCTextureUpdater updater;
    11011105
    11021106    ccLayerTreeHost->setRootLayer(layer);
Note: See TracChangeset for help on using the changeset viewer.