Changeset 122185 in webkit
- Timestamp:
- Jul 9, 2012 7:29:15 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r122184 r122185 1 2012-07-09 Eric Penner <epenner@google.com> 2 3 [chromium] Merge updates and idle updates into one pass 4 https://bugs.webkit.org/show_bug.cgi?id=90324 5 6 Reviewed by Adrienne Walker. 7 8 We no longer need to do painting is passes in order 9 to allocate memory in the right order. So this merges 10 updates and idle updates into one pass. 11 12 Covered by existing unit tests (some of which are 13 updated with this patch). 14 15 * platform/graphics/chromium/ContentLayerChromium.cpp: 16 (WebCore::ContentLayerChromium::needMoreUpdates): 17 * platform/graphics/chromium/ContentLayerChromium.h: 18 (ContentLayerChromium): 19 * platform/graphics/chromium/LayerChromium.h: 20 (WebCore::LayerChromium::needMoreUpdates): 21 * platform/graphics/chromium/TiledLayerChromium.cpp: 22 (WebCore::TiledLayerChromium::updateTiles): 23 (WebCore::TiledLayerChromium::updateLayerRect): 24 * platform/graphics/chromium/TiledLayerChromium.h: 25 (TiledLayerChromium): 26 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: 27 (WebCore::CCLayerTreeHost::CCLayerTreeHost): 28 (WebCore::CCLayerTreeHost::compositeAndReadback): 29 (WebCore::CCLayerTreeHost::updateLayers): 30 (WebCore::CCLayerTreeHost::paintMasksForRenderSurface): 31 (WebCore::CCLayerTreeHost::paintLayerContents): 32 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 33 (CCLayerTreeHost): 34 1 35 2012-07-09 Yoshifumi Inoue <yosin@chromium.org> 2 36 -
trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
r121628 r122185 109 109 } 110 110 111 void ContentLayerChromium::idleUpdate(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion)111 bool ContentLayerChromium::needMoreUpdates() 112 112 { 113 113 if (!drawsContent()) 114 return; 115 116 const IntRect layerRect = visibleLayerRect(); 117 idleUpdateLayerRect(updater, layerRect, occlusion); 118 if (needsIdlePaint(layerRect)) 119 setNeedsCommit(); 114 return false; 115 return needsIdlePaint(visibleLayerRect()); 120 116 } 121 117 -
trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h
r121628 r122185 79 79 virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE; 80 80 virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) OVERRIDE; 81 virtual void idleUpdate(CCTextureUpdater&, const CCOcclusionTracker*) OVERRIDE;81 virtual bool needMoreUpdates() OVERRIDE; 82 82 83 83 virtual void setOpaque(bool) OVERRIDE; -
trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h
r121574 r122185 212 212 virtual bool drawsContent() const { return m_isDrawable; } 213 213 virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) { } 214 virtual void idleUpdate(CCTextureUpdater&, const CCOcclusionTracker*) {}214 virtual bool needMoreUpdates() { return false; } 215 215 virtual void setIsMask(bool) { } 216 216 virtual void bindContentsTexture() { } -
trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
r121870 r122185 351 351 createTextureUpdaterIfNeeded(); 352 352 353 // We shouldn't track any occlusion metrics during idle painting. 354 ASSERT(!idle || !occlusion); 355 353 356 // Create tiles as needed, expanding a dirty rect to contain all 354 357 // the dirty regions currently being drawn. All dirty tiles that are to be painted … … 609 612 } 610 613 611 void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRect& layerRect, const CCOcclusionTracker* occlusion)614 void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRect& contentRect, const CCOcclusionTracker* occlusion) 612 615 { 613 616 m_skipsDraw = false; … … 617 620 updateBounds(); 618 621 619 if ( layerRect.isEmpty() ||m_tiler->hasEmptyBounds())622 if (m_tiler->hasEmptyBounds()) 620 623 return; 621 624 622 int left, top, right, bottom; 623 m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom); 624 625 updateTiles(false, left, top, right, bottom, updater, occlusion); 626 } 627 628 void TiledLayerChromium::idleUpdateLayerRect(CCTextureUpdater& updater, const IntRect& layerRect, const CCOcclusionTracker* occlusion) 629 { 625 // Visible painting. Only paint visible tiles if the visible rect isn't empty. 626 if (!contentRect.isEmpty()) { 627 int left, top, right, bottom; 628 m_tiler->layerRectToTileIndices(contentRect, left, top, right, bottom); 629 updateTiles(false, left, top, right, bottom, updater, occlusion); 630 } 631 630 632 // Abort if we have already painted or run out of memory. 631 633 if (m_skipsIdlePaint || m_didPaint) 632 634 return; 633 635 634 ASSERT(m_tiler); 635 636 updateBounds(); 637 638 if (m_tiler->hasEmptyBounds()) 636 // If we have already painting everything visible. Do some pre-painting while idle. 637 IntRect idlePaintContentRect = idlePaintRect(contentRect); 638 if (idlePaintContentRect.isEmpty()) 639 639 return; 640 640 641 IntRect idlePaintLayerRect = idlePaintRect(layerRect);642 if (idlePaintLayerRect.isEmpty())643 return;644 645 641 int prepaintLeft, prepaintTop, prepaintRight, prepaintBottom; 646 m_tiler->layerRectToTileIndices(idlePaint LayerRect, prepaintLeft, prepaintTop, prepaintRight, prepaintBottom);642 m_tiler->layerRectToTileIndices(idlePaintContentRect, prepaintLeft, prepaintTop, prepaintRight, prepaintBottom); 647 643 648 644 // If the layer is not visible, we have nothing to expand from, so instead we prepaint the outer-most set of tiles. 649 if ( layerRect.isEmpty()) {645 if (contentRect.isEmpty()) { 650 646 updateTiles(true, prepaintLeft, prepaintTop, prepaintRight, prepaintTop, updater, 0); 651 647 if (m_didPaint || m_skipsIdlePaint) … … 662 658 663 659 int left, top, right, bottom; 664 m_tiler->layerRectToTileIndices( layerRect, left, top, right, bottom);660 m_tiler->layerRectToTileIndices(contentRect, left, top, right, bottom); 665 661 666 662 // Otherwise, prepaint anything that was occluded but inside the layer's visible region. … … 698 694 } 699 695 700 bool TiledLayerChromium::needsIdlePaint(const IntRect& layerRect)696 bool TiledLayerChromium::needsIdlePaint(const IntRect& contentRect) 701 697 { 702 698 if (m_skipsIdlePaint) … … 706 702 return false; 707 703 708 IntRect idlePaint LayerRect = idlePaintRect(layerRect);709 if (idlePaint LayerRect.isEmpty())704 IntRect idlePaintContentRect = idlePaintRect(contentRect); 705 if (idlePaintContentRect.isEmpty()) 710 706 return false; 711 707 712 708 int left, top, right, bottom; 713 m_tiler->layerRectToTileIndices(idlePaint LayerRect, left, top, right, bottom);709 m_tiler->layerRectToTileIndices(idlePaintContentRect, left, top, right, bottom); 714 710 715 711 for (int j = top; j <= bottom; ++j) { 716 712 for (int i = left; i <= right; ++i) { 717 713 // If the layerRect is empty, then we are painting the outer-most set of tiles only. 718 if ( layerRect.isEmpty() && i != left && i != right && j != top && j != bottom)714 if (contentRect.isEmpty() && i != left && i != right && j != top && j != bottom) 719 715 continue; 720 716 UpdatableTile* tile = tileAt(i, j); … … 733 729 } 734 730 735 IntRect TiledLayerChromium::idlePaintRect(const IntRect& visible LayerRect)731 IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleRect) 736 732 { 737 733 IntRect contentRect(IntPoint::zero(), contentBounds()); … … 740 736 // of them is going to become visible. For small layers we return the entire layer, for larger 741 737 // ones we avoid prepainting the layer at all. 742 if (visible LayerRect.isEmpty()) {738 if (visibleRect.isEmpty()) { 743 739 bool isSmallLayer = m_tiler->numTilesX() <= 9 && m_tiler->numTilesY() <= 9 && m_tiler->numTilesX() * m_tiler->numTilesY() <= 9; 744 740 if ((drawTransformIsAnimating() || screenSpaceTransformIsAnimating()) && isSmallLayer) … … 749 745 // FIXME: This can be made a lot larger now! We should increase 750 746 // this slowly while insuring it doesn't cause any perf issues. 751 IntRect prepaintRect = visible LayerRect;747 IntRect prepaintRect = visibleRect; 752 748 prepaintRect.inflateX(m_tiler->tileSize().width()); 753 749 prepaintRect.inflateY(m_tiler->tileSize().height() * 2); -
trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h
r121870 r122185 86 86 void updateLayerRect(CCTextureUpdater&, const IntRect& layerRect, const CCOcclusionTracker*); 87 87 88 // Same as above, but this will try to paint additional surrounding content if idle. 89 void idleUpdateLayerRect(CCTextureUpdater&, const IntRect& layerRect, const CCOcclusionTracker*); 90 91 // After preparing an update, returns true if more pre-painting is needed. 88 // After preparing an update, returns true if more painting is needed. 92 89 bool needsIdlePaint(const IntRect& layerRect); 93 90 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
r121870 r122185 86 86 , m_minPageScaleFactor(1) 87 87 , m_maxPageScaleFactor(1) 88 , m_triggerIdle Paints(true)88 , m_triggerIdleUpdates(true) 89 89 , m_backgroundColor(SK_ColorWHITE) 90 90 , m_hasTransparentBackground(false) … … 289 289 bool CCLayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) 290 290 { 291 m_triggerIdle Paints = false;291 m_triggerIdleUpdates = false; 292 292 bool ret = m_proxy->compositeAndReadback(pixels, rect); 293 m_triggerIdle Paints = true;293 m_triggerIdleUpdates = true; 294 294 return ret; 295 295 } … … 493 493 prioritizeTextures(updateList); 494 494 495 paintLayerContents(updateList, PaintVisible, updater); 496 497 if (m_triggerIdlePaints) { 498 // The second (idle) paint will be a no-op in layers where painting already occured above. 499 // FIXME: This pass can be merged with the visible pass now that textures 500 // are prioritized above. 501 paintLayerContents(updateList, PaintIdle, updater); 502 } 495 bool needMoreUpdates = paintLayerContents(updateList, updater); 496 if (m_triggerIdleUpdates && needMoreUpdates) 497 setNeedsCommit(); 503 498 504 499 for (size_t i = 0; i < updateList.size(); ++i) … … 551 546 } 552 547 553 // static 554 void CCLayerTreeHost::update(LayerChromium* layer, PaintType paintType, CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) 555 { 556 ASSERT(layer); 557 ASSERT(PaintVisible == paintType || PaintIdle == paintType); 558 if (PaintVisible == paintType) 559 layer->update(updater, occlusion); 560 else 561 layer->idleUpdate(updater, occlusion); 562 } 563 564 void CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLayer, PaintType paintType, CCTextureUpdater& updater) 548 bool CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLayer, CCTextureUpdater& updater) 565 549 { 566 550 // Note: Masks and replicas only exist for layers that own render surfaces. If we reach this point … … 568 552 // mask and replica should be painted. 569 553 554 bool needMoreUpdates = false; 570 555 LayerChromium* maskLayer = renderSurfaceLayer->maskLayer(); 571 if (maskLayer) 572 update(maskLayer, paintType, updater, 0); 556 if (maskLayer) { 557 maskLayer->update(updater, 0); 558 needMoreUpdates |= maskLayer->needMoreUpdates(); 559 } 573 560 574 561 LayerChromium* replicaMaskLayer = renderSurfaceLayer->replicaLayer() ? renderSurfaceLayer->replicaLayer()->maskLayer() : 0; 575 if (replicaMaskLayer) 576 update(replicaMaskLayer, paintType, updater, 0); 577 } 578 579 void CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, PaintType paintType, CCTextureUpdater& updater) 562 if (replicaMaskLayer) { 563 replicaMaskLayer->update(updater, 0); 564 needMoreUpdates |= replicaMaskLayer->needMoreUpdates(); 565 } 566 return needMoreUpdates; 567 } 568 569 bool CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, CCTextureUpdater& updater) 580 570 { 581 571 // Use FrontToBack to allow for testing occlusion and performing culling during the tree walk. 582 572 typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType; 583 573 574 bool needMoreUpdates = false; 584 575 bool recordMetricsForFrame = true; // FIXME: In the future, disable this when about:tracing is off. 585 576 CCOcclusionTracker occlusionTracker(IntRect(IntPoint(), deviceViewportSize()), recordMetricsForFrame); … … 592 583 if (it.representsTargetRenderSurface()) { 593 584 ASSERT(it->renderSurface()->drawOpacity() || it->renderSurface()->drawOpacityIsAnimating()); 594 paintMasksForRenderSurface(*it, paintType, updater);585 needMoreUpdates |= paintMasksForRenderSurface(*it, updater); 595 586 } else if (it.representsItself()) { 596 587 ASSERT(!it->bounds().isEmpty()); 597 update(*it, paintType, updater, &occlusionTracker); 588 it->update(updater, &occlusionTracker); 589 needMoreUpdates |= it->needMoreUpdates(); 598 590 } 599 591 … … 604 596 occlusionTracker.overdrawMetrics().didUseRenderSurfaceTextureMemoryBytes(m_contentsTextureManager->memoryForRenderSurfacesBytes()); 605 597 occlusionTracker.overdrawMetrics().recordMetrics(this); 598 599 return needMoreUpdates; 606 600 } 607 601 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r121574 r122185 279 279 void initializeLayerRenderer(); 280 280 281 enum PaintType { PaintVisible, PaintIdle }; 282 static void update(LayerChromium*, PaintType, CCTextureUpdater&, const CCOcclusionTracker*); 283 void paintLayerContents(const LayerList&, PaintType, CCTextureUpdater&); 284 void paintMasksForRenderSurface(LayerChromium*, PaintType, CCTextureUpdater&); 281 static void update(LayerChromium*, CCTextureUpdater&, const CCOcclusionTracker*); 282 bool paintLayerContents(const LayerList&, CCTextureUpdater&); 283 bool paintMasksForRenderSurface(LayerChromium*, CCTextureUpdater&); 285 284 286 285 void updateLayers(LayerChromium*, CCTextureUpdater&); … … 324 323 float m_pageScaleFactor; 325 324 float m_minPageScaleFactor, m_maxPageScaleFactor; 326 bool m_triggerIdlePaints; 325 bool m_triggerIdleUpdates; 326 327 327 SkColor m_backgroundColor; 328 328 bool m_hasTransparentBackground; -
trunk/Source/WebKit/chromium/ChangeLog
r122184 r122185 1 2012-07-09 Eric Penner <epenner@google.com> 2 3 [chromium] Merge updates and idle updates into one pass 4 https://bugs.webkit.org/show_bug.cgi?id=90324 5 6 Reviewed by Adrienne Walker. 7 8 * tests/CCLayerTreeHostTest.cpp: 9 (WTF::ContentLayerChromiumWithUpdateTracking::resetPaintContentsCount): 10 (WTF::ContentLayerChromiumWithUpdateTracking::ContentLayerChromiumWithUpdateTracking): 11 (ContentLayerChromiumWithUpdateTracking): 12 (WTF::CCLayerTreeHostTestOpacityChange::afterTest): 13 * tests/CCTiledLayerTestCommon.h: 14 (FakeTiledLayerChromium): 15 * tests/TiledLayerChromiumTest.cpp: 16 1 17 2012-07-09 Yoshifumi Inoue <yosin@chromium.org> 2 18 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
r121864 r122185 1159 1159 1160 1160 int paintContentsCount() { return m_paintContentsCount; } 1161 int idlePaintContentsCount() { return m_idlePaintContentsCount; } 1162 void resetPaintContentsCount() { m_paintContentsCount = 0; m_idlePaintContentsCount = 0;} 1161 void resetPaintContentsCount() { m_paintContentsCount = 0; } 1163 1162 1164 1163 virtual void update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) OVERRIDE … … 1166 1165 ContentLayerChromium::update(updater, occlusion); 1167 1166 m_paintContentsCount++; 1168 }1169 1170 virtual void idleUpdate(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) OVERRIDE1171 {1172 ContentLayerChromium::idleUpdate(updater, occlusion);1173 m_idlePaintContentsCount++;1174 1167 } 1175 1168 … … 1178 1171 : ContentLayerChromium(delegate) 1179 1172 , m_paintContentsCount(0) 1180 , m_idlePaintContentsCount(0)1181 1173 { 1182 1174 setBounds(IntSize(10, 10)); … … 1185 1177 1186 1178 int m_paintContentsCount; 1187 int m_idlePaintContentsCount;1188 1179 }; 1189 1180 … … 1214 1205 // update() should have been called once. 1215 1206 EXPECT_EQ(1, m_updateCheckLayer->paintContentsCount()); 1216 1217 // idleUpdate() should have been called once1218 EXPECT_EQ(1, m_updateCheckLayer->idlePaintContentsCount());1219 1207 1220 1208 // clear m_updateCheckLayer so CCLayerTreeHost dies. -
trunk/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h
r121870 r122185 113 113 using WebCore::TiledLayerChromium::invalidateRect; 114 114 using WebCore::TiledLayerChromium::updateLayerRect; 115 using WebCore::TiledLayerChromium::idleUpdateLayerRect;116 115 using WebCore::TiledLayerChromium::needsIdlePaint; 117 116 using WebCore::TiledLayerChromium::skipsDraw; -
trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp
r122160 r122185 260 260 layer->updateLayerRect(updater, visibleRect, 0); 261 261 EXPECT_TRUE(layer->needsIdlePaint(visibleRect)); 262 layer->idleUpdateLayerRect(updater, visibleRect, 0);263 262 updateTextures(); 264 263 layer->pushPropertiesTo(layerImpl.get()); … … 329 328 textureManager->prioritizeTextures(0); 330 329 layer2->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); 331 layer2->idleUpdateLayerRect(updater, layer2Rect, 0);332 330 333 331 // Oh well, commit the frame and push. … … 383 381 textureManager->prioritizeTextures(0); 384 382 layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded); 385 layer->idleUpdateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded);386 383 updateTextures(); 387 384 layer->pushPropertiesTo(layerImpl.get()); … … 527 524 textureManager->prioritizeTextures(0); 528 525 layer->updateLayerRect(updater, visibleRect, 0); 529 layer->idleUpdateLayerRect(updater, visibleRect, 0);530 526 531 527 // We shouldn't signal we need another idle paint. … … 540 536 OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); 541 537 542 // The layer's bounds are empty. 543 IntRect contentRect; 544 545 layer->setBounds(contentRect.size()); 546 layer->setVisibleLayerRect(contentRect); 547 layer->invalidateRect(contentRect); 548 549 layer->setTexturePriorities(priorityCalculator); 550 textureManager->prioritizeTextures(0); 551 layer->updateLayerRect(updater, contentRect, 0); 552 553 // Empty layers don't have tiles. 554 EXPECT_EQ(0u, layer->numPaintedTiles()); 555 556 // Empty layers don't need prepaint. 557 EXPECT_FALSE(layer->needsIdlePaint(contentRect)); 558 559 layer->pushPropertiesTo(layerImpl.get()); 560 561 // Empty layers don't have tiles. 562 EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); 563 564 // Non-visible layers don't idle paint. 565 layer->idleUpdateLayerRect(updater, contentRect, 0); 566 567 // Empty layers don't have tiles. 568 EXPECT_EQ(0u, layer->numPaintedTiles()); 569 570 layer->pushPropertiesTo(layerImpl.get()); 571 572 // Empty layers don't have tiles. 573 EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); 574 } 575 576 TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedAnimatingLayer) 577 { 578 OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(20000, 1024); 579 RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); 580 DebugScopedSetImplThread implThread; 581 OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); 582 583 // Pretend the layer is animating. 584 layer->setDrawTransformIsAnimating(true); 585 586 // The layer's bounds are empty. 587 IntRect contentRect; 588 589 layer->setBounds(contentRect.size()); 590 layer->setVisibleLayerRect(contentRect); 591 layer->invalidateRect(contentRect); 592 593 layer->setTexturePriorities(priorityCalculator); 594 textureManager->prioritizeTextures(0); 595 layer->updateLayerRect(updater, contentRect, 0); 596 597 // Empty layers don't have tiles. 598 EXPECT_EQ(0u, layer->numPaintedTiles()); 599 600 // Empty layers don't need prepaint. 601 EXPECT_FALSE(layer->needsIdlePaint(contentRect)); 602 603 layer->pushPropertiesTo(layerImpl.get()); 604 605 // Empty layers don't have tiles. 606 EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); 607 608 // Non-visible layers don't idle paint. 609 layer->idleUpdateLayerRect(updater, contentRect, 0); 610 611 // Empty layers don't have tiles. 612 EXPECT_EQ(0u, layer->numPaintedTiles()); 613 614 layer->pushPropertiesTo(layerImpl.get()); 615 616 // Empty layers don't have tiles. 617 EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); 538 bool animating[2] = {false, true}; 539 for (int i = 0; i < 2; i++) { 540 // Pretend the layer is animating. 541 layer->setDrawTransformIsAnimating(animating[i]); 542 543 // The layer's bounds are empty. 544 IntRect contentRect; 545 546 layer->setBounds(contentRect.size()); 547 layer->setVisibleLayerRect(contentRect); 548 layer->invalidateRect(contentRect); 549 550 layer->setTexturePriorities(priorityCalculator); 551 textureManager->prioritizeTextures(0); 552 553 // Empty layers don't paint or idle-paint. 554 layer->updateLayerRect(updater, contentRect, 0); 555 556 // Empty layers don't have tiles. 557 EXPECT_EQ(0u, layer->numPaintedTiles()); 558 559 // Empty layers don't need prepaint. 560 EXPECT_FALSE(layer->needsIdlePaint(contentRect)); 561 562 layer->pushPropertiesTo(layerImpl.get()); 563 564 // Empty layers don't have tiles. 565 EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); 566 } 618 567 } 619 568 … … 635 584 layer->invalidateRect(contentRect); 636 585 637 layer->setTexturePriorities(priorityCalculator); 638 textureManager->prioritizeTextures(0); 639 layer->updateLayerRect(updater, visibleRect, 0); 640 641 // Non-visible layers don't need idle paint. 642 EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); 643 644 layer->pushPropertiesTo(layerImpl.get()); 645 646 // We should not have any tiles pushed since the layer is not visible. 647 EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); 648 649 // Non-visible layers don't idle paint. 650 layer->idleUpdateLayerRect(updater, visibleRect, 0); 651 652 layer->pushPropertiesTo(layerImpl.get()); 653 654 // We should not have any tiles pushed since the layer is not visible. 655 EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); 586 for (int i = 0; i < 2; i++) { 587 // Paint / idle-paint. 588 layer->setTexturePriorities(priorityCalculator); 589 textureManager->prioritizeTextures(0); 590 layer->updateLayerRect(updater, visibleRect, 0); 591 592 // Non-visible layers don't need idle paint. 593 EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); 594 595 layer->pushPropertiesTo(layerImpl.get()); 596 597 // We should not have any tiles pushed since the layer is not visible. 598 EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); 599 } 656 600 } 657 601 … … 699 643 bool shouldPrepaint = !layer->idlePaintRect(visibleRect).isEmpty(); 700 644 701 // This paints the layer but there's nothing visible so it's a no-op.702 layer->updateLayerRect(updater, visibleRect, 0);703 // This drops all the tile objects since they were not painted.704 updateTextures();705 layer->pushPropertiesTo(layerImpl.get());706 707 // We should not have any tiles pushed yet since the layer is not visible and we've not prepainted.708 testHaveOuterTiles(layerImpl.get(), width[i], height[j], 0);709 710 // Set priorities and recreate tiles.711 layer->setTexturePriorities(priorityCalculator);712 textureManager->prioritizeTextures(0);713 714 645 // Normally we don't allow non-visible layers to pre-paint, but if they are animating then we should. 715 646 EXPECT_EQ(shouldPrepaint, layer->needsIdlePaint(visibleRect)); … … 721 652 722 653 layer->updateLayerRect(updater, visibleRect, 0); 723 layer->idleUpdateLayerRect(updater, visibleRect, 0);724 654 updateTextures(); 725 655 layer->pushPropertiesTo(layerImpl.get()); 726 656 } 657 727 658 testHaveOuterTiles(layerImpl.get(), width[i], height[j], shouldPrepaint ? 1 : 0); 728 659 … … 734 665 735 666 layer->updateLayerRect(updater, visibleRect, 0); 736 layer->idleUpdateLayerRect(updater, visibleRect, 0);737 667 updateTextures(); 738 668 layer->pushPropertiesTo(layerImpl.get()); 739 669 } 670 740 671 testHaveOuterTiles(layerImpl.get(), width[i], height[j], shouldPrepaint ? 1 : 0); 741 672 } … … 1244 1175 layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); 1245 1176 1246 // Repaint without marking it dirty. The culled tiles remained dirty.1177 // Repaint without marking it dirty. The 3 culled tiles will be pre-painted now. 1247 1178 layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); 1248 EXPECT_EQ( 0, layer->fakeLayerTextureUpdater()->prepareRectCount());1179 EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->prepareRectCount()); 1249 1180 1250 1181 EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); … … 1437 1368 EXPECT_EQ(1u, opaqueContents.rects().size()); 1438 1369 1439 EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1 + 1, 1);1440 EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 17100, 1);1441 EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 20000 + 20000 - 17100 + 1 + 1, 1);1442 EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());1443 1444 // No metrics are recorded in prepaint, so the values should not change from above.1445 layer->idleUpdateLayerRect(updater, contentBounds, &occluded);1446 updateTextures();1447 1370 EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1 + 1, 1); 1448 1371 EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 17100, 1);
Note: See TracChangeset
for help on using the changeset viewer.