Changeset 126340 in webkit
- Timestamp:
- Aug 22, 2012 12:50:01 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r126336 r126340 1 2012-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 1 34 2012-08-22 Otto Derek Cheung <otcheung@rim.com> 2 35 -
trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
r125932 r126340 97 97 { 98 98 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); 108 100 m_needsDisplay = false; 109 101 } … … 111 103 bool ContentLayerChromium::needMoreUpdates() 112 104 { 113 if (!drawsContent()) 114 return false; 115 return needsIdlePaint(visibleContentRect()); 105 return needsIdlePaint(); 116 106 } 117 107 -
trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
r125932 r126340 149 149 m_needsDisplay = false; 150 150 } 151 152 updateContentRect(queue, visibleContentRect(), occlusion, stats); 151 TiledLayerChromium::update(queue, occlusion, stats); 153 152 } 154 153 -
trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
r125932 r126340 554 554 } 555 555 556 void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priorityCalc)557 {558 setTexturePrioritiesInRect(priorityCalc, visibleContentRect());559 }560 561 556 namespace { 562 557 // This picks a small animated layer to be anything less than one viewport. This … … 593 588 } 594 589 595 void TiledLayerChromium::setTexturePriorities InRect(const CCPriorityCalculator& priorityCalc, const IntRect& visibleContentRect)590 void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priorityCalc) 596 591 { 597 592 updateBounds(); … … 605 600 606 601 // Minimally create the tiles in the desired pre-paint rect. 607 IntRect createTilesRect = idlePaintRect( visibleContentRect);602 IntRect createTilesRect = idlePaintRect(); 608 603 if (!createTilesRect.isEmpty()) { 609 604 int left, top, right, bottom; … … 619 614 // Also, minimally create all tiles for small animated layers and also 620 615 // double-buffer them since we have limited their size to be reasonable. 621 IntRect doubleBufferedRect = visibleContentRect ;616 IntRect doubleBufferedRect = visibleContentRect(); 622 617 if (smallAnimatedLayer) 623 618 doubleBufferedRect = IntRect(IntPoint::zero(), contentBounds()); … … 648 643 tile->dirtyRect = tileRect; 649 644 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()); 651 646 OwnPtr<CCPrioritizedTexture> frontBuffer = CCPrioritizedTexture::create(backBuffer->texture()->textureManager(), 652 647 backBuffer->texture()->size(), … … 666 661 continue; 667 662 IntRect tileRect = m_tiler->tileRect(tile); 668 setPriorityForTexture(priorityCalc, visibleContentRect , tileRect, drawsToRoot, smallAnimatedLayer, tile->managedTexture());663 setPriorityForTexture(priorityCalc, visibleContentRect(), tileRect, drawsToRoot, smallAnimatedLayer, tile->managedTexture()); 669 664 } 670 665 } … … 681 676 void TiledLayerChromium::resetUpdateState() 682 677 { 678 m_skipsDraw = false; 679 m_failedUpdate = false; 680 683 681 CCLayerTilingData::TileMap::const_iterator end = m_tiler->tiles().end(); 684 682 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != end; ++iter) { … … 691 689 } 692 690 693 void TiledLayerChromium::updateContentRect(CCTextureUpdateQueue& queue, const IntRect& contentRect, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) 694 { 695 m_skipsDraw = false; 696 m_failedUpdate = false; 691 void TiledLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTracker* occlusion, CCRenderingStats& stats) 692 { 693 ASSERT(!m_skipsDraw && !m_failedUpdate); // Did resetUpdateState get skipped? 697 694 updateBounds(); 698 699 if (m_tiler->hasEmptyBounds()) 695 if (m_tiler->hasEmptyBounds() || !drawsContent()) 700 696 return; 701 697 … … 716 712 } 717 713 718 if ( contentRect.isEmpty())714 if (visibleContentRect().isEmpty()) 719 715 return; 720 716 721 717 // Visible painting. First occlude visible tiles and paint the non-occluded tiles. 722 718 int left, top, right, bottom; 723 m_tiler->contentRectToTileIndices( contentRect, left, top, right, bottom);719 m_tiler->contentRectToTileIndices(visibleContentRect(), left, top, right, bottom); 724 720 markOcclusionsAndRequestTextures(left, top, right, bottom, occlusion); 725 721 m_skipsDraw = !updateTiles(left, top, right, bottom, queue, occlusion, stats, didPaint); … … 730 726 731 727 // If we have already painting everything visible. Do some pre-painting while idle. 732 IntRect idlePaintContentRect = idlePaintRect( contentRect);728 IntRect idlePaintContentRect = idlePaintRect(); 733 729 if (idlePaintContentRect.isEmpty()) 734 730 return; … … 766 762 } 767 763 768 bool TiledLayerChromium::needsIdlePaint( const IntRect& visibleContentRect)764 bool TiledLayerChromium::needsIdlePaint() 769 765 { 770 766 // 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()) 772 768 return false; 773 769 774 IntRect idlePaintContentRect = idlePaintRect( visibleContentRect);770 IntRect idlePaintContentRect = idlePaintRect(); 775 771 if (idlePaintContentRect.isEmpty()) 776 772 return false; … … 796 792 } 797 793 798 IntRect TiledLayerChromium::idlePaintRect( const IntRect& visibleContentRect)794 IntRect TiledLayerChromium::idlePaintRect() 799 795 { 800 796 // Don't inflate an empty rect. 801 if (visibleContentRect .isEmpty())802 return visibleContentRect;797 if (visibleContentRect().isEmpty()) 798 return IntRect(); 803 799 804 800 // FIXME: This can be made a lot larger now! We should increase 805 801 // this slowly while insuring it doesn't cause any perf issues. 806 IntRect prepaintRect = visibleContentRect ;802 IntRect prepaintRect = visibleContentRect(); 807 803 prepaintRect.inflateX(m_tiler->tileSize().width()); 808 804 prepaintRect.inflateY(m_tiler->tileSize().height() * 2); -
trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h
r125932 r126340 61 61 virtual Region visibleContentOpaqueRegion() const OVERRIDE; 62 62 63 virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingStats&) OVERRIDE; 64 63 65 protected: 64 66 TiledLayerChromium(); … … 83 85 void resetUpdateState(); 84 86 85 // Prepare data needed to update textures that intersect with contentRect.86 void updateContentRect(CCTextureUpdateQueue&, const IntRect& contentRect, const CCOcclusionTracker*, CCRenderingStats&);87 88 87 // 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(); 92 90 93 91 bool skipsDraw() const { return m_skipsDraw; } … … 104 102 bool tileOnlyNeedsPartialUpdate(UpdatableTile*); 105 103 bool tileNeedsBufferedUpdate(UpdatableTile*); 106 107 void setTexturePrioritiesInRect(const CCPriorityCalculator&, const IntRect& visibleContentRect);108 104 109 105 void markOcclusionsAndRequestTextures(int left, int top, int right, int bottom, const CCOcclusionTracker*); -
trunk/Source/WebKit/chromium/ChangeLog
r126327 r126340 1 2012-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 1 15 2012-08-22 Iain Merrick <husky@chromium.org> 2 16 -
trunk/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp
r125827 r126340 116 116 } 117 117 118 void FakeTiledLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTracker* occlusion, CCRenderingStats& stats)119 {120 updateContentRect(queue, visibleContentRect(), occlusion, stats);121 }122 123 118 void FakeTiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& calculator) 124 119 { -
trunk/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h
r125932 r126340 113 113 114 114 using WebCore::TiledLayerChromium::invalidateContentRect; 115 using WebCore::TiledLayerChromium::updateContentRect;116 115 using WebCore::TiledLayerChromium::needsIdlePaint; 117 116 using WebCore::TiledLayerChromium::skipsDraw; … … 121 120 virtual void setNeedsDisplayRect(const WebCore::FloatRect&) OVERRIDE; 122 121 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;126 122 127 123 virtual void setTexturePriorities(const WebCore::CCPriorityCalculator&) OVERRIDE; -
trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp
r125932 r126340 78 78 TiledLayerChromiumTest() 79 79 : m_context(WebKit::createFakeCCGraphicsContext()) 80 , m_textureManager(CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool)) 81 , m_occlusion(0) 80 82 { 81 83 DebugScopedSetImplThread implThread; … … 93 95 CCTextureUpdateController::updateTextures(m_resourceProvider.get(), &m_copier, &m_uploader, &m_queue, count); 94 96 } 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 95 133 public: 96 134 OwnPtr<CCGraphicsContext> m_context; … … 101 139 FakeTextureUploader m_uploader; 102 140 CCPriorityCalculator m_priorityCalculator; 141 OwnPtr<CCPrioritizedTextureManager> m_textureManager; 142 TestCCOcclusionTracker* m_occlusion; 103 143 }; 104 144 105 106 107 145 TEST_F(TiledLayerChromiumTest, pushDirtyTiles) 108 146 { 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())); 111 148 DebugScopedSetImplThread implThread; 112 149 OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); … … 116 153 layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); 117 154 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()); 125 156 126 157 // We should have both tiles on the impl side. … … 128 159 EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); 129 160 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)); 131 164 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()); 137 166 138 167 // We should only have the first tile since the other tile was invalidated but not painted. … … 143 172 TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) 144 173 { 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())); 147 175 DebugScopedSetImplThread implThread; 148 176 OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); 149 177 TestCCOcclusionTracker occluded; 178 m_occlusion = &occluded; 150 179 151 180 // The tile size is 100x100, so this invalidates and then paints two tiles. 152 181 layer->setBounds(IntSize(100, 200)); 153 layer->setDrawableContentRect(IntRect(0, 0, 100, 200));154 182 layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); 155 183 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()); 163 185 164 186 EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); … … 174 196 // ....but the area is occluded. 175 197 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()); 179 199 180 200 EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); … … 189 209 TEST_F(TiledLayerChromiumTest, pushDeletedTiles) 190 210 { 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())); 193 212 DebugScopedSetImplThread implThread; 194 213 OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); … … 198 217 layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); 199 218 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()); 207 220 208 221 // We should have both tiles on the impl side. … … 210 223 EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); 211 224 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); 215 228 216 229 // This should drop the tiles on the impl thread. … … 221 234 EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); 222 235 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. 231 241 EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); 232 242 EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); … … 235 245 TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) 236 246 { 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())); 239 248 DebugScopedSetImplThread implThread; 240 249 OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); 241 250 242 251 // 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); 262 259 263 260 // We should have one tile on the impl side. … … 266 263 // For the next four updates, we should detect we still need idle painting. 267 264 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 } 279 268 280 269 // We should have one tile surrounding the visible tile on all sides, but no other tiles. 281 270 IntRect idlePaintTiles(1, 1, 3, 3); 282 271 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); 290 280 } 291 281 … … 293 283 { 294 284 // 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())); 298 288 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())); 300 290 OwnPtr<FakeCCTiledLayerImpl> layerImpl2(adoptPtr(new FakeCCTiledLayerImpl(2))); 301 291 … … 304 294 // layer2, we will fail on the third tile of layer2, and this should not leave the second tile in a bad state. 305 295 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 306 299 // This requires 4*30000 bytes of memory. 307 300 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); 308 305 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()); 325 309 // 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); 332 311 333 312 // Reduce our memory limits to 1mb. 334 textureManager->setMaxMemoryLimitBytes(1024 * 1024);313 m_textureManager->setMaxMemoryLimitBytes(1024 * 1024); 335 314 336 315 // 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 342 316 // 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 } 346 321 347 322 // Sanity check, we should have textures for the big layer. 348 323 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. 351 328 EXPECT_TRUE(layerImpl2->hasTileAt(0, 0)); 352 329 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); 354 334 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));373 335 } 374 336 375 337 TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) 376 338 { 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())); 379 340 DebugScopedSetImplThread implThread; 380 341 OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); 381 342 TestCCOcclusionTracker occluded; 382 343 m_occlusion = &occluded; 344 383 345 // The tile size is 100x100, so this invalidates one occluded tile, culls it during paint, but prepaints it. 384 346 occluded.setOcclusion(IntRect(0, 0, 100, 100)); … … 386 348 layer->setBounds(IntSize(100, 100)); 387 349 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. 397 353 EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); 354 EXPECT_EQ(1, occluded.overdrawMetrics().tilesCulledForUpload()); 398 355 } 399 356 400 357 TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) 401 358 { 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())); 404 360 DebugScopedSetImplThread implThread; 405 361 OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); … … 408 364 // However, during the paint, we invalidate one of the tiles. This should 409 365 // not prevent the tile from being pushed. 366 layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer.get()); 410 367 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()); 420 370 421 371 // We should have both tiles on the impl side. … … 426 376 TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) 427 377 { 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())); 431 380 DebugScopedSetImplThread implThread; 432 381 OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(1))); 433 382 OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); 434 383 384 // Invalidate a tile on layer1, during update of layer 2. 385 layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get()); 435 386 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)); 439 388 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()); 456 392 457 393 // We should have both tiles on the impl side for all layers. … … 464 400 TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer) 465 401 { 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())); 469 404 DebugScopedSetImplThread implThread; 470 405 OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(1))); 471 406 OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); 472 407 408 layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get()); 473 409 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)); 477 411 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()); 492 415 493 416 // We should have both tiles on the impl side for all layers. … … 519 442 layerWidth *= 2; 520 443 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())); 525 448 OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); 526 449 … … 540 463 // if it is close to the viewport size and has the available memory. 541 464 layer->setTexturePriorities(m_priorityCalculator); 542 textureManager->prioritizeTextures();543 layer->update ContentRect(m_queue, visibleRect, 0, m_stats);465 m_textureManager->prioritizeTextures(); 466 layer->update(m_queue, 0, m_stats); 544 467 updateTextures(); 545 468 layer->pushPropertiesTo(layerImpl.get()); … … 566 489 TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) 567 490 { 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))); 572 494 573 495 // We have enough memory for only the visible rect, so we will run out of memory in first idle paint. 574 496 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()); 589 505 590 506 // 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); 595 508 596 509 // We should have one tile on the impl side. 597 510 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));605 511 } 606 512 607 513 TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) 608 514 { 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())); 611 516 DebugScopedSetImplThread implThread; 612 517 OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); … … 618 523 619 524 // 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 629 525 // 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 632 530 // Empty layers don't have tiles. 633 531 EXPECT_EQ(0u, layer->numPaintedTiles()); 634 532 635 533 // Empty layers don't need prepaint. 636 EXPECT_FALSE(layer->needsIdlePaint(contentRect)); 637 638 layer->pushPropertiesTo(layerImpl.get()); 534 EXPECT_FALSE(needsUpdate); 639 535 640 536 // Empty layers don't have tiles. … … 645 541 TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) 646 542 { 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())); 652 544 DebugScopedSetImplThread implThread; 653 545 OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); 654 layer->setBounds(contentBounds);655 546 656 547 // Alternate between not visible and visible. … … 663 554 // or after the layer was visible and we didn't invalidate. 664 555 bool haveTile[10] = { false, false, true, true, false, false, true, true, true, true }; 665 556 666 557 for (int i = 0; i < 10; i++) { 558 layer->setBounds(IntSize(100, 100)); 667 559 layer->setVisibleContentRect(visibleRect[i]); 668 560 669 // Skip invalidation once to insure the tile stays in memory while not visible.670 561 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 681 565 // We should never signal idle paint, as we painted the entire layer 682 566 // or the layer was not visible. 683 EXPECT_FALSE(layer->needsIdlePaint(visibleRect[i])); 684 685 layer->pushPropertiesTo(layerImpl.get()); 567 EXPECT_FALSE(needsUpdate); 686 568 EXPECT_EQ(layerImpl->hasTileAt(0, 0), haveTile[i]); 687 569 } 688 570 } 689 571 690 691 572 TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) 692 573 { 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())); 695 575 DebugScopedSetImplThread implThread; 696 576 OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); … … 699 579 layer->setBounds(IntSize(100, 200)); 700 580 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()); 707 582 708 583 // We should have both tiles on the impl side. … … 711 586 712 587 layer->fakeLayerTextureUpdater()->clearPrepareCount(); 713 // Invoke update ContentRect again. As the layer is valid updateContentRectshouldn't be invoked on588 // Invoke update again. As the layer is valid update shouldn't be invoked on 714 589 // the LayerTextureUpdater. 715 layer->updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats); 716 updateTextures(1000); 590 updateAndPush(layer.get(), layerImpl.get()); 717 591 EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount()); 718 592 719 layer->invalidateContentRect(IntRect(0, 0, 50, 50)); 720 // setRectToInvalidate triggers invalidateContentRect() being invoked from updateContentRect. 593 // setRectToInvalidate triggers invalidateContentRect() being invoked from update. 721 594 layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get()); 722 595 layer->fakeLayerTextureUpdater()->clearPrepareCount(); 723 layer-> updateContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats);724 update Textures(1000);596 layer->invalidateContentRect(IntRect(0, 0, 50, 50)); 597 updateAndPush(layer.get(), layerImpl.get()); 725 598 EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); 726 599 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 update Textures(1000);600 601 // The layer should still be invalid as update invoked invalidate. 602 updateAndPush(layer.get(), layerImpl.get()); // visible 730 603 EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); 731 604 } … … 735 608 // The updateRect (that indicates what was actually painted) should be in 736 609 // 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())); 740 611 DebugScopedSetImplThread implThread; 741 612 … … 752 623 753 624 layer->setTexturePriorities(m_priorityCalculator); 754 textureManager->prioritizeTextures();755 layer->update ContentRect(m_queue, contentBounds, 0, m_stats);625 m_textureManager->prioritizeTextures(); 626 layer->update(m_queue, 0, m_stats); 756 627 EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect()); 757 628 updateTextures(); … … 759 630 // After the tiles are updated once, another invalidate only needs to update the bounds of the layer. 760 631 layer->setTexturePriorities(m_priorityCalculator); 761 textureManager->prioritizeTextures();632 m_textureManager->prioritizeTextures(); 762 633 layer->invalidateContentRect(contentBounds); 763 layer->update ContentRect(m_queue, contentBounds, 0, m_stats);634 layer->update(m_queue, 0, m_stats); 764 635 EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect()); 765 636 updateTextures(); … … 769 640 layer->invalidateContentRect(partialDamage); 770 641 layer->setTexturePriorities(m_priorityCalculator); 771 textureManager->prioritizeTextures();772 layer->update ContentRect(m_queue, contentBounds, 0, m_stats);642 m_textureManager->prioritizeTextures(); 643 layer->update(m_queue, 0, m_stats); 773 644 EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect()); 774 645 } … … 776 647 TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) 777 648 { 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())); 780 650 DebugScopedSetImplThread implThread; 781 651 OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); … … 791 661 // Push the tiles to the impl side and check that there is exactly one. 792 662 layer->setTexturePriorities(m_priorityCalculator); 793 textureManager->prioritizeTextures();794 layer->update ContentRect(m_queue, IntRect(0, 0, 100, 100), 0, m_stats);663 m_textureManager->prioritizeTextures(); 664 layer->update(m_queue, 0, m_stats); 795 665 updateTextures(); 796 666 layer->pushPropertiesTo(layerImpl.get()); … … 808 678 // The impl side should get 2x2 tiles now. 809 679 layer->setTexturePriorities(m_priorityCalculator); 810 textureManager->prioritizeTextures();811 layer->update ContentRect(m_queue, IntRect(0, 0, 200, 200), 0, m_stats);680 m_textureManager->prioritizeTextures(); 681 layer->update(m_queue, 0, m_stats); 812 682 updateTextures(); 813 683 layer->pushPropertiesTo(layerImpl.get()); … … 821 691 layer->setNeedsDisplay(); 822 692 layer->setTexturePriorities(m_priorityCalculator); 823 layer->updateContentRect(m_queue, IntRect(1, 0, 0, 1), 0, m_stats); 824 textureManager->prioritizeTextures(); 693 m_textureManager->prioritizeTextures(); 825 694 826 695 layer->pushPropertiesTo(layerImpl.get()); … … 884 753 TEST_F(TiledLayerChromiumTest, resizeToSmaller) 885 754 { 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())); 888 756 889 757 layer->setBounds(IntSize(700, 700)); … … 892 760 893 761 layer->setTexturePriorities(m_priorityCalculator); 894 textureManager->prioritizeTextures();895 layer->update ContentRect(m_queue, IntRect(0, 0, 700, 700), 0, m_stats);762 m_textureManager->prioritizeTextures(); 763 layer->update(m_queue, 0, m_stats); 896 764 897 765 layer->setBounds(IntSize(200, 200)); … … 901 769 TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) 902 770 { 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())); 905 772 906 773 int size = 1 << 30; … … 911 778 // Ensure no crash for bounds where size * size would overflow an int. 912 779 layer->setTexturePriorities(m_priorityCalculator); 913 textureManager->prioritizeTextures();914 layer->update ContentRect(m_queue, IntRect(0, 0, 700, 700), 0, m_stats);780 m_textureManager->prioritizeTextures(); 781 layer->update(m_queue, 0, m_stats); 915 782 } 916 783 … … 1045 912 TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) 1046 913 { 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())); 1049 915 1050 916 // The tile size is 100x100, so this invalidates and then paints two tiles. … … 1055 921 1056 922 layer->setTexturePriorities(m_priorityCalculator); 1057 textureManager->prioritizeTextures();1058 layer->update ContentRect(m_queue, IntRect(0, 0, 100, 200), 0, m_stats);923 m_textureManager->prioritizeTextures(); 924 layer->update(m_queue, 0, m_stats); 1059 925 EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount()); 1060 926 } … … 1062 928 TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) 1063 929 { 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())); 1066 931 TestCCOcclusionTracker occluded; 1067 932 … … 1076 941 1077 942 layer->setTexturePriorities(m_priorityCalculator); 1078 textureManager->prioritizeTextures();1079 layer->update ContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);943 m_textureManager->prioritizeTextures(); 944 layer->update(m_queue, &occluded, m_stats); 1080 945 EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); 1081 946 … … 1086 951 layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); 1087 952 layer->setTexturePriorities(m_priorityCalculator); 1088 textureManager->prioritizeTextures();953 m_textureManager->prioritizeTextures(); 1089 954 1090 955 occluded.setOcclusion(IntRect(250, 200, 300, 100)); 1091 956 layer->invalidateContentRect(IntRect(0, 0, 600, 600)); 1092 layer->update ContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);957 layer->update(m_queue, &occluded, m_stats); 1093 958 EXPECT_EQ(36-2, layer->fakeLayerTextureUpdater()->prepareRectCount()); 1094 959 … … 1099 964 layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); 1100 965 layer->setTexturePriorities(m_priorityCalculator); 1101 textureManager->prioritizeTextures();966 m_textureManager->prioritizeTextures(); 1102 967 1103 968 occluded.setOcclusion(IntRect(250, 250, 300, 100)); 1104 969 layer->invalidateContentRect(IntRect(0, 0, 600, 600)); 1105 layer->update ContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);970 layer->update(m_queue, &occluded, m_stats); 1106 971 EXPECT_EQ(36, layer->fakeLayerTextureUpdater()->prepareRectCount()); 1107 972 … … 1113 978 TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) 1114 979 { 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())); 1117 981 TestCCOcclusionTracker occluded; 1118 982 … … 1128 992 1129 993 layer->setTexturePriorities(m_priorityCalculator); 1130 textureManager->prioritizeTextures();1131 layer->update ContentRect(m_queue, IntRect(0, 0, 600, 360), &occluded, m_stats);994 m_textureManager->prioritizeTextures(); 995 layer->update(m_queue, &occluded, m_stats); 1132 996 EXPECT_EQ(24-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); 1133 997 … … 1144 1008 layer->invalidateContentRect(IntRect(0, 0, 600, 600)); 1145 1009 layer->setTexturePriorities(m_priorityCalculator); 1146 textureManager->prioritizeTextures();1147 layer->update ContentRect(m_queue, IntRect(0, 0, 600, 350), &occluded, m_stats);1010 m_textureManager->prioritizeTextures(); 1011 layer->update(m_queue, &occluded, m_stats); 1148 1012 EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); 1149 1013 … … 1160 1024 layer->invalidateContentRect(IntRect(0, 0, 600, 600)); 1161 1025 layer->setTexturePriorities(m_priorityCalculator); 1162 textureManager->prioritizeTextures();1163 layer->update ContentRect(m_queue, IntRect(0, 0, 600, 340), &occluded, m_stats);1026 m_textureManager->prioritizeTextures(); 1027 layer->update(m_queue, &occluded, m_stats); 1164 1028 EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); 1165 1029 … … 1172 1036 TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) 1173 1037 { 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())); 1176 1039 TestCCOcclusionTracker occluded; 1177 1040 … … 1185 1048 layer->invalidateContentRect(IntRect(0, 0, 600, 600)); 1186 1049 layer->setTexturePriorities(m_priorityCalculator); 1187 textureManager->prioritizeTextures();1188 layer->update ContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);1050 m_textureManager->prioritizeTextures(); 1051 layer->update(m_queue, &occluded, m_stats); 1189 1052 EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); 1190 1053 { … … 1199 1062 layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); 1200 1063 layer->setTexturePriorities(m_priorityCalculator); 1201 textureManager->prioritizeTextures();1064 m_textureManager->prioritizeTextures(); 1202 1065 1203 1066 // Repaint without marking it dirty. The 3 culled tiles will be pre-painted now. 1204 layer->update ContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);1067 layer->update(m_queue, &occluded, m_stats); 1205 1068 EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->prepareRectCount()); 1206 1069 … … 1212 1075 TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) 1213 1076 { 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())); 1216 1078 TestCCOcclusionTracker occluded; 1217 1079 … … 1231 1093 layer->invalidateContentRect(IntRect(0, 0, 600, 600)); 1232 1094 layer->setTexturePriorities(m_priorityCalculator); 1233 textureManager->prioritizeTextures();1234 layer->update ContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);1095 m_textureManager->prioritizeTextures(); 1096 layer->update(m_queue, &occluded, m_stats); 1235 1097 EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); 1236 1098 … … 1242 1104 TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) 1243 1105 { 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())); 1246 1107 TestCCOcclusionTracker occluded; 1247 1108 … … 1263 1124 layer->invalidateContentRect(IntRect(0, 0, 600, 600)); 1264 1125 layer->setTexturePriorities(m_priorityCalculator); 1265 textureManager->prioritizeTextures();1266 layer->update ContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);1126 m_textureManager->prioritizeTextures(); 1127 layer->update(m_queue, &occluded, m_stats); 1267 1128 // The content is half the size of the layer (so the number of tiles is fewer). 1268 1129 // In this case, the content is 300x300, and since the tile size is 100, the … … 1284 1145 layer->invalidateContentRect(IntRect(0, 0, 600, 600)); 1285 1146 layer->setTexturePriorities(m_priorityCalculator); 1286 textureManager->prioritizeTextures();1287 layer->update ContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);1147 m_textureManager->prioritizeTextures(); 1148 layer->update(m_queue, &occluded, m_stats); 1288 1149 EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); 1289 1150 … … 1305 1166 layer->invalidateContentRect(IntRect(0, 0, 600, 600)); 1306 1167 layer->setTexturePriorities(m_priorityCalculator); 1307 textureManager->prioritizeTextures();1308 layer->update ContentRect(m_queue, IntRect(0, 0, 600, 600), &occluded, m_stats);1168 m_textureManager->prioritizeTextures(); 1169 layer->update(m_queue, &occluded, m_stats); 1309 1170 EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); 1310 1171 … … 1316 1177 TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) 1317 1178 { 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())); 1320 1180 TestCCOcclusionTracker occluded; 1321 1181 DebugScopedSetImplThread implThread; … … 1335 1195 1336 1196 layer->setTexturePriorities(m_priorityCalculator); 1337 textureManager->prioritizeTextures();1197 m_textureManager->prioritizeTextures(); 1338 1198 1339 1199 // If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty. 1340 1200 layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); 1341 1201 layer->invalidateContentRect(contentBounds); 1342 layer->update ContentRect(m_queue, contentBounds, &occluded, m_stats);1202 layer->update(m_queue, &occluded, m_stats); 1343 1203 opaqueContents = layer->visibleContentOpaqueRegion(); 1344 1204 EXPECT_TRUE(opaqueContents.isEmpty()); … … 1353 1213 layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); 1354 1214 layer->invalidateContentRect(contentBounds); 1355 layer->update ContentRect(m_queue, contentBounds, &occluded, m_stats);1215 layer->update(m_queue, &occluded, m_stats); 1356 1216 updateTextures(); 1357 1217 opaqueContents = layer->visibleContentOpaqueRegion(); … … 1366 1226 // If we paint again without invalidating, the same stuff should be opaque. 1367 1227 layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); 1368 layer->update ContentRect(m_queue, contentBounds, &occluded, m_stats);1228 layer->update(m_queue, &occluded, m_stats); 1369 1229 updateTextures(); 1370 1230 opaqueContents = layer->visibleContentOpaqueRegion(); … … 1381 1241 layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); 1382 1242 layer->invalidateContentRect(IntRect(0, 0, 1, 1)); 1383 layer->update ContentRect(m_queue, contentBounds, &occluded, m_stats);1243 layer->update(m_queue, &occluded, m_stats); 1384 1244 updateTextures(); 1385 1245 opaqueContents = layer->visibleContentOpaqueRegion(); … … 1396 1256 layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); 1397 1257 layer->invalidateContentRect(IntRect(10, 10, 1, 1)); 1398 layer->update ContentRect(m_queue, contentBounds, &occluded, m_stats);1258 layer->update(m_queue, &occluded, m_stats); 1399 1259 updateTextures(); 1400 1260 opaqueContents = layer->visibleContentOpaqueRegion(); … … 1410 1270 TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) 1411 1271 { 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())); 1414 1273 TestCCOcclusionTracker occluded; 1415 1274 DebugScopedSetImplThread implThread; … … 1429 1288 1430 1289 layer->setTexturePriorities(m_priorityCalculator); 1431 textureManager->prioritizeTextures();1290 m_textureManager->prioritizeTextures(); 1432 1291 1433 1292 // Invalidates and paints the whole layer. 1434 1293 layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); 1435 1294 layer->invalidateContentRect(contentBounds); 1436 layer->update ContentRect(m_queue, contentBounds, &occluded, m_stats);1295 layer->update(m_queue, &occluded, m_stats); 1437 1296 updateTextures(); 1438 1297 opaqueContents = layer->visibleContentOpaqueRegion(); … … 1449 1308 layer->invalidateContentRect(IntRect(0, 0, 1, 1)); 1450 1309 layer->invalidateContentRect(IntRect(50, 200, 10, 10)); 1451 layer->update ContentRect(m_queue, contentBounds, &occluded, m_stats);1310 layer->update(m_queue, &occluded, m_stats); 1452 1311 updateTextures(); 1453 1312 opaqueContents = layer->visibleContentOpaqueRegion(); … … 1663 1522 TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) 1664 1523 { 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())); 1668 1525 1669 1526 IntRect layerRect(0, 0, 30, 31); … … 1678 1535 1679 1536 layer->setTexturePriorities(m_priorityCalculator); 1680 textureManager->prioritizeTextures();1537 m_textureManager->prioritizeTextures(); 1681 1538 1682 1539 // Update the whole tile. 1683 layer->update ContentRect(m_queue, contentRect, 0, m_stats);1540 layer->update(m_queue, 0, m_stats); 1684 1541 layer->trackingLayerPainter()->resetPaintedRect(); 1685 1542 … … 1693 1550 // Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds. 1694 1551 layer->invalidateContentRect(contentRect); 1695 layer->update ContentRect(m_queue, contentRect, 0, m_stats);1552 layer->update(m_queue, 0, m_stats); 1696 1553 1697 1554 EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); … … 1700 1557 TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation) 1701 1558 { 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())); 1705 1560 1706 1561 IntRect layerRect(0, 0, 30, 31); … … 1714 1569 1715 1570 layer->setTexturePriorities(m_priorityCalculator); 1716 textureManager->prioritizeTextures();1571 m_textureManager->prioritizeTextures(); 1717 1572 1718 1573 // Update the whole tile. 1719 layer->update ContentRect(m_queue, contentRect, 0, m_stats);1574 layer->update(m_queue, 0, m_stats); 1720 1575 layer->trackingLayerPainter()->resetPaintedRect(); 1721 1576 … … 1729 1584 // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds. 1730 1585 layer->setNeedsDisplayRect(layerRect); 1731 layer->update ContentRect(m_queue, contentRect, 0, m_stats);1586 layer->update(m_queue, 0, m_stats); 1732 1587 1733 1588 EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect());
Note: See TracChangeset
for help on using the changeset viewer.