Diff
Modified: trunk/Source/WebCore/ChangeLog (122184 => 122185)
--- trunk/Source/WebCore/ChangeLog 2012-07-10 02:16:27 UTC (rev 122184)
+++ trunk/Source/WebCore/ChangeLog 2012-07-10 02:29:15 UTC (rev 122185)
@@ -1,3 +1,37 @@
+2012-07-09 Eric Penner <[email protected]>
+
+ [chromium] Merge updates and idle updates into one pass
+ https://bugs.webkit.org/show_bug.cgi?id=90324
+
+ Reviewed by Adrienne Walker.
+
+ We no longer need to do painting is passes in order
+ to allocate memory in the right order. So this merges
+ updates and idle updates into one pass.
+
+ Covered by existing unit tests (some of which are
+ updated with this patch).
+
+ * platform/graphics/chromium/ContentLayerChromium.cpp:
+ (WebCore::ContentLayerChromium::needMoreUpdates):
+ * platform/graphics/chromium/ContentLayerChromium.h:
+ (ContentLayerChromium):
+ * platform/graphics/chromium/LayerChromium.h:
+ (WebCore::LayerChromium::needMoreUpdates):
+ * platform/graphics/chromium/TiledLayerChromium.cpp:
+ (WebCore::TiledLayerChromium::updateTiles):
+ (WebCore::TiledLayerChromium::updateLayerRect):
+ * platform/graphics/chromium/TiledLayerChromium.h:
+ (TiledLayerChromium):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+ (WebCore::CCLayerTreeHost::CCLayerTreeHost):
+ (WebCore::CCLayerTreeHost::compositeAndReadback):
+ (WebCore::CCLayerTreeHost::updateLayers):
+ (WebCore::CCLayerTreeHost::paintMasksForRenderSurface):
+ (WebCore::CCLayerTreeHost::paintLayerContents):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+ (CCLayerTreeHost):
+
2012-07-09 Yoshifumi Inoue <[email protected]>
[Platform] Introduce LocaleMac class
Modified: trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp (122184 => 122185)
--- trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp 2012-07-10 02:16:27 UTC (rev 122184)
+++ trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp 2012-07-10 02:29:15 UTC (rev 122185)
@@ -108,15 +108,11 @@
m_needsDisplay = false;
}
-void ContentLayerChromium::idleUpdate(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion)
+bool ContentLayerChromium::needMoreUpdates()
{
if (!drawsContent())
- return;
-
- const IntRect layerRect = visibleLayerRect();
- idleUpdateLayerRect(updater, layerRect, occlusion);
- if (needsIdlePaint(layerRect))
- setNeedsCommit();
+ return false;
+ return needsIdlePaint(visibleLayerRect());
}
void ContentLayerChromium::createTextureUpdaterIfNeeded()
Modified: trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h (122184 => 122185)
--- trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h 2012-07-10 02:16:27 UTC (rev 122184)
+++ trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h 2012-07-10 02:29:15 UTC (rev 122185)
@@ -78,7 +78,7 @@
virtual bool drawsContent() const OVERRIDE;
virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) OVERRIDE;
- virtual void idleUpdate(CCTextureUpdater&, const CCOcclusionTracker*) OVERRIDE;
+ virtual bool needMoreUpdates() OVERRIDE;
virtual void setOpaque(bool) OVERRIDE;
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h (122184 => 122185)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2012-07-10 02:16:27 UTC (rev 122184)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2012-07-10 02:29:15 UTC (rev 122185)
@@ -211,7 +211,7 @@
// These methods typically need to be overwritten by derived classes.
virtual bool drawsContent() const { return m_isDrawable; }
virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) { }
- virtual void idleUpdate(CCTextureUpdater&, const CCOcclusionTracker*) { }
+ virtual bool needMoreUpdates() { return false; }
virtual void setIsMask(bool) { }
virtual void bindContentsTexture() { }
virtual bool needsContentsScale() const { return false; }
Modified: trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp (122184 => 122185)
--- trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp 2012-07-10 02:16:27 UTC (rev 122184)
+++ trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp 2012-07-10 02:29:15 UTC (rev 122185)
@@ -350,6 +350,9 @@
{
createTextureUpdaterIfNeeded();
+ // We shouldn't track any occlusion metrics during idle painting.
+ ASSERT(!idle || !occlusion);
+
// Create tiles as needed, expanding a dirty rect to contain all
// the dirty regions currently being drawn. All dirty tiles that are to be painted
// get their updateRect set to dirtyRect and dirtyRect cleared. This way if
@@ -608,7 +611,7 @@
}
}
-void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRect& layerRect, const CCOcclusionTracker* occlusion)
+void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRect& contentRect, const CCOcclusionTracker* occlusion)
{
m_skipsDraw = false;
m_skipsIdlePaint = false;
@@ -616,37 +619,30 @@
updateBounds();
- if (layerRect.isEmpty() || m_tiler->hasEmptyBounds())
+ if (m_tiler->hasEmptyBounds())
return;
- int left, top, right, bottom;
- m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom);
+ // Visible painting. Only paint visible tiles if the visible rect isn't empty.
+ if (!contentRect.isEmpty()) {
+ int left, top, right, bottom;
+ m_tiler->layerRectToTileIndices(contentRect, left, top, right, bottom);
+ updateTiles(false, left, top, right, bottom, updater, occlusion);
+ }
- updateTiles(false, left, top, right, bottom, updater, occlusion);
-}
-
-void TiledLayerChromium::idleUpdateLayerRect(CCTextureUpdater& updater, const IntRect& layerRect, const CCOcclusionTracker* occlusion)
-{
// Abort if we have already painted or run out of memory.
if (m_skipsIdlePaint || m_didPaint)
return;
- ASSERT(m_tiler);
-
- updateBounds();
-
- if (m_tiler->hasEmptyBounds())
+ // If we have already painting everything visible. Do some pre-painting while idle.
+ IntRect idlePaintContentRect = idlePaintRect(contentRect);
+ if (idlePaintContentRect.isEmpty())
return;
- IntRect idlePaintLayerRect = idlePaintRect(layerRect);
- if (idlePaintLayerRect.isEmpty())
- return;
-
int prepaintLeft, prepaintTop, prepaintRight, prepaintBottom;
- m_tiler->layerRectToTileIndices(idlePaintLayerRect, prepaintLeft, prepaintTop, prepaintRight, prepaintBottom);
+ m_tiler->layerRectToTileIndices(idlePaintContentRect, prepaintLeft, prepaintTop, prepaintRight, prepaintBottom);
// If the layer is not visible, we have nothing to expand from, so instead we prepaint the outer-most set of tiles.
- if (layerRect.isEmpty()) {
+ if (contentRect.isEmpty()) {
updateTiles(true, prepaintLeft, prepaintTop, prepaintRight, prepaintTop, updater, 0);
if (m_didPaint || m_skipsIdlePaint)
return;
@@ -661,7 +657,7 @@
}
int left, top, right, bottom;
- m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom);
+ m_tiler->layerRectToTileIndices(contentRect, left, top, right, bottom);
// Otherwise, prepaint anything that was occluded but inside the layer's visible region.
updateTiles(true, left, top, right, bottom, updater, 0);
@@ -697,7 +693,7 @@
}
}
-bool TiledLayerChromium::needsIdlePaint(const IntRect& layerRect)
+bool TiledLayerChromium::needsIdlePaint(const IntRect& contentRect)
{
if (m_skipsIdlePaint)
return false;
@@ -705,17 +701,17 @@
if (m_tiler->hasEmptyBounds())
return false;
- IntRect idlePaintLayerRect = idlePaintRect(layerRect);
- if (idlePaintLayerRect.isEmpty())
+ IntRect idlePaintContentRect = idlePaintRect(contentRect);
+ if (idlePaintContentRect.isEmpty())
return false;
int left, top, right, bottom;
- m_tiler->layerRectToTileIndices(idlePaintLayerRect, left, top, right, bottom);
+ m_tiler->layerRectToTileIndices(idlePaintContentRect, left, top, right, bottom);
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
// If the layerRect is empty, then we are painting the outer-most set of tiles only.
- if (layerRect.isEmpty() && i != left && i != right && j != top && j != bottom)
+ if (contentRect.isEmpty() && i != left && i != right && j != top && j != bottom)
continue;
UpdatableTile* tile = tileAt(i, j);
ASSERT(tile); // Did setTexturePriorities get skipped?
@@ -732,14 +728,14 @@
return false;
}
-IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleLayerRect)
+IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleRect)
{
IntRect contentRect(IntPoint::zero(), contentBounds());
// For layers that are animating transforms but not visible at all, we don't know what part
// of them is going to become visible. For small layers we return the entire layer, for larger
// ones we avoid prepainting the layer at all.
- if (visibleLayerRect.isEmpty()) {
+ if (visibleRect.isEmpty()) {
bool isSmallLayer = m_tiler->numTilesX() <= 9 && m_tiler->numTilesY() <= 9 && m_tiler->numTilesX() * m_tiler->numTilesY() <= 9;
if ((drawTransformIsAnimating() || screenSpaceTransformIsAnimating()) && isSmallLayer)
return contentRect;
@@ -748,7 +744,7 @@
// FIXME: This can be made a lot larger now! We should increase
// this slowly while insuring it doesn't cause any perf issues.
- IntRect prepaintRect = visibleLayerRect;
+ IntRect prepaintRect = visibleRect;
prepaintRect.inflateX(m_tiler->tileSize().width());
prepaintRect.inflateY(m_tiler->tileSize().height() * 2);
prepaintRect.intersect(contentRect);
Modified: trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h (122184 => 122185)
--- trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h 2012-07-10 02:16:27 UTC (rev 122184)
+++ trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h 2012-07-10 02:29:15 UTC (rev 122185)
@@ -85,10 +85,7 @@
// Prepare data needed to update textures that intersect with layerRect.
void updateLayerRect(CCTextureUpdater&, const IntRect& layerRect, const CCOcclusionTracker*);
- // Same as above, but this will try to paint additional surrounding content if idle.
- void idleUpdateLayerRect(CCTextureUpdater&, const IntRect& layerRect, const CCOcclusionTracker*);
-
- // After preparing an update, returns true if more pre-painting is needed.
+ // After preparing an update, returns true if more painting is needed.
bool needsIdlePaint(const IntRect& layerRect);
IntRect idlePaintRect(const IntRect& visibleLayerRect);
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (122184 => 122185)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2012-07-10 02:16:27 UTC (rev 122184)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2012-07-10 02:29:15 UTC (rev 122185)
@@ -85,7 +85,7 @@
, m_pageScaleFactor(1)
, m_minPageScaleFactor(1)
, m_maxPageScaleFactor(1)
- , m_triggerIdlePaints(true)
+ , m_triggerIdleUpdates(true)
, m_backgroundColor(SK_ColorWHITE)
, m_hasTransparentBackground(false)
, m_partialTextureUpdateRequests(0)
@@ -288,9 +288,9 @@
bool CCLayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect)
{
- m_triggerIdlePaints = false;
+ m_triggerIdleUpdates = false;
bool ret = m_proxy->compositeAndReadback(pixels, rect);
- m_triggerIdlePaints = true;
+ m_triggerIdleUpdates = true;
return ret;
}
@@ -492,15 +492,10 @@
prioritizeTextures(updateList);
- paintLayerContents(updateList, PaintVisible, updater);
+ bool needMoreUpdates = paintLayerContents(updateList, updater);
+ if (m_triggerIdleUpdates && needMoreUpdates)
+ setNeedsCommit();
- if (m_triggerIdlePaints) {
- // The second (idle) paint will be a no-op in layers where painting already occured above.
- // FIXME: This pass can be merged with the visible pass now that textures
- // are prioritized above.
- paintLayerContents(updateList, PaintIdle, updater);
- }
-
for (size_t i = 0; i < updateList.size(); ++i)
updateList[i]->clearRenderSurface();
}
@@ -550,37 +545,33 @@
m_contentsTextureManager->prioritizeTextures(renderSurfacesBytes);
}
-// static
-void CCLayerTreeHost::update(LayerChromium* layer, PaintType paintType, CCTextureUpdater& updater, const CCOcclusionTracker* occlusion)
+bool CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLayer, CCTextureUpdater& updater)
{
- ASSERT(layer);
- ASSERT(PaintVisible == paintType || PaintIdle == paintType);
- if (PaintVisible == paintType)
- layer->update(updater, occlusion);
- else
- layer->idleUpdate(updater, occlusion);
-}
-
-void CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLayer, PaintType paintType, CCTextureUpdater& updater)
-{
// Note: Masks and replicas only exist for layers that own render surfaces. If we reach this point
// in code, we already know that at least something will be drawn into this render surface, so the
// mask and replica should be painted.
+ bool needMoreUpdates = false;
LayerChromium* maskLayer = renderSurfaceLayer->maskLayer();
- if (maskLayer)
- update(maskLayer, paintType, updater, 0);
+ if (maskLayer) {
+ maskLayer->update(updater, 0);
+ needMoreUpdates |= maskLayer->needMoreUpdates();
+ }
LayerChromium* replicaMaskLayer = renderSurfaceLayer->replicaLayer() ? renderSurfaceLayer->replicaLayer()->maskLayer() : 0;
- if (replicaMaskLayer)
- update(replicaMaskLayer, paintType, updater, 0);
+ if (replicaMaskLayer) {
+ replicaMaskLayer->update(updater, 0);
+ needMoreUpdates |= replicaMaskLayer->needMoreUpdates();
+ }
+ return needMoreUpdates;
}
-void CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, PaintType paintType, CCTextureUpdater& updater)
+bool CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, CCTextureUpdater& updater)
{
// Use FrontToBack to allow for testing occlusion and performing culling during the tree walk.
typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> CCLayerIteratorType;
+ bool needMoreUpdates = false;
bool recordMetricsForFrame = true; // FIXME: In the future, disable this when about:tracing is off.
CCOcclusionTracker occlusionTracker(IntRect(IntPoint(), deviceViewportSize()), recordMetricsForFrame);
occlusionTracker.setMinimumTrackingSize(CCOcclusionTracker::preferredMinimumTrackingSize());
@@ -591,10 +582,11 @@
if (it.representsTargetRenderSurface()) {
ASSERT(it->renderSurface()->drawOpacity() || it->renderSurface()->drawOpacityIsAnimating());
- paintMasksForRenderSurface(*it, paintType, updater);
+ needMoreUpdates |= paintMasksForRenderSurface(*it, updater);
} else if (it.representsItself()) {
ASSERT(!it->bounds().isEmpty());
- update(*it, paintType, updater, &occlusionTracker);
+ it->update(updater, &occlusionTracker);
+ needMoreUpdates |= it->needMoreUpdates();
}
occlusionTracker.leaveLayer(it);
@@ -603,6 +595,8 @@
occlusionTracker.overdrawMetrics().didUseContentsTextureMemoryBytes(m_contentsTextureManager->memoryAboveCutoffBytes());
occlusionTracker.overdrawMetrics().didUseRenderSurfaceTextureMemoryBytes(m_contentsTextureManager->memoryForRenderSurfacesBytes());
occlusionTracker.overdrawMetrics().recordMetrics(this);
+
+ return needMoreUpdates;
}
static LayerChromium* findFirstScrollableLayer(LayerChromium* layer)
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (122184 => 122185)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2012-07-10 02:16:27 UTC (rev 122184)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2012-07-10 02:29:15 UTC (rev 122185)
@@ -278,10 +278,9 @@
void initializeLayerRenderer();
- enum PaintType { PaintVisible, PaintIdle };
- static void update(LayerChromium*, PaintType, CCTextureUpdater&, const CCOcclusionTracker*);
- void paintLayerContents(const LayerList&, PaintType, CCTextureUpdater&);
- void paintMasksForRenderSurface(LayerChromium*, PaintType, CCTextureUpdater&);
+ static void update(LayerChromium*, CCTextureUpdater&, const CCOcclusionTracker*);
+ bool paintLayerContents(const LayerList&, CCTextureUpdater&);
+ bool paintMasksForRenderSurface(LayerChromium*, CCTextureUpdater&);
void updateLayers(LayerChromium*, CCTextureUpdater&);
@@ -323,7 +322,8 @@
float m_pageScaleFactor;
float m_minPageScaleFactor, m_maxPageScaleFactor;
- bool m_triggerIdlePaints;
+ bool m_triggerIdleUpdates;
+
SkColor m_backgroundColor;
bool m_hasTransparentBackground;
Modified: trunk/Source/WebKit/chromium/ChangeLog (122184 => 122185)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-07-10 02:16:27 UTC (rev 122184)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-07-10 02:29:15 UTC (rev 122185)
@@ -1,3 +1,19 @@
+2012-07-09 Eric Penner <[email protected]>
+
+ [chromium] Merge updates and idle updates into one pass
+ https://bugs.webkit.org/show_bug.cgi?id=90324
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::ContentLayerChromiumWithUpdateTracking::resetPaintContentsCount):
+ (WTF::ContentLayerChromiumWithUpdateTracking::ContentLayerChromiumWithUpdateTracking):
+ (ContentLayerChromiumWithUpdateTracking):
+ (WTF::CCLayerTreeHostTestOpacityChange::afterTest):
+ * tests/CCTiledLayerTestCommon.h:
+ (FakeTiledLayerChromium):
+ * tests/TiledLayerChromiumTest.cpp:
+
2012-07-09 Yoshifumi Inoue <[email protected]>
[Platform] Introduce LocaleMac class
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (122184 => 122185)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-07-10 02:16:27 UTC (rev 122184)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-07-10 02:29:15 UTC (rev 122185)
@@ -1158,8 +1158,7 @@
static PassRefPtr<ContentLayerChromiumWithUpdateTracking> create(ContentLayerDelegate *delegate) { return adoptRef(new ContentLayerChromiumWithUpdateTracking(delegate)); }
int paintContentsCount() { return m_paintContentsCount; }
- int idlePaintContentsCount() { return m_idlePaintContentsCount; }
- void resetPaintContentsCount() { m_paintContentsCount = 0; m_idlePaintContentsCount = 0;}
+ void resetPaintContentsCount() { m_paintContentsCount = 0; }
virtual void update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) OVERRIDE
{
@@ -1167,24 +1166,16 @@
m_paintContentsCount++;
}
- virtual void idleUpdate(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) OVERRIDE
- {
- ContentLayerChromium::idleUpdate(updater, occlusion);
- m_idlePaintContentsCount++;
- }
-
private:
explicit ContentLayerChromiumWithUpdateTracking(ContentLayerDelegate* delegate)
: ContentLayerChromium(delegate)
, m_paintContentsCount(0)
- , m_idlePaintContentsCount(0)
{
setBounds(IntSize(10, 10));
setIsDrawable(true);
}
int m_paintContentsCount;
- int m_idlePaintContentsCount;
};
// Layer opacity change during paint should not prevent compositor resources from being updated during commit.
@@ -1214,9 +1205,6 @@
// update() should have been called once.
EXPECT_EQ(1, m_updateCheckLayer->paintContentsCount());
- // idleUpdate() should have been called once
- EXPECT_EQ(1, m_updateCheckLayer->idlePaintContentsCount());
-
// clear m_updateCheckLayer so CCLayerTreeHost dies.
m_updateCheckLayer.clear();
}
Modified: trunk/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h (122184 => 122185)
--- trunk/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h 2012-07-10 02:16:27 UTC (rev 122184)
+++ trunk/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h 2012-07-10 02:29:15 UTC (rev 122185)
@@ -112,7 +112,6 @@
using WebCore::TiledLayerChromium::invalidateRect;
using WebCore::TiledLayerChromium::updateLayerRect;
- using WebCore::TiledLayerChromium::idleUpdateLayerRect;
using WebCore::TiledLayerChromium::needsIdlePaint;
using WebCore::TiledLayerChromium::skipsDraw;
using WebCore::TiledLayerChromium::numPaintedTiles;
Modified: trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp (122184 => 122185)
--- trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp 2012-07-10 02:16:27 UTC (rev 122184)
+++ trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp 2012-07-10 02:29:15 UTC (rev 122185)
@@ -259,7 +259,6 @@
layer->updateLayerRect(updater, visibleRect, 0);
EXPECT_TRUE(layer->needsIdlePaint(visibleRect));
- layer->idleUpdateLayerRect(updater, visibleRect, 0);
updateTextures();
layer->pushPropertiesTo(layerImpl.get());
}
@@ -328,7 +327,6 @@
layer1->setTexturePriorities(priorityCalculator);
textureManager->prioritizeTextures(0);
layer2->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0);
- layer2->idleUpdateLayerRect(updater, layer2Rect, 0);
// Oh well, commit the frame and push.
updateTextures();
@@ -382,7 +380,6 @@
layer->setTexturePriorities(priorityCalculator);
textureManager->prioritizeTextures(0);
layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded);
- layer->idleUpdateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded);
updateTextures();
layer->pushPropertiesTo(layerImpl.get());
@@ -526,7 +523,6 @@
layer->setTexturePriorities(priorityCalculator);
textureManager->prioritizeTextures(0);
layer->updateLayerRect(updater, visibleRect, 0);
- layer->idleUpdateLayerRect(updater, visibleRect, 0);
// We shouldn't signal we need another idle paint.
EXPECT_FALSE(layer->needsIdlePaint(visibleRect));
@@ -539,84 +535,37 @@
DebugScopedSetImplThread implThread;
OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
- // The layer's bounds are empty.
- IntRect contentRect;
+ bool animating[2] = {false, true};
+ for (int i = 0; i < 2; i++) {
+ // Pretend the layer is animating.
+ layer->setDrawTransformIsAnimating(animating[i]);
- layer->setBounds(contentRect.size());
- layer->setVisibleLayerRect(contentRect);
- layer->invalidateRect(contentRect);
+ // The layer's bounds are empty.
+ IntRect contentRect;
- layer->setTexturePriorities(priorityCalculator);
- textureManager->prioritizeTextures(0);
- layer->updateLayerRect(updater, contentRect, 0);
+ layer->setBounds(contentRect.size());
+ layer->setVisibleLayerRect(contentRect);
+ layer->invalidateRect(contentRect);
- // Empty layers don't have tiles.
- EXPECT_EQ(0u, layer->numPaintedTiles());
+ layer->setTexturePriorities(priorityCalculator);
+ textureManager->prioritizeTextures(0);
- // Empty layers don't need prepaint.
- EXPECT_FALSE(layer->needsIdlePaint(contentRect));
+ // Empty layers don't paint or idle-paint.
+ layer->updateLayerRect(updater, contentRect, 0);
- layer->pushPropertiesTo(layerImpl.get());
+ // Empty layers don't have tiles.
+ EXPECT_EQ(0u, layer->numPaintedTiles());
- // Empty layers don't have tiles.
- EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
+ // Empty layers don't need prepaint.
+ EXPECT_FALSE(layer->needsIdlePaint(contentRect));
- // Non-visible layers don't idle paint.
- layer->idleUpdateLayerRect(updater, contentRect, 0);
+ layer->pushPropertiesTo(layerImpl.get());
- // Empty layers don't have tiles.
- EXPECT_EQ(0u, layer->numPaintedTiles());
-
- layer->pushPropertiesTo(layerImpl.get());
-
- // Empty layers don't have tiles.
- EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
+ // Empty layers don't have tiles.
+ EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
+ }
}
-TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedAnimatingLayer)
-{
- OwnPtr<CCPrioritizedTextureManager> textureManager = CCPrioritizedTextureManager::create(20000, 1024);
- RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
- DebugScopedSetImplThread implThread;
- OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1)));
-
- // Pretend the layer is animating.
- layer->setDrawTransformIsAnimating(true);
-
- // The layer's bounds are empty.
- IntRect contentRect;
-
- layer->setBounds(contentRect.size());
- layer->setVisibleLayerRect(contentRect);
- layer->invalidateRect(contentRect);
-
- layer->setTexturePriorities(priorityCalculator);
- textureManager->prioritizeTextures(0);
- layer->updateLayerRect(updater, contentRect, 0);
-
- // Empty layers don't have tiles.
- EXPECT_EQ(0u, layer->numPaintedTiles());
-
- // Empty layers don't need prepaint.
- EXPECT_FALSE(layer->needsIdlePaint(contentRect));
-
- layer->pushPropertiesTo(layerImpl.get());
-
- // Empty layers don't have tiles.
- EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
-
- // Non-visible layers don't idle paint.
- layer->idleUpdateLayerRect(updater, contentRect, 0);
-
- // Empty layers don't have tiles.
- EXPECT_EQ(0u, layer->numPaintedTiles());
-
- layer->pushPropertiesTo(layerImpl.get());
-
- // Empty layers don't have tiles.
- EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
-}
-
TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers)
{
IntSize contentBounds(100, 100);
@@ -634,25 +583,20 @@
layer->setVisibleLayerRect(visibleRect);
layer->invalidateRect(contentRect);
- layer->setTexturePriorities(priorityCalculator);
- textureManager->prioritizeTextures(0);
- layer->updateLayerRect(updater, visibleRect, 0);
+ for (int i = 0; i < 2; i++) {
+ // Paint / idle-paint.
+ layer->setTexturePriorities(priorityCalculator);
+ textureManager->prioritizeTextures(0);
+ layer->updateLayerRect(updater, visibleRect, 0);
- // Non-visible layers don't need idle paint.
- EXPECT_FALSE(layer->needsIdlePaint(visibleRect));
+ // Non-visible layers don't need idle paint.
+ EXPECT_FALSE(layer->needsIdlePaint(visibleRect));
- layer->pushPropertiesTo(layerImpl.get());
+ layer->pushPropertiesTo(layerImpl.get());
- // We should not have any tiles pushed since the layer is not visible.
- EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
-
- // Non-visible layers don't idle paint.
- layer->idleUpdateLayerRect(updater, visibleRect, 0);
-
- layer->pushPropertiesTo(layerImpl.get());
-
- // We should not have any tiles pushed since the layer is not visible.
- EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
+ // We should not have any tiles pushed since the layer is not visible.
+ EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
+ }
}
static void testHaveOuterTiles(FakeCCTiledLayerImpl* layerImpl, int width, int height, int have)
@@ -698,19 +642,6 @@
// we shoud paint nothing.
bool shouldPrepaint = !layer->idlePaintRect(visibleRect).isEmpty();
- // This paints the layer but there's nothing visible so it's a no-op.
- layer->updateLayerRect(updater, visibleRect, 0);
- // This drops all the tile objects since they were not painted.
- updateTextures();
- layer->pushPropertiesTo(layerImpl.get());
-
- // We should not have any tiles pushed yet since the layer is not visible and we've not prepainted.
- testHaveOuterTiles(layerImpl.get(), width[i], height[j], 0);
-
- // Set priorities and recreate tiles.
- layer->setTexturePriorities(priorityCalculator);
- textureManager->prioritizeTextures(0);
-
// Normally we don't allow non-visible layers to pre-paint, but if they are animating then we should.
EXPECT_EQ(shouldPrepaint, layer->needsIdlePaint(visibleRect));
@@ -720,10 +651,10 @@
textureManager->prioritizeTextures(0);
layer->updateLayerRect(updater, visibleRect, 0);
- layer->idleUpdateLayerRect(updater, visibleRect, 0);
updateTextures();
layer->pushPropertiesTo(layerImpl.get());
}
+
testHaveOuterTiles(layerImpl.get(), width[i], height[j], shouldPrepaint ? 1 : 0);
// We don't currently idle paint past the outermost tiles.
@@ -733,10 +664,10 @@
textureManager->prioritizeTextures(0);
layer->updateLayerRect(updater, visibleRect, 0);
- layer->idleUpdateLayerRect(updater, visibleRect, 0);
updateTextures();
layer->pushPropertiesTo(layerImpl.get());
}
+
testHaveOuterTiles(layerImpl.get(), width[i], height[j], shouldPrepaint ? 1 : 0);
}
}
@@ -1243,9 +1174,9 @@
layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
- // Repaint without marking it dirty. The culled tiles remained dirty.
+ // Repaint without marking it dirty. The 3 culled tiles will be pre-painted now.
layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded);
- EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareRectCount());
+ EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->prepareRectCount());
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 330000, 1);
@@ -1440,14 +1371,6 @@
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 17100, 1);
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 20000 + 20000 - 17100 + 1 + 1, 1);
EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
-
- // No metrics are recorded in prepaint, so the values should not change from above.
- layer->idleUpdateLayerRect(updater, contentBounds, &occluded);
- updateTextures();
- EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1 + 1, 1);
- EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 17100, 1);
- EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedTranslucent(), 20000 + 20000 - 17100 + 1 + 1, 1);
- EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
}
TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics)