Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3601)

Unified Diff: cc/layers/tiled_layer_unittest.cc

Issue 12426024: cc: Switch RenderingStats collection in Layer::Update() to RenderingStatsInstrumentation (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/layers/tiled_layer_unittest.cc
diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc
index 4a4d54beb4fa9d1c527b59fe63cf9b9d6239f6fd..f04e32d75368e3105c115ac3c044d8f39a613b06 100644
--- a/cc/layers/tiled_layer_unittest.cc
+++ b/cc/layers/tiled_layer_unittest.cc
@@ -14,6 +14,7 @@
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_proxy.h"
+#include "cc/test/fake_rendering_stats_instrumentation.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/tiled_layer_test_common.h"
#include "cc/trees/single_thread_proxy.h" // For DebugScopedSetImplThread
@@ -107,7 +108,7 @@ public:
void layerUpdate(FakeTiledLayer* layer, TestOcclusionTracker* occluded)
{
DebugScopedSetMainThread mainThread(proxy_);
- layer->Update(m_queue.get(), occluded, NULL);
+ layer->Update(m_queue.get(), occluded);
}
void calcDrawProps(const scoped_refptr<FakeTiledLayer>& layer1)
@@ -160,9 +161,9 @@ public:
// Update content
if (layer1)
- layer1->Update(m_queue.get(), m_occlusion, NULL);
+ layer1->Update(m_queue.get(), m_occlusion);
if (layer2)
- layer2->Update(m_queue.get(), m_occlusion, NULL);
+ layer2->Update(m_queue.get(), m_occlusion);
bool needsUpdate = false;
if (layer1)
@@ -574,7 +575,7 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
// if it is close to the viewport size and has the available memory.
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), 0, NULL);
+ layer->Update(m_queue.get(), 0);
updateTextures();
layerPushPropertiesTo(layer.get(), layerImpl.get());
@@ -731,7 +732,7 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), 0, NULL);
+ layer->Update(m_queue.get(), 0);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 300, 300 * 0.8), layer->update_rect());
updateTextures();
@@ -739,7 +740,7 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
layer->InvalidateContentRect(contentBounds);
- layer->Update(m_queue.get(), 0, NULL);
+ layer->Update(m_queue.get(), 0);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(layerBounds), layer->update_rect());
updateTextures();
@@ -748,7 +749,7 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
layer->InvalidateContentRect(partialDamage);
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), 0, NULL);
+ layer->Update(m_queue.get(), 0);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(45, 80, 15, 8), layer->update_rect());
}
@@ -766,7 +767,7 @@ TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
// Push the tiles to the impl side and check that there is exactly one.
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), 0, NULL);
+ layer->Update(m_queue.get(), 0);
updateTextures();
layerPushPropertiesTo(layer.get(), layerImpl.get());
EXPECT_TRUE(layerImpl->HasResourceIdForTileAt(0, 0));
@@ -784,7 +785,7 @@ TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
// The impl side should get 2x2 tiles now.
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), 0, NULL);
+ layer->Update(m_queue.get(), 0);
updateTextures();
layerPushPropertiesTo(layer.get(), layerImpl.get());
EXPECT_TRUE(layerImpl->HasResourceIdForTileAt(0, 0));
@@ -862,7 +863,7 @@ TEST_F(TiledLayerTest, resizeToSmaller)
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), 0, NULL);
+ layer->Update(m_queue.get(), 0);
layer->SetBounds(gfx::Size(200, 200));
layer->InvalidateContentRect(gfx::Rect(0, 0, 200, 200));
@@ -880,7 +881,7 @@ TEST_F(TiledLayerTest, hugeLayerUpdateCrash)
// Ensure no crash for bounds where size * size would overflow an int.
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), 0, NULL);
+ layer->Update(m_queue.get(), 0);
}
class TiledLayerPartialUpdateTest : public TiledLayerTest {
@@ -1003,7 +1004,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithoutOcclusion)
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), 0, NULL);
+ layer->Update(m_queue.get(), 0);
EXPECT_EQ(2, layer->fake_layer_updater()->update_count());
}
@@ -1026,7 +1027,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
EXPECT_EQ(36-3, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1039,7 +1040,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
occluded.setOcclusion(gfx::Rect(250, 200, 300, 100));
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
EXPECT_EQ(36-2, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1052,7 +1053,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
occluded.setOcclusion(gfx::Rect(250, 250, 300, 100));
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
EXPECT_EQ(36, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1080,7 +1081,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
EXPECT_EQ(24-3, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1096,7 +1097,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
EXPECT_EQ(24-6, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1112,7 +1113,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
EXPECT_EQ(24-6, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1139,7 +1140,7 @@ TEST_F(TiledLayerTest, tilesNotPaintedWithoutInvalidation)
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
EXPECT_EQ(36-3, layer->fake_layer_updater()->update_count());
{
updateTextures();
@@ -1154,7 +1155,7 @@ TEST_F(TiledLayerTest, tilesNotPaintedWithoutInvalidation)
resource_manager_->PrioritizeTextures();
// Repaint without marking it dirty. The 3 culled tiles will be pre-painted now.
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
EXPECT_EQ(3, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1186,7 +1187,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndTransforms)
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
EXPECT_EQ(36-3, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1222,7 +1223,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
// The content is half the size of the layer (so the number of tiles is fewer).
// In this case, the content is 300x300, and since the tile size is 100, the
// number of tiles 3x3.
@@ -1243,7 +1244,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
EXPECT_EQ(9-1, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1266,7 +1267,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
EXPECT_EQ(9-1, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1299,7 +1300,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
layer->InvalidateContentRect(contentBounds);
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
opaqueContents = layer->VisibleContentOpaqueRegion();
EXPECT_TRUE(opaqueContents.IsEmpty());
@@ -1314,7 +1315,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
layer->InvalidateContentRect(contentBounds);
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
updateTextures();
opaqueContents = layer->VisibleContentOpaqueRegion();
EXPECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds).ToString(), opaqueContents.ToString());
@@ -1328,7 +1329,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
layer->fake_layer_updater()->SetOpaquePaintRect(gfx::Rect());
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
updateTextures();
opaqueContents = layer->VisibleContentOpaqueRegion();
EXPECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds).ToString(), opaqueContents.ToString());
@@ -1344,7 +1345,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
layer->InvalidateContentRect(gfx::Rect(0, 0, 1, 1));
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
updateTextures();
opaqueContents = layer->VisibleContentOpaqueRegion();
EXPECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds).ToString(), opaqueContents.ToString());
@@ -1360,7 +1361,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
layer->InvalidateContentRect(gfx::Rect(10, 10, 1, 1));
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
updateTextures();
opaqueContents = layer->VisibleContentOpaqueRegion();
EXPECT_EQ(gfx::IntersectRects(gfx::Rect(10, 100, 90, 100), visibleBounds).ToString(), opaqueContents.ToString());
@@ -1392,7 +1393,7 @@ TEST_F(TiledLayerTest, pixels_paintedMetrics)
layer->InvalidateContentRect(contentBounds);
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
updateTextures();
opaqueContents = layer->VisibleContentOpaqueRegion();
EXPECT_TRUE(opaqueContents.IsEmpty());
@@ -1409,7 +1410,7 @@ TEST_F(TiledLayerTest, pixels_paintedMetrics)
layer->InvalidateContentRect(gfx::Rect(50, 200, 10, 10));
layer->SetTexturePriorities(m_priorityCalculator);
resource_manager_->PrioritizeTextures();
- layer->Update(m_queue.get(), &occluded, NULL);
+ layer->Update(m_queue.get(), &occluded);
updateTextures();
opaqueContents = layer->VisibleContentOpaqueRegion();
EXPECT_TRUE(opaqueContents.IsEmpty());
@@ -1591,7 +1592,7 @@ public:
{
scoped_ptr<TrackingLayerPainter> trackingLayerPainter(TrackingLayerPainter::Create());
m_trackingLayerPainter = trackingLayerPainter.get();
- m_layerUpdater = BitmapContentLayerUpdater::Create(trackingLayerPainter.PassAs<LayerPainter>());
+ m_layerUpdater = BitmapContentLayerUpdater::Create(trackingLayerPainter.PassAs<LayerPainter>(), &m_statsInstrumentation);
}
TrackingLayerPainter* trackingLayerPainter() const { return m_trackingLayerPainter; }
@@ -1604,6 +1605,7 @@ protected:
private:
TrackingLayerPainter* m_trackingLayerPainter;
scoped_refptr<BitmapContentLayerUpdater> m_layerUpdater;
+ FakeRenderingStatsInstrumentation m_statsInstrumentation;
};
TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
@@ -1624,7 +1626,7 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
resource_manager_->PrioritizeTextures();
// Update the whole tile.
- layer->Update(m_queue.get(), 0, NULL);
+ layer->Update(m_queue.get(), 0);
danakj 2013/03/23 01:56:32 can you make these 0's into NULL's while you're he
egraether 2013/03/25 21:07:44 Done.
layer->trackingLayerPainter()->resetPaintedRect();
EXPECT_RECT_EQ(gfx::Rect(), layer->trackingLayerPainter()->paintedRect());
@@ -1632,7 +1634,7 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
// Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds.
layer->InvalidateContentRect(contentRect);
- layer->Update(m_queue.get(), 0, NULL);
+ layer->Update(m_queue.get(), 0);
EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect());
}
@@ -1654,7 +1656,7 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation)
resource_manager_->PrioritizeTextures();
// Update the whole tile.
- layer->Update(m_queue.get(), 0, NULL);
+ layer->Update(m_queue.get(), 0);
layer->trackingLayerPainter()->resetPaintedRect();
EXPECT_RECT_EQ(gfx::Rect(), layer->trackingLayerPainter()->paintedRect());
@@ -1662,7 +1664,7 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation)
// Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds.
layer->SetNeedsDisplayRect(layerRect);
- layer->Update(m_queue.get(), 0, NULL);
+ layer->Update(m_queue.get(), 0);
EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect());
}

Powered by Google App Engine
This is Rietveld 408576698