Changeset 126340 in webkit


Ignore:
Timestamp:
Aug 22, 2012 12:50:01 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[chromium] Simplify updateContentRect, removing rect parameter, refactor unit tests.
https://bugs.webkit.org/show_bug.cgi?id=94165

Patch by Eric Penner <epenner@google.com> on 2012-08-22
Reviewed by Adrienne Walker.

Source/WebCore:

Remove visible rect parameter from TiledLayerChromium functions. Passing a
rect that is not the visible rect wouldn't make sense, and soon we might
need further visibility information.

In refactoring the unit tests, I removed texture manager from all tests
and put it in the test class. I also made some utility functions to
simulate the commit flow and remove tons of boilerplate code. I refactored
about half the unit tests to use the utility functions.

Refactored tests.

  • platform/graphics/chromium/ContentLayerChromium.cpp:

(WebCore::ContentLayerChromium::update):
(WebCore::ContentLayerChromium::needMoreUpdates):

  • platform/graphics/chromium/ImageLayerChromium.cpp:

(WebCore::ImageLayerChromium::update):

  • platform/graphics/chromium/TiledLayerChromium.cpp:

(WebCore):
(WebCore::TiledLayerChromium::setTexturePriorities):
(WebCore::TiledLayerChromium::resetUpdateState):
(WebCore::TiledLayerChromium::update):
(WebCore::TiledLayerChromium::needsIdlePaint):
(WebCore::TiledLayerChromium::idlePaintRect):

  • platform/graphics/chromium/TiledLayerChromium.h:

(TiledLayerChromium):

Source/WebKit/chromium:

Refactored tests to remove lots of boilerplate code.

  • tests/CCTiledLayerTestCommon.cpp:
  • tests/CCTiledLayerTestCommon.h:

(FakeTiledLayerChromium):

  • tests/TiledLayerChromiumTest.cpp:
Location:
trunk/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r126336 r126340  
     12012-08-22  Eric Penner  <epenner@google.com>
     2
     3        [chromium] Simplify updateContentRect, removing rect parameter, refactor unit tests.
     4        https://bugs.webkit.org/show_bug.cgi?id=94165
     5
     6        Reviewed by Adrienne Walker.
     7
     8        Remove visible rect parameter from TiledLayerChromium functions. Passing a
     9        rect that is not the visible rect wouldn't make sense, and soon we might
     10        need further visibility information.
     11
     12        In refactoring the unit tests, I removed texture manager from all tests
     13        and put it in the test class. I also made some utility functions to
     14        simulate the commit flow and remove tons of boilerplate code. I refactored
     15        about half the unit tests to use the utility functions.
     16
     17        Refactored tests.
     18
     19        * platform/graphics/chromium/ContentLayerChromium.cpp:
     20        (WebCore::ContentLayerChromium::update):
     21        (WebCore::ContentLayerChromium::needMoreUpdates):
     22        * platform/graphics/chromium/ImageLayerChromium.cpp:
     23        (WebCore::ImageLayerChromium::update):
     24        * platform/graphics/chromium/TiledLayerChromium.cpp:
     25        (WebCore):
     26        (WebCore::TiledLayerChromium::setTexturePriorities):
     27        (WebCore::TiledLayerChromium::resetUpdateState):
     28        (WebCore::TiledLayerChromium::update):
     29        (WebCore::TiledLayerChromium::needsIdlePaint):
     30        (WebCore::TiledLayerChromium::idlePaintRect):
     31        * platform/graphics/chromium/TiledLayerChromium.h:
     32        (TiledLayerChromium):
     33
    1342012-08-22  Otto Derek Cheung  <otcheung@rim.com>
    235
  • trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp

    r125932 r126340  
    9797{
    9898    createTextureUpdaterIfNeeded();
    99 
    100     IntRect contentRect;
    101 
    102     // Always call updateContentRect() but with an empty layer rectangle when
    103     // layer doesn't draw contents.
    104     if (drawsContent())
    105         contentRect = visibleContentRect();
    106 
    107     updateContentRect(queue, contentRect, occlusion, stats);
     99    TiledLayerChromium::update(queue, occlusion, stats);
    108100    m_needsDisplay = false;
    109101}
     
    111103bool ContentLayerChromium::needMoreUpdates()
    112104{
    113     if (!drawsContent())
    114         return false;
    115     return needsIdlePaint(visibleContentRect());
     105    return needsIdlePaint();
    116106}
    117107
  • trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp

    r125932 r126340  
    149149        m_needsDisplay = false;
    150150    }
    151 
    152     updateContentRect(queue, visibleContentRect(), occlusion, stats);
     151    TiledLayerChromium::update(queue, occlusion, stats);
    153152}
    154153
  • trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp

    r125932 r126340  
    554554}
    555555
    556 void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priorityCalc)
    557 {
    558     setTexturePrioritiesInRect(priorityCalc, visibleContentRect());
    559 }
    560 
    561556namespace {
    562557// This picks a small animated layer to be anything less than one viewport. This
     
    593588}
    594589
    595 void TiledLayerChromium::setTexturePrioritiesInRect(const CCPriorityCalculator& priorityCalc, const IntRect& visibleContentRect)
     590void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priorityCalc)
    596591{
    597592    updateBounds();
     
    605600
    606601    // Minimally create the tiles in the desired pre-paint rect.
    607     IntRect createTilesRect = idlePaintRect(visibleContentRect);
     602    IntRect createTilesRect = idlePaintRect();
    608603    if (!createTilesRect.isEmpty()) {
    609604        int left, top, right, bottom;
     
    619614    // Also, minimally create all tiles for small animated layers and also
    620615    // double-buffer them since we have limited their size to be reasonable.
    621     IntRect doubleBufferedRect = visibleContentRect;
     616    IntRect doubleBufferedRect = visibleContentRect();
    622617    if (smallAnimatedLayer)
    623618        doubleBufferedRect = IntRect(IntPoint::zero(), contentBounds());
     
    648643                tile->dirtyRect = tileRect;
    649644                LayerTextureUpdater::Texture* backBuffer = tile->texture();
    650                 setPriorityForTexture(priorityCalc, visibleContentRect, tile->dirtyRect, drawsToRoot, smallAnimatedLayer, backBuffer->texture());
     645                setPriorityForTexture(priorityCalc, visibleContentRect(), tile->dirtyRect, drawsToRoot, smallAnimatedLayer, backBuffer->texture());
    651646                OwnPtr<CCPrioritizedTexture> frontBuffer = CCPrioritizedTexture::create(backBuffer->texture()->textureManager(),
    652647                                                                                        backBuffer->texture()->size(),
     
    666661            continue;
    667662        IntRect tileRect = m_tiler->tileRect(tile);
    668         setPriorityForTexture(priorityCalc, visibleContentRect, tileRect, drawsToRoot, smallAnimatedLayer, tile->managedTexture());
     663        setPriorityForTexture(priorityCalc, visibleContentRect(), tileRect, drawsToRoot, smallAnimatedLayer, tile->managedTexture());
    669664    }
    670665}
     
    681676void TiledLayerChromium::resetUpdateState()
    682677{
     678    m_skipsDraw = false;
     679    m_failedUpdate = false;
     680
    683681    CCLayerTilingData::TileMap::const_iterator end = m_tiler->tiles().end();
    684682    for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != end; ++iter) {
     
    691689}
    692690
    693 void TiledLayerChromium::updateContentRect(CCTextureUpdateQueue& queue, const IntRect& contentRect, const CCOcclusionTracker* occlusion, CCRenderingStats& stats)
    694 {
    695     m_skipsDraw = false;
    696     m_failedUpdate = false;
     691void TiledLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTracker* occlusion, CCRenderingStats& stats)
     692{
     693    ASSERT(!m_skipsDraw && !m_failedUpdate); // Did resetUpdateState get skipped?
    697694    updateBounds();
    698 
    699     if (m_tiler->hasEmptyBounds())
     695    if (m_tiler->hasEmptyBounds() || !drawsContent())
    700696        return;
    701697
     
    716712    }
    717713
    718     if (contentRect.isEmpty())
     714    if (visibleContentRect().isEmpty())
    719715        return;
    720716
    721717    // Visible painting. First occlude visible tiles and paint the non-occluded tiles.
    722718    int left, top, right, bottom;
    723     m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom);
     719    m_tiler->contentRectToTileIndices(visibleContentRect(), left, top, right, bottom);
    724720    markOcclusionsAndRequestTextures(left, top, right, bottom, occlusion);
    725721    m_skipsDraw = !updateTiles(left, top, right, bottom, queue, occlusion, stats, didPaint);
     
    730726
    731727    // If we have already painting everything visible. Do some pre-painting while idle.
    732     IntRect idlePaintContentRect = idlePaintRect(contentRect);
     728    IntRect idlePaintContentRect = idlePaintRect();
    733729    if (idlePaintContentRect.isEmpty())
    734730        return;
     
    766762}
    767763
    768 bool TiledLayerChromium::needsIdlePaint(const IntRect& visibleContentRect)
     764bool TiledLayerChromium::needsIdlePaint()
    769765{
    770766    // Don't trigger more paints if we failed (as we'll just fail again).
    771     if (m_failedUpdate || visibleContentRect.isEmpty() || m_tiler->hasEmptyBounds())
     767    if (m_failedUpdate || visibleContentRect().isEmpty() || m_tiler->hasEmptyBounds() || !drawsContent())
    772768        return false;
    773769
    774     IntRect idlePaintContentRect = idlePaintRect(visibleContentRect);
     770    IntRect idlePaintContentRect = idlePaintRect();
    775771    if (idlePaintContentRect.isEmpty())
    776772        return false;
     
    796792}
    797793
    798 IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleContentRect)
     794IntRect TiledLayerChromium::idlePaintRect()
    799795{
    800796    // Don't inflate an empty rect.
    801     if (visibleContentRect.isEmpty())
    802         return visibleContentRect;
     797    if (visibleContentRect().isEmpty())
     798        return IntRect();
    803799
    804800    // FIXME: This can be made a lot larger now! We should increase
    805801    //        this slowly while insuring it doesn't cause any perf issues.
    806     IntRect prepaintRect = visibleContentRect;
     802    IntRect prepaintRect = visibleContentRect();
    807803    prepaintRect.inflateX(m_tiler->tileSize().width());
    808804    prepaintRect.inflateY(m_tiler->tileSize().height() * 2);
  • trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h

    r125932 r126340  
    6161    virtual Region visibleContentOpaqueRegion() const OVERRIDE;
    6262
     63    virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE;
     64
    6365protected:
    6466    TiledLayerChromium();
     
    8385    void resetUpdateState();
    8486
    85     // Prepare data needed to update textures that intersect with contentRect.
    86     void updateContentRect(CCTextureUpdateQueue&, const IntRect& contentRect, const CCOcclusionTracker*, CCRenderingStats&);
    87 
    8887    // After preparing an update, returns true if more painting is needed.
    89     bool needsIdlePaint(const IntRect& visibleContentRect);
    90 
    91     IntRect idlePaintRect(const IntRect& visibleContentRect);
     88    bool needsIdlePaint();
     89    IntRect idlePaintRect();
    9290
    9391    bool skipsDraw() const { return m_skipsDraw; }
     
    104102    bool tileOnlyNeedsPartialUpdate(UpdatableTile*);
    105103    bool tileNeedsBufferedUpdate(UpdatableTile*);
    106 
    107     void setTexturePrioritiesInRect(const CCPriorityCalculator&, const IntRect& visibleContentRect);
    108104
    109105    void markOcclusionsAndRequestTextures(int left, int top, int right, int bottom, const CCOcclusionTracker*);
  • trunk/Source/WebKit/chromium/ChangeLog

    r126327 r126340  
     12012-08-22  Eric Penner  <epenner@google.com>
     2
     3        [chromium] Simplify updateContentRect, removing rect parameter, refactor unit tests.
     4        https://bugs.webkit.org/show_bug.cgi?id=94165
     5
     6        Reviewed by Adrienne Walker.
     7
     8        Refactored tests to remove lots of boilerplate code.
     9
     10        * tests/CCTiledLayerTestCommon.cpp:
     11        * tests/CCTiledLayerTestCommon.h:
     12        (FakeTiledLayerChromium):
     13        * tests/TiledLayerChromiumTest.cpp:
     14
    1152012-08-22  Iain Merrick  <husky@chromium.org>
    216
  • trunk/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp

    r125827 r126340  
    116116}
    117117
    118 void FakeTiledLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTracker* occlusion, CCRenderingStats& stats)
    119 {
    120     updateContentRect(queue, visibleContentRect(), occlusion, stats);
    121 }
    122 
    123118void FakeTiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& calculator)
    124119{
  • trunk/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h

    r125932 r126340  
    113113
    114114    using WebCore::TiledLayerChromium::invalidateContentRect;
    115     using WebCore::TiledLayerChromium::updateContentRect;
    116115    using WebCore::TiledLayerChromium::needsIdlePaint;
    117116    using WebCore::TiledLayerChromium::skipsDraw;
     
    121120    virtual void setNeedsDisplayRect(const WebCore::FloatRect&) OVERRIDE;
    122121    const WebCore::FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; }
    123 
    124     // Updates the visibleContentRect().
    125     virtual void update(WebCore::CCTextureUpdateQueue&, const WebCore::CCOcclusionTracker*, WebCore::CCRenderingStats&) OVERRIDE;
    126122
    127123    virtual void setTexturePriorities(const WebCore::CCPriorityCalculator&) OVERRIDE;
  • trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp

    r125932 r126340  
    7878    TiledLayerChromiumTest()
    7979        : m_context(WebKit::createFakeCCGraphicsContext())
     80        , m_textureManager(CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool))
     81        , m_occlusion(0)
    8082    {
    8183        DebugScopedSetImplThread implThread;
     
    9395        CCTextureUpdateController::updateTextures(m_resourceProvider.get(), &m_copier, &m_uploader, &m_queue, count);
    9496    }
     97
     98    bool updateAndPush(FakeTiledLayerChromium* layer1,
     99                       CCLayerImpl* layerImpl1,
     100                       FakeTiledLayerChromium* layer2 = 0,
     101                       CCLayerImpl* layerImpl2 = 0)
     102    {
     103        // Get textures
     104        m_textureManager->clearPriorities();
     105        if (layer1)
     106            layer1->setTexturePriorities(m_priorityCalculator);
     107        if (layer2)
     108            layer2->setTexturePriorities(m_priorityCalculator);     
     109        m_textureManager->prioritizeTextures();
     110
     111        // Update content
     112        if (layer1)
     113            layer1->update(m_queue, m_occlusion, m_stats);
     114        if (layer2)
     115            layer2->update(m_queue, m_occlusion, m_stats);
     116
     117        bool needsUpdate = false;
     118        if (layer1)
     119            needsUpdate |= layer1->needsIdlePaint();
     120        if (layer2)
     121            needsUpdate |= layer2->needsIdlePaint();
     122
     123        // Update textures and push.
     124        updateTextures();
     125        if (layer1)
     126            layer1->pushPropertiesTo(layerImpl1);
     127        if (layer2)
     128            layer2->pushPropertiesTo(layerImpl2);
     129
     130        return needsUpdate;
     131    }
     132
    95133public:
    96134    OwnPtr<CCGraphicsContext> m_context;
     
    101139    FakeTextureUploader m_uploader;
    102140    CCPriorityCalculator m_priorityCalculator;
     141    OwnPtr<CCPrioritizedTextureManager> m_textureManager;
     142    TestCCOcclusionTracker* m_occlusion;
    103143};
    104144
    105 
    106 
    107145TEST_F(TiledLayerChromiumTest, pushDirtyTiles)
    108146{
    109     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    110     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     147    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    111148    DebugScopedSetImplThread implThread;
    112149    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
     
    116153    layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
    117154    layer->invalidateContentRect(IntRect(0, 0, 100, 200));
    118 
    119     layer->setTexturePriorities(m_priorityCalculator);
    120     textureManager->prioritizeTextures();
    121 
    122     layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats);
    123     updateTextures();
    124     layer->pushPropertiesTo(layerImpl.get());
     155    updateAndPush(layer.get(), layerImpl.get());
    125156
    126157    // We should have both tiles on the impl side.
     
    128159    EXPECT_TRUE(layerImpl->hasTileAt(0, 1));
    129160
    130     // Invalidates both tiles...
     161    // Invalidates both tiles, but then only update one of them.
     162    layer->setBounds(IntSize(100, 200));
     163    layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
    131164    layer->invalidateContentRect(IntRect(0, 0, 100, 200));
    132     // ....but then only update one of them.
    133     layer->setTexturePriorities(m_priorityCalculator);
    134     textureManager->prioritizeTextures();
    135     layer->updateContentRect(m_queue, IntRect(0, 0, 100, 100), 0, m_stats);
    136     layer->pushPropertiesTo(layerImpl.get());
     165    updateAndPush(layer.get(), layerImpl.get());
    137166
    138167    // We should only have the first tile since the other tile was invalidated but not painted.
     
    143172TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles)
    144173{
    145     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    146     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     174    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    147175    DebugScopedSetImplThread implThread;
    148176    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
    149177    TestCCOcclusionTracker occluded;
     178    m_occlusion = &occluded;
    150179
    151180    // The tile size is 100x100, so this invalidates and then paints two tiles.
    152181    layer->setBounds(IntSize(100, 200));
    153     layer->setDrawableContentRect(IntRect(0, 0, 100, 200));
    154182    layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
    155183    layer->invalidateContentRect(IntRect(0, 0, 100, 200));
    156 
    157     layer->setTexturePriorities(m_priorityCalculator);
    158     textureManager->prioritizeTextures();
    159 
    160     layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), &occluded, m_stats);
    161     updateTextures();
    162     layer->pushPropertiesTo(layerImpl.get());
     184    updateAndPush(layer.get(), layerImpl.get());
    163185
    164186    EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
     
    174196    // ....but the area is occluded.
    175197    occluded.setOcclusion(IntRect(0, 0, 50, 50));
    176     layer->updateContentRect(m_queue, IntRect(0, 0, 100, 100), &occluded, m_stats);
    177     updateTextures();
    178     layer->pushPropertiesTo(layerImpl.get());
     198    updateAndPush(layer.get(), layerImpl.get());
    179199
    180200    EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
     
    189209TEST_F(TiledLayerChromiumTest, pushDeletedTiles)
    190210{
    191     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    192     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     211    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    193212    DebugScopedSetImplThread implThread;
    194213    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
     
    198217    layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
    199218    layer->invalidateContentRect(IntRect(0, 0, 100, 200));
    200 
    201     layer->setTexturePriorities(m_priorityCalculator);
    202     textureManager->prioritizeTextures();
    203 
    204     layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats);
    205     updateTextures();
    206     layer->pushPropertiesTo(layerImpl.get());
     219    updateAndPush(layer.get(), layerImpl.get());
    207220
    208221    // We should have both tiles on the impl side.
     
    210223    EXPECT_TRUE(layerImpl->hasTileAt(0, 1));
    211224
    212     textureManager->clearPriorities();
    213     textureManager->clearAllMemory(m_resourceProvider.get());
    214     textureManager->setMaxMemoryLimitBytes(4*1024*1024);
     225    m_textureManager->clearPriorities();
     226    m_textureManager->clearAllMemory(m_resourceProvider.get());
     227    m_textureManager->setMaxMemoryLimitBytes(4*1024*1024);
    215228
    216229    // This should drop the tiles on the impl thread.
     
    221234    EXPECT_FALSE(layerImpl->hasTileAt(0, 1));
    222235
    223     // This should recreate and update the deleted textures.
    224     layer->setTexturePriorities(m_priorityCalculator);
    225     textureManager->prioritizeTextures();
    226     layer->updateContentRect(m_queue, IntRect(0, 0, 100, 100), 0, m_stats);
    227     updateTextures();
    228     layer->pushPropertiesTo(layerImpl.get());
    229 
    230     // We should only have the first tile since the other tile was invalidated but not painted.
     236    // This should recreate and update one of the deleted textures.
     237    layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
     238    updateAndPush(layer.get(), layerImpl.get());
     239
     240    // We should have one tiles on the impl side.
    231241    EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
    232242    EXPECT_FALSE(layerImpl->hasTileAt(0, 1));
     
    235245TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles)
    236246{
    237     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    238     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     247    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    239248    DebugScopedSetImplThread implThread;
    240249    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
    241250
    242251    // The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center.
    243     IntSize contentBounds(500, 500);
    244     IntRect contentRect(IntPoint::zero(), contentBounds);
    245     IntRect visibleRect(200, 200, 100, 100);
    246 
    247     // This invalidates 25 tiles and then paints one visible tile.
    248     layer->setBounds(contentBounds);
    249     layer->setVisibleContentRect(visibleRect);
    250     layer->invalidateContentRect(contentRect);
    251 
    252     layer->setTexturePriorities(m_priorityCalculator);
    253     textureManager->prioritizeTextures();
    254 
    255     layer->updateContentRect(m_queue, visibleRect, 0, m_stats);
    256     updateTextures();
    257 
    258     // We should need idle-painting for 3x3 tiles in the center.
    259     EXPECT_TRUE(layer->needsIdlePaint(visibleRect));
    260 
    261     layer->pushPropertiesTo(layerImpl.get());
     252    // This paints 1 visible of the 25 invalid tiles.
     253    layer->setBounds(IntSize(500, 500));
     254    layer->setVisibleContentRect(IntRect(200, 200, 100, 100));
     255    layer->invalidateContentRect(IntRect(0, 0, 500, 500));
     256    bool needsUpdate = updateAndPush(layer.get(), layerImpl.get());
     257    // We should need idle-painting for surrounding tiles.
     258    EXPECT_TRUE(needsUpdate);
    262259
    263260    // We should have one tile on the impl side.
     
    266263    // For the next four updates, we should detect we still need idle painting.
    267264    for (int i = 0; i < 4; i++) {
    268         layer->setTexturePriorities(m_priorityCalculator);
    269         textureManager->prioritizeTextures();
    270 
    271         layer->updateContentRect(m_queue, visibleRect, 0, m_stats);
    272         EXPECT_TRUE(layer->needsIdlePaint(visibleRect));
    273         updateTextures();
    274         layer->pushPropertiesTo(layerImpl.get());
    275     }
    276 
    277     // After four passes of idle painting, we should be finished painting
    278     // EXPECT_FALSE(layer->needsIdlePaint(visibleRect));
     265        needsUpdate = updateAndPush(layer.get(), layerImpl.get());
     266        EXPECT_TRUE(needsUpdate);
     267    }
    279268
    280269    // We should have one tile surrounding the visible tile on all sides, but no other tiles.
    281270    IntRect idlePaintTiles(1, 1, 3, 3);
    282271    for (int i = 0; i < 5; i++) {
    283         for (int j = 0; j < 5; j++) {
    284             if (idlePaintTiles.contains(i, j))
    285                 EXPECT_TRUE(layerImpl->hasTileAt(i, j));
    286             else
    287                 EXPECT_FALSE(layerImpl->hasTileAt(i, j));
    288         }
    289     }
     272        for (int j = 0; j < 5; j++)
     273            EXPECT_EQ(layerImpl->hasTileAt(i, j), idlePaintTiles.contains(i, j));
     274    }
     275
     276    // We should always finish painting eventually.
     277    for (int i = 0; i < 20; i++)
     278        needsUpdate = updateAndPush(layer.get(), layerImpl.get());
     279    EXPECT_FALSE(needsUpdate);
    290280}
    291281
     
    293283{
    294284    // Start with 2mb of memory, but the test is going to try to use just more than 1mb, so we reduce to 1mb later.
    295     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(2*1024*1024, 1024, CCRenderer::ContentPool);
    296     DebugScopedSetImplThread implThread;
    297     RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     285    m_textureManager->setMaxMemoryLimitBytes(2 * 1024 * 1024);   
     286    DebugScopedSetImplThread implThread;
     287    RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    298288    OwnPtr<FakeCCTiledLayerImpl> layerImpl1(adoptPtr(new FakeCCTiledLayerImpl(1)));
    299     RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     289    RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    300290    OwnPtr<FakeCCTiledLayerImpl> layerImpl2(adoptPtr(new FakeCCTiledLayerImpl(2)));
    301291
     
    304294    // layer2, we will fail on the third tile of layer2, and this should not leave the second tile in a bad state.
    305295
     296    // This uses 960000 bytes, leaving 88576 bytes of memory left, which is enough for 2 tiles only in the other layer.
     297    IntRect layer1Rect(0, 0, 100, 2400);
     298   
    306299    // This requires 4*30000 bytes of memory.
    307300    IntRect layer2Rect(0, 0, 100, 300);
     301
     302    // Paint a single tile in layer2 so that it will idle paint.
     303    layer1->setBounds(layer1Rect.size());
     304    layer1->setVisibleContentRect(layer1Rect);
    308305    layer2->setBounds(layer2Rect.size());
    309     layer2->setVisibleContentRect(layer2Rect);
    310     layer2->invalidateContentRect(layer2Rect);
    311 
    312     // This uses 960000 bytes, leaving 88576 bytes of memory left, which is enough for 2 tiles only in the other layer.
    313     IntRect layerRect(IntPoint::zero(), IntSize(100, 2400));
    314     layer1->setBounds(layerRect.size());
    315     layer1->setVisibleContentRect(layerRect);
    316     layer1->invalidateContentRect(layerRect);
    317 
    318     // Paint a single tile in layer2 so that it will idle paint.
    319     layer2->setTexturePriorities(m_priorityCalculator);
    320     layer1->setTexturePriorities(m_priorityCalculator);
    321     textureManager->prioritizeTextures();
    322     layer1->updateContentRect(m_queue, layerRect, 0, m_stats);
    323     layer2->updateContentRect(m_queue, IntRect(0, 0, 100, 100), 0, m_stats);
    324 
     306    layer2->setVisibleContentRect(IntRect(0, 0, 100, 100));
     307    bool needsUpdate = updateAndPush(layer1.get(), layerImpl1.get(),
     308                                     layer2.get(), layerImpl2.get());
    325309    // We should need idle-painting for both remaining tiles in layer2.
    326     EXPECT_TRUE(layer2->needsIdlePaint(layer2Rect));
    327 
    328     // Commit the frame over to impl.
    329     updateTextures();
    330     layer1->pushPropertiesTo(layerImpl1.get());
    331     layer2->pushPropertiesTo(layerImpl2.get());
     310    EXPECT_TRUE(needsUpdate);
    332311
    333312    // Reduce our memory limits to 1mb.
    334     textureManager->setMaxMemoryLimitBytes(1024 * 1024);
     313    m_textureManager->setMaxMemoryLimitBytes(1024 * 1024);
    335314
    336315    // Now idle paint layer2. We are going to run out of memory though!
    337     layer2->setTexturePriorities(m_priorityCalculator);
    338     layer1->setTexturePriorities(m_priorityCalculator);
    339     textureManager->prioritizeTextures();
    340     layer2->updateContentRect(m_queue, IntRect(0, 0, 100, 100), 0, m_stats);
    341 
    342316    // Oh well, commit the frame and push.
    343     updateTextures();
    344     layer1->pushPropertiesTo(layerImpl1.get());
    345     layer2->pushPropertiesTo(layerImpl2.get());
     317    for (int i = 0; i < 4; i++) {
     318        needsUpdate = updateAndPush(layer1.get(), layerImpl1.get(),
     319                                    layer2.get(), layerImpl2.get());
     320    }
    346321
    347322    // Sanity check, we should have textures for the big layer.
    348323    EXPECT_TRUE(layerImpl1->hasTextureIdForTileAt(0, 0));
    349 
    350     // We should only have the first tile from layer2 since it failed to idle update.
     324    EXPECT_TRUE(layerImpl1->hasTextureIdForTileAt(0, 23));
     325
     326    // We should only have the first two tiles from layer2 since
     327    // it failed to idle update the last tile.
    351328    EXPECT_TRUE(layerImpl2->hasTileAt(0, 0));
    352329    EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 0));
    353     EXPECT_FALSE(layerImpl2->hasTileAt(0, 1));
     330    EXPECT_TRUE(layerImpl2->hasTileAt(0, 1));
     331    EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 1));
     332   
     333    EXPECT_FALSE(needsUpdate);
    354334    EXPECT_FALSE(layerImpl2->hasTileAt(0, 2));
    355 
    356     // Now if layer2 becomes fully visible, we should be able to paint it and push valid textures.
    357     layer2->setTexturePriorities(m_priorityCalculator);
    358     layer1->setTexturePriorities(m_priorityCalculator);
    359     textureManager->prioritizeTextures();
    360     layer2->updateContentRect(m_queue, layer2Rect, 0, m_stats);
    361     layer1->updateContentRect(m_queue, layerRect, 0, m_stats);
    362 
    363     updateTextures();
    364     layer1->pushPropertiesTo(layerImpl1.get());
    365     layer2->pushPropertiesTo(layerImpl2.get());
    366 
    367     EXPECT_TRUE(layerImpl2->hasTileAt(0, 0));
    368     EXPECT_TRUE(layerImpl2->hasTileAt(0, 1));
    369     EXPECT_TRUE(layerImpl2->hasTileAt(0, 2));
    370     EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 0));
    371     EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 1));
    372     EXPECT_TRUE(layerImpl2->hasTextureIdForTileAt(0, 2));
    373335}
    374336
    375337TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles)
    376338{
    377     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    378     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     339    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    379340    DebugScopedSetImplThread implThread;
    380341    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
    381342    TestCCOcclusionTracker occluded;
    382 
     343    m_occlusion = &occluded;
     344   
    383345    // The tile size is 100x100, so this invalidates one occluded tile, culls it during paint, but prepaints it.
    384346    occluded.setOcclusion(IntRect(0, 0, 100, 100));
     
    386348    layer->setBounds(IntSize(100, 100));
    387349    layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
    388     layer->invalidateContentRect(IntRect(0, 0, 100, 100));
    389 
    390     layer->setTexturePriorities(m_priorityCalculator);
    391     textureManager->prioritizeTextures();
    392     layer->updateContentRect(m_queue, IntRect(0, 0, 100, 100), &occluded, m_stats);
    393     updateTextures();
    394     layer->pushPropertiesTo(layerImpl.get());
    395 
    396     // We should have the prepainted tile on the impl side.
     350    updateAndPush(layer.get(), layerImpl.get());
     351
     352    // We should have the prepainted tile on the impl side, but culled it during paint.
    397353    EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
     354    EXPECT_EQ(1, occluded.overdrawMetrics().tilesCulledForUpload());
    398355}
    399356
    400357TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint)
    401358{
    402     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    403     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     359    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    404360    DebugScopedSetImplThread implThread;
    405361    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
     
    408364    // However, during the paint, we invalidate one of the tiles. This should
    409365    // not prevent the tile from being pushed.
     366    layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer.get());
    410367    layer->setBounds(IntSize(100, 200));
    411     layer->invalidateContentRect(IntRect(0, 0, 100, 200));
    412     layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
    413     layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer.get());
    414 
    415     layer->setTexturePriorities(m_priorityCalculator);
    416     textureManager->prioritizeTextures();
    417     layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats);
    418     updateTextures();
    419     layer->pushPropertiesTo(layerImpl.get());
     368    layer->setVisibleContentRect(IntRect(0, 0, 100, 200));   
     369    updateAndPush(layer.get(), layerImpl.get());
    420370
    421371    // We should have both tiles on the impl side.
     
    426376TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer)
    427377{
    428     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    429     RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
    430     RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     378    RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
     379    RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    431380    DebugScopedSetImplThread implThread;
    432381    OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(1)));
    433382    OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2)));
    434383
     384    // Invalidate a tile on layer1, during update of layer 2.
     385    layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get());
    435386    layer1->setBounds(IntSize(100, 200));
    436     layer1->setVisibleContentRect(IntRect(0, 0, 100, 200));
    437     layer1->invalidateContentRect(IntRect(0, 0, 100, 200));
    438 
     387    layer1->setVisibleContentRect(IntRect(0, 0, 100, 200));   
    439388    layer2->setBounds(IntSize(100, 200));
    440     layer2->setVisibleContentRect(IntRect(0, 0, 100, 200));
    441     layer2->invalidateContentRect(IntRect(0, 0, 100, 200));
    442 
    443     layer1->setTexturePriorities(m_priorityCalculator);
    444     layer2->setTexturePriorities(m_priorityCalculator);
    445     textureManager->prioritizeTextures();
    446 
    447     layer1->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats);
    448 
    449     // Invalidate a tile on layer1
    450     layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get());
    451     layer2->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats);
    452 
    453     updateTextures();
    454     layer1->pushPropertiesTo(layer1Impl.get());
    455     layer2->pushPropertiesTo(layer2Impl.get());
     389    layer2->setVisibleContentRect(IntRect(0, 0, 100, 200));   
     390    updateAndPush(layer1.get(), layer1Impl.get(),
     391                  layer2.get(), layer2Impl.get());
    456392
    457393    // We should have both tiles on the impl side for all layers.
     
    464400TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer)
    465401{
    466     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    467     RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
    468     RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     402    RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
     403    RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    469404    DebugScopedSetImplThread implThread;
    470405    OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(1)));
    471406    OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2)));
    472407
     408    layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get());
    473409    layer1->setBounds(IntSize(100, 200));
    474     layer1->setVisibleContentRect(IntRect(0, 0, 100, 200));
    475     layer1->invalidateContentRect(IntRect(0, 0, 100, 200));
    476 
     410    layer1->setVisibleContentRect(IntRect(0, 0, 100, 200));   
    477411    layer2->setBounds(IntSize(100, 200));
    478     layer2->setVisibleContentRect(IntRect(0, 0, 100, 200));
    479     layer2->invalidateContentRect(IntRect(0, 0, 100, 200));
    480 
    481     layer1->setTexturePriorities(m_priorityCalculator);
    482     layer2->setTexturePriorities(m_priorityCalculator);
    483     textureManager->prioritizeTextures();
    484 
    485     // Invalidate a tile on layer2
    486     layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get());
    487     layer1->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats);
    488     layer2->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats);
    489     updateTextures();
    490     layer1->pushPropertiesTo(layer1Impl.get());
    491     layer2->pushPropertiesTo(layer2Impl.get());
     412    layer2->setVisibleContentRect(IntRect(0, 0, 100, 200));   
     413    updateAndPush(layer1.get(), layer1Impl.get(),
     414                  layer2.get(), layer2Impl.get());
    492415
    493416    // We should have both tiles on the impl side for all layers.
     
    519442            layerWidth *= 2;
    520443
    521         OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(memoryForLayer, 1024, CCRenderer::ContentPool);
    522         DebugScopedSetImplThread implThread;
    523 
    524         RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     444        m_textureManager->setMaxMemoryLimitBytes(memoryForLayer);
     445        DebugScopedSetImplThread implThread;
     446
     447        RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    525448        OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
    526449
     
    540463        // if it is close to the viewport size and has the available memory.
    541464        layer->setTexturePriorities(m_priorityCalculator);
    542         textureManager->prioritizeTextures();
    543         layer->updateContentRect(m_queue, visibleRect, 0, m_stats);
     465        m_textureManager->prioritizeTextures();
     466        layer->update(m_queue, 0, m_stats);
    544467        updateTextures();
    545468        layer->pushPropertiesTo(layerImpl.get());
     
    566489TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory)
    567490{
    568     // The tile size is 100x100. Setup 3x3 tiles with one 1x1 visible tile in the center.
    569     IntSize contentBounds(300, 300);
    570     IntRect contentRect(IntPoint::zero(), contentBounds);
    571     IntRect visibleRect(100, 100, 100, 100);
     491    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
     492    DebugScopedSetImplThread implThread;
     493    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
    572494
    573495    // We have enough memory for only the visible rect, so we will run out of memory in first idle paint.
    574496    int memoryLimit = 4 * 100 * 100; // 1 tiles, 4 bytes per pixel.
    575 
    576     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(memoryLimit, 1024, CCRenderer::ContentPool);
    577     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
    578     DebugScopedSetImplThread implThread;
    579     OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
    580 
    581     // Invalidates 9 tiles and then paints one visible tile.
    582     layer->setBounds(contentBounds);
    583     layer->setVisibleContentRect(visibleRect);
    584     layer->invalidateContentRect(contentRect);
    585 
    586     layer->setTexturePriorities(m_priorityCalculator);
    587     textureManager->prioritizeTextures();
    588     layer->updateContentRect(m_queue, visibleRect, 0, m_stats);
     497    m_textureManager->setMaxMemoryLimitBytes(memoryLimit);
     498
     499    // The tile size is 100x100, so this invalidates and then paints two tiles.
     500    bool needsUpdate = false;
     501    layer->setBounds(IntSize(300, 300));
     502    layer->setVisibleContentRect(IntRect(100, 100, 100, 100));
     503    for (int i = 0; i < 2; i++)
     504        needsUpdate = updateAndPush(layer.get(), layerImpl.get());
    589505
    590506    // Idle-painting should see no more priority tiles for painting.
    591     EXPECT_FALSE(layer->needsIdlePaint(visibleRect));
    592 
    593     updateTextures();
    594     layer->pushPropertiesTo(layerImpl.get());
     507    EXPECT_FALSE(needsUpdate);
    595508
    596509    // We should have one tile on the impl side.
    597510    EXPECT_TRUE(layerImpl->hasTileAt(1, 1));
    598 
    599     layer->setTexturePriorities(m_priorityCalculator);
    600     textureManager->prioritizeTextures();
    601     layer->updateContentRect(m_queue, visibleRect, 0, m_stats);
    602 
    603     // We shouldn't signal we need another idle paint.
    604     EXPECT_FALSE(layer->needsIdlePaint(visibleRect));
    605511}
    606512
    607513TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer)
    608514{
    609     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(20000, 1024, CCRenderer::ContentPool);
    610     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     515    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    611516    DebugScopedSetImplThread implThread;
    612517    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
     
    618523
    619524        // The layer's bounds are empty.
    620         IntRect contentRect;
    621 
    622         layer->setBounds(contentRect.size());
    623         layer->setVisibleContentRect(contentRect);
    624         layer->invalidateContentRect(contentRect);
    625 
    626         layer->setTexturePriorities(m_priorityCalculator);
    627         textureManager->prioritizeTextures();
    628 
    629525        // Empty layers don't paint or idle-paint.
    630         layer->updateContentRect(m_queue, contentRect, 0, m_stats);
    631 
     526        layer->setBounds(IntSize());
     527        layer->setVisibleContentRect(IntRect());
     528        bool needsUpdate = updateAndPush(layer.get(), layerImpl.get());
     529       
    632530        // Empty layers don't have tiles.
    633531        EXPECT_EQ(0u, layer->numPaintedTiles());
    634532
    635533        // Empty layers don't need prepaint.
    636         EXPECT_FALSE(layer->needsIdlePaint(contentRect));
    637 
    638         layer->pushPropertiesTo(layerImpl.get());
     534        EXPECT_FALSE(needsUpdate);
    639535
    640536        // Empty layers don't have tiles.
     
    645541TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers)
    646542{
    647     IntSize contentBounds(100, 100);
    648     IntRect contentRect(IntPoint::zero(), contentBounds);
    649 
    650     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    651     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     543    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    652544    DebugScopedSetImplThread implThread;
    653545    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
    654     layer->setBounds(contentBounds);
    655546
    656547    // Alternate between not visible and visible.
     
    663554    // or after the layer was visible and we didn't invalidate.
    664555    bool haveTile[10] = { false, false, true, true, false, false, true, true, true, true };
    665 
     556   
    666557    for (int i = 0; i < 10; i++) {
     558        layer->setBounds(IntSize(100, 100));
    667559        layer->setVisibleContentRect(visibleRect[i]);
    668560
    669         // Skip invalidation once to insure the tile stays in memory while not visible.
    670561        if (invalidate[i])
    671             layer->invalidateContentRect(contentRect);
    672 
    673         // Paint / idle-paint.
    674         textureManager->clearPriorities();
    675         layer->setTexturePriorities(m_priorityCalculator);
    676         textureManager->prioritizeTextures();
    677         layer->updateContentRect(m_queue, visibleRect[i], 0, m_stats);
    678 
    679         updateTextures();
    680 
     562            layer->invalidateContentRect(IntRect(0, 0, 100, 100));
     563        bool needsUpdate = updateAndPush(layer.get(), layerImpl.get());
     564       
    681565        // We should never signal idle paint, as we painted the entire layer
    682566        // or the layer was not visible.
    683         EXPECT_FALSE(layer->needsIdlePaint(visibleRect[i]));
    684 
    685         layer->pushPropertiesTo(layerImpl.get());
     567        EXPECT_FALSE(needsUpdate);
    686568        EXPECT_EQ(layerImpl->hasTileAt(0, 0), haveTile[i]);
    687569    }
    688570}
    689571
    690 
    691572TEST_F(TiledLayerChromiumTest, invalidateFromPrepare)
    692573{
    693     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    694     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     574    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    695575    DebugScopedSetImplThread implThread;
    696576    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
     
    699579    layer->setBounds(IntSize(100, 200));
    700580    layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
    701     layer->invalidateContentRect(IntRect(0, 0, 100, 200));
    702     layer->setTexturePriorities(m_priorityCalculator);
    703     textureManager->prioritizeTextures();
    704     layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats);
    705     updateTextures(1000);
    706     layer->pushPropertiesTo(layerImpl.get());
     581    updateAndPush(layer.get(), layerImpl.get());
    707582
    708583    // We should have both tiles on the impl side.
     
    711586
    712587    layer->fakeLayerTextureUpdater()->clearPrepareCount();
    713     // Invoke updateContentRect again. As the layer is valid updateContentRect shouldn't be invoked on
     588    // Invoke update again. As the layer is valid update shouldn't be invoked on
    714589    // the LayerTextureUpdater.
    715     layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats);
    716     updateTextures(1000);
     590    updateAndPush(layer.get(), layerImpl.get());
    717591    EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount());
    718592
    719     layer->invalidateContentRect(IntRect(0, 0, 50, 50));
    720     // setRectToInvalidate triggers invalidateContentRect() being invoked from updateContentRect.
     593    // setRectToInvalidate triggers invalidateContentRect() being invoked from update.
    721594    layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get());
    722595    layer->fakeLayerTextureUpdater()->clearPrepareCount();
    723     layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats);
    724     updateTextures(1000);
     596    layer->invalidateContentRect(IntRect(0, 0, 50, 50));
     597    updateAndPush(layer.get(), layerImpl.get());
    725598    EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount());
    726599    layer->fakeLayerTextureUpdater()->clearPrepareCount();
    727     // The layer should still be invalid as updateContentRect invoked invalidate.
    728     layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats);
    729     updateTextures(1000);
     600
     601    // The layer should still be invalid as update invoked invalidate.
     602    updateAndPush(layer.get(), layerImpl.get()); // visible
    730603    EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount());
    731604}
     
    735608    // The updateRect (that indicates what was actually painted) should be in
    736609    // layer space, not the content space.
    737 
    738     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    739     RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(textureManager.get()));
     610    RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(m_textureManager.get()));
    740611    DebugScopedSetImplThread implThread;
    741612
     
    752623
    753624    layer->setTexturePriorities(m_priorityCalculator);
    754     textureManager->prioritizeTextures();
    755     layer->updateContentRect(m_queue, contentBounds, 0, m_stats);
     625    m_textureManager->prioritizeTextures();
     626    layer->update(m_queue, 0, m_stats);
    756627    EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect());
    757628    updateTextures();
     
    759630    // After the tiles are updated once, another invalidate only needs to update the bounds of the layer.
    760631    layer->setTexturePriorities(m_priorityCalculator);
    761     textureManager->prioritizeTextures();
     632    m_textureManager->prioritizeTextures();
    762633    layer->invalidateContentRect(contentBounds);
    763     layer->updateContentRect(m_queue, contentBounds, 0, m_stats);
     634    layer->update(m_queue, 0, m_stats);
    764635    EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect());
    765636    updateTextures();
     
    769640    layer->invalidateContentRect(partialDamage);
    770641    layer->setTexturePriorities(m_priorityCalculator);
    771     textureManager->prioritizeTextures();
    772     layer->updateContentRect(m_queue, contentBounds, 0, m_stats);
     642    m_textureManager->prioritizeTextures();
     643    layer->update(m_queue, 0, m_stats);
    773644    EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect());
    774645}
     
    776647TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
    777648{
    778     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    779     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     649    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    780650    DebugScopedSetImplThread implThread;
    781651    OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
     
    791661    // Push the tiles to the impl side and check that there is exactly one.
    792662    layer->setTexturePriorities(m_priorityCalculator);
    793     textureManager->prioritizeTextures();
    794     layer->updateContentRect(m_queue, IntRect(0, 0, 100, 100), 0, m_stats);
     663    m_textureManager->prioritizeTextures();
     664    layer->update(m_queue, 0, m_stats);
    795665    updateTextures();
    796666    layer->pushPropertiesTo(layerImpl.get());
     
    808678    // The impl side should get 2x2 tiles now.
    809679    layer->setTexturePriorities(m_priorityCalculator);
    810     textureManager->prioritizeTextures();
    811     layer->updateContentRect(m_queue, IntRect(0, 0, 200, 200), 0, m_stats);
     680    m_textureManager->prioritizeTextures();
     681    layer->update(m_queue, 0, m_stats);
    812682    updateTextures();
    813683    layer->pushPropertiesTo(layerImpl.get());
     
    821691    layer->setNeedsDisplay();
    822692    layer->setTexturePriorities(m_priorityCalculator);
    823     layer->updateContentRect(m_queue, IntRect(1, 0, 0, 1), 0, m_stats);
    824     textureManager->prioritizeTextures();
     693    m_textureManager->prioritizeTextures();
    825694
    826695    layer->pushPropertiesTo(layerImpl.get());
     
    884753TEST_F(TiledLayerChromiumTest, resizeToSmaller)
    885754{
    886     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool);
    887     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     755    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    888756
    889757    layer->setBounds(IntSize(700, 700));
     
    892760
    893761    layer->setTexturePriorities(m_priorityCalculator);
    894     textureManager->prioritizeTextures();
    895     layer->updateContentRect(m_queue, IntRect(0, 0, 700, 700), 0, m_stats);
     762    m_textureManager->prioritizeTextures();
     763    layer->update(m_queue, 0, m_stats);
    896764
    897765    layer->setBounds(IntSize(200, 200));
     
    901769TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash)
    902770{
    903     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool);
    904     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     771    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    905772
    906773    int size = 1 << 30;
     
    911778    // Ensure no crash for bounds where size * size would overflow an int.
    912779    layer->setTexturePriorities(m_priorityCalculator);
    913     textureManager->prioritizeTextures();
    914     layer->updateContentRect(m_queue, IntRect(0, 0, 700, 700), 0, m_stats);
     780    m_textureManager->prioritizeTextures();
     781    layer->update(m_queue, 0, m_stats);
    915782}
    916783
     
    1045912TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion)
    1046913{
    1047     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    1048     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     914    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    1049915
    1050916    // The tile size is 100x100, so this invalidates and then paints two tiles.
     
    1055921
    1056922    layer->setTexturePriorities(m_priorityCalculator);
    1057     textureManager->prioritizeTextures();
    1058     layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats);
     923    m_textureManager->prioritizeTextures();
     924    layer->update(m_queue, 0, m_stats);
    1059925    EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount());
    1060926}
     
    1062928TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion)
    1063929{
    1064     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    1065     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     930    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    1066931    TestCCOcclusionTracker occluded;
    1067932
     
    1076941
    1077942    layer->setTexturePriorities(m_priorityCalculator);
    1078     textureManager->prioritizeTextures();
    1079     layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);
     943    m_textureManager->prioritizeTextures();
     944    layer->update(m_queue, &occluded, m_stats);
    1080945    EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
    1081946
     
    1086951    layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
    1087952    layer->setTexturePriorities(m_priorityCalculator);
    1088     textureManager->prioritizeTextures();
     953    m_textureManager->prioritizeTextures();
    1089954
    1090955    occluded.setOcclusion(IntRect(250, 200, 300, 100));
    1091956    layer->invalidateContentRect(IntRect(0, 0, 600, 600));
    1092     layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);
     957    layer->update(m_queue, &occluded, m_stats);
    1093958    EXPECT_EQ(36-2, layer->fakeLayerTextureUpdater()->prepareRectCount());
    1094959
     
    1099964    layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
    1100965    layer->setTexturePriorities(m_priorityCalculator);
    1101     textureManager->prioritizeTextures();
     966    m_textureManager->prioritizeTextures();
    1102967
    1103968    occluded.setOcclusion(IntRect(250, 250, 300, 100));
    1104969    layer->invalidateContentRect(IntRect(0, 0, 600, 600));
    1105     layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);
     970    layer->update(m_queue, &occluded, m_stats);
    1106971    EXPECT_EQ(36, layer->fakeLayerTextureUpdater()->prepareRectCount());
    1107972
     
    1113978TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
    1114979{
    1115     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    1116     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     980    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    1117981    TestCCOcclusionTracker occluded;
    1118982
     
    1128992
    1129993    layer->setTexturePriorities(m_priorityCalculator);
    1130     textureManager->prioritizeTextures();
    1131     layer->updateContentRect(m_queue, IntRect(0, 0, 600, 360), &occluded, m_stats);
     994    m_textureManager->prioritizeTextures();
     995    layer->update(m_queue, &occluded, m_stats);
    1132996    EXPECT_EQ(24-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
    1133997
     
    11441008    layer->invalidateContentRect(IntRect(0, 0, 600, 600));
    11451009    layer->setTexturePriorities(m_priorityCalculator);
    1146     textureManager->prioritizeTextures();
    1147     layer->updateContentRect(m_queue, IntRect(0, 0, 600, 350), &occluded, m_stats);
     1010    m_textureManager->prioritizeTextures();
     1011    layer->update(m_queue, &occluded, m_stats);
    11481012    EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount());
    11491013
     
    11601024    layer->invalidateContentRect(IntRect(0, 0, 600, 600));
    11611025    layer->setTexturePriorities(m_priorityCalculator);
    1162     textureManager->prioritizeTextures();
    1163     layer->updateContentRect(m_queue, IntRect(0, 0, 600, 340), &occluded, m_stats);
     1026    m_textureManager->prioritizeTextures();
     1027    layer->update(m_queue, &occluded, m_stats);
    11641028    EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount());
    11651029
     
    11721036TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation)
    11731037{
    1174     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    1175     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     1038    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    11761039    TestCCOcclusionTracker occluded;
    11771040
     
    11851048    layer->invalidateContentRect(IntRect(0, 0, 600, 600));
    11861049    layer->setTexturePriorities(m_priorityCalculator);
    1187     textureManager->prioritizeTextures();
    1188     layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);
     1050    m_textureManager->prioritizeTextures();
     1051    layer->update(m_queue, &occluded, m_stats);
    11891052    EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
    11901053    {
     
    11991062    layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
    12001063    layer->setTexturePriorities(m_priorityCalculator);
    1201     textureManager->prioritizeTextures();
     1064    m_textureManager->prioritizeTextures();
    12021065
    12031066    // Repaint without marking it dirty. The 3 culled tiles will be pre-painted now.
    1204     layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);
     1067    layer->update(m_queue, &occluded, m_stats);
    12051068    EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->prepareRectCount());
    12061069
     
    12121075TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms)
    12131076{
    1214     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    1215     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     1077    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    12161078    TestCCOcclusionTracker occluded;
    12171079
     
    12311093    layer->invalidateContentRect(IntRect(0, 0, 600, 600));
    12321094    layer->setTexturePriorities(m_priorityCalculator);
    1233     textureManager->prioritizeTextures();
    1234     layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);
     1095    m_textureManager->prioritizeTextures();
     1096    layer->update(m_queue, &occluded, m_stats);
    12351097    EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
    12361098
     
    12421104TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling)
    12431105{
    1244     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    1245     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     1106    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    12461107    TestCCOcclusionTracker occluded;
    12471108
     
    12631124    layer->invalidateContentRect(IntRect(0, 0, 600, 600));
    12641125    layer->setTexturePriorities(m_priorityCalculator);
    1265     textureManager->prioritizeTextures();
    1266     layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);
     1126    m_textureManager->prioritizeTextures();
     1127    layer->update(m_queue, &occluded, m_stats);
    12671128    // The content is half the size of the layer (so the number of tiles is fewer).
    12681129    // In this case, the content is 300x300, and since the tile size is 100, the
     
    12841145    layer->invalidateContentRect(IntRect(0, 0, 600, 600));
    12851146    layer->setTexturePriorities(m_priorityCalculator);
    1286     textureManager->prioritizeTextures();
    1287     layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);
     1147    m_textureManager->prioritizeTextures();
     1148    layer->update(m_queue, &occluded, m_stats);
    12881149    EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount());
    12891150
     
    13051166    layer->invalidateContentRect(IntRect(0, 0, 600, 600));
    13061167    layer->setTexturePriorities(m_priorityCalculator);
    1307     textureManager->prioritizeTextures();
    1308     layer->updateContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);
     1168    m_textureManager->prioritizeTextures();
     1169    layer->update(m_queue, &occluded, m_stats);
    13091170    EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount());
    13101171
     
    13161177TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion)
    13171178{
    1318     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    1319     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     1179    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    13201180    TestCCOcclusionTracker occluded;
    13211181    DebugScopedSetImplThread implThread;
     
    13351195
    13361196    layer->setTexturePriorities(m_priorityCalculator);
    1337     textureManager->prioritizeTextures();
     1197    m_textureManager->prioritizeTextures();
    13381198
    13391199    // If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty.
    13401200    layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
    13411201    layer->invalidateContentRect(contentBounds);
    1342     layer->updateContentRect(m_queue, contentBounds, &occluded, m_stats);
     1202    layer->update(m_queue, &occluded, m_stats);
    13431203    opaqueContents = layer->visibleContentOpaqueRegion();
    13441204    EXPECT_TRUE(opaqueContents.isEmpty());
     
    13531213    layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect);
    13541214    layer->invalidateContentRect(contentBounds);
    1355     layer->updateContentRect(m_queue, contentBounds, &occluded, m_stats);
     1215    layer->update(m_queue, &occluded, m_stats);
    13561216    updateTextures();
    13571217    opaqueContents = layer->visibleContentOpaqueRegion();
     
    13661226    // If we paint again without invalidating, the same stuff should be opaque.
    13671227    layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
    1368     layer->updateContentRect(m_queue, contentBounds, &occluded, m_stats);
     1228    layer->update(m_queue, &occluded, m_stats);
    13691229    updateTextures();
    13701230    opaqueContents = layer->visibleContentOpaqueRegion();
     
    13811241    layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
    13821242    layer->invalidateContentRect(IntRect(0, 0, 1, 1));
    1383     layer->updateContentRect(m_queue, contentBounds, &occluded, m_stats);
     1243    layer->update(m_queue, &occluded, m_stats);
    13841244    updateTextures();
    13851245    opaqueContents = layer->visibleContentOpaqueRegion();
     
    13961256    layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
    13971257    layer->invalidateContentRect(IntRect(10, 10, 1, 1));
    1398     layer->updateContentRect(m_queue, contentBounds, &occluded, m_stats);
     1258    layer->update(m_queue, &occluded, m_stats);
    13991259    updateTextures();
    14001260    opaqueContents = layer->visibleContentOpaqueRegion();
     
    14101270TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics)
    14111271{
    1412     OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(4*1024*1024, 1024, CCRenderer::ContentPool);
    1413     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     1272    RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get()));
    14141273    TestCCOcclusionTracker occluded;
    14151274    DebugScopedSetImplThread implThread;
     
    14291288
    14301289    layer->setTexturePriorities(m_priorityCalculator);
    1431     textureManager->prioritizeTextures();
     1290    m_textureManager->prioritizeTextures();
    14321291
    14331292    // Invalidates and paints the whole layer.
    14341293    layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
    14351294    layer->invalidateContentRect(contentBounds);
    1436     layer->updateContentRect(m_queue, contentBounds, &occluded, m_stats);
     1295    layer->update(m_queue, &occluded, m_stats);
    14371296    updateTextures();
    14381297    opaqueContents = layer->visibleContentOpaqueRegion();
     
    14491308    layer->invalidateContentRect(IntRect(0, 0, 1, 1));
    14501309    layer->invalidateContentRect(IntRect(50, 200, 10, 10));
    1451     layer->updateContentRect(m_queue, contentBounds, &occluded, m_stats);
     1310    layer->update(m_queue, &occluded, m_stats);
    14521311    updateTextures();
    14531312    opaqueContents = layer->visibleContentOpaqueRegion();
     
    16631522TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
    16641523{
    1665     OwnPtr<CCPrioritizedTextureManager> textureManager(CCPrioritizedTextureManager::create(4000000, 4000000, CCRenderer::ContentPool));
    1666 
    1667     RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(textureManager.get()));
     1524    RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(m_textureManager.get()));
    16681525
    16691526    IntRect layerRect(0, 0, 30, 31);
     
    16781535
    16791536    layer->setTexturePriorities(m_priorityCalculator);
    1680     textureManager->prioritizeTextures();
     1537    m_textureManager->prioritizeTextures();
    16811538
    16821539    // Update the whole tile.
    1683     layer->updateContentRect(m_queue, contentRect, 0, m_stats);
     1540    layer->update(m_queue, 0, m_stats);
    16841541    layer->trackingLayerPainter()->resetPaintedRect();
    16851542
     
    16931550    // Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds.
    16941551    layer->invalidateContentRect(contentRect);
    1695     layer->updateContentRect(m_queue, contentRect, 0, m_stats);
     1552    layer->update(m_queue, 0, m_stats);
    16961553
    16971554    EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect());
     
    17001557TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation)
    17011558{
    1702     OwnPtr<CCPrioritizedTextureManager> textureManager(CCPrioritizedTextureManager::create(4000000, 4000000, CCRenderer::ContentPool));
    1703 
    1704     RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(textureManager.get()));
     1559    RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTrackingTiledLayerChromium(m_textureManager.get()));
    17051560
    17061561    IntRect layerRect(0, 0, 30, 31);
     
    17141569
    17151570    layer->setTexturePriorities(m_priorityCalculator);
    1716     textureManager->prioritizeTextures();
     1571    m_textureManager->prioritizeTextures();
    17171572
    17181573    // Update the whole tile.
    1719     layer->updateContentRect(m_queue, contentRect, 0, m_stats);
     1574    layer->update(m_queue, 0, m_stats);
    17201575    layer->trackingLayerPainter()->resetPaintedRect();
    17211576
     
    17291584    // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds.
    17301585    layer->setNeedsDisplayRect(layerRect);
    1731     layer->updateContentRect(m_queue, contentRect, 0, m_stats);
     1586    layer->update(m_queue, 0, m_stats);
    17321587
    17331588    EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect());
Note: See TracChangeset for help on using the changeset viewer.