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

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: Rebase to 190697 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 e9d3a78ae3f207d14ad6e86b988ef753a09b2397..b734d47ee93a99397e2c5bb9ce294578347d4b4b 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"
@@ -109,7 +110,7 @@ class TiledLayerTest : public testing::Test {
void LayerUpdate(FakeTiledLayer* layer, TestOcclusionTracker* occluded) {
DebugScopedSetMainThread main_thread(proxy_);
- layer->Update(queue_.get(), occluded, NULL);
+ layer->Update(queue_.get(), occluded);
}
void CalcDrawProps(const scoped_refptr<FakeTiledLayer>& layer1) {
@@ -158,9 +159,9 @@ class TiledLayerTest : public testing::Test {
// Update content
if (layer1)
- layer1->Update(queue_.get(), occlusion_, NULL);
+ layer1->Update(queue_.get(), occlusion_);
if (layer2)
- layer2->Update(queue_.get(), occlusion_, NULL);
+ layer2->Update(queue_.get(), occlusion_);
bool needs_update = false;
if (layer1)
@@ -602,7 +603,7 @@ TEST_F(TiledLayerTest, PaintSmallAnimatedLayersImmediately) {
// if it is close to the viewport size and has the available memory.
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), 0, NULL);
+ layer->Update(queue_.get(), NULL);
UpdateTextures();
LayerPushPropertiesTo(layer.get(), layer_impl.get());
@@ -769,7 +770,7 @@ TEST_F(TiledLayerTest, VerifyUpdateRectWhenContentBoundsAreScaled) {
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), 0, NULL);
+ layer->Update(queue_.get(), NULL);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 300, 300 * 0.8), layer->update_rect());
UpdateTextures();
@@ -778,7 +779,7 @@ TEST_F(TiledLayerTest, VerifyUpdateRectWhenContentBoundsAreScaled) {
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
layer->InvalidateContentRect(content_bounds);
- layer->Update(queue_.get(), 0, NULL);
+ layer->Update(queue_.get(), NULL);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(layer_bounds), layer->update_rect());
UpdateTextures();
@@ -788,7 +789,7 @@ TEST_F(TiledLayerTest, VerifyUpdateRectWhenContentBoundsAreScaled) {
layer->InvalidateContentRect(partial_damage);
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), 0, NULL);
+ layer->Update(queue_.get(), NULL);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(45, 80, 15, 8), layer->update_rect());
}
@@ -808,7 +809,7 @@ TEST_F(TiledLayerTest, VerifyInvalidationWhenContentsScaleChanges) {
// Push the tiles to the impl side and check that there is exactly one.
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), 0, NULL);
+ layer->Update(queue_.get(), NULL);
UpdateTextures();
LayerPushPropertiesTo(layer.get(), layer_impl.get());
EXPECT_TRUE(layer_impl->HasResourceIdForTileAt(0, 0));
@@ -826,7 +827,7 @@ TEST_F(TiledLayerTest, VerifyInvalidationWhenContentsScaleChanges) {
// The impl side should get 2x2 tiles now.
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), 0, NULL);
+ layer->Update(queue_.get(), NULL);
UpdateTextures();
LayerPushPropertiesTo(layer.get(), layer_impl.get());
EXPECT_TRUE(layer_impl->HasResourceIdForTileAt(0, 0));
@@ -907,7 +908,7 @@ TEST_F(TiledLayerTest, ResizeToSmaller) {
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), 0, NULL);
+ layer->Update(queue_.get(), NULL);
layer->SetBounds(gfx::Size(200, 200));
layer->InvalidateContentRect(gfx::Rect(0, 0, 200, 200));
@@ -925,7 +926,7 @@ TEST_F(TiledLayerTest, HugeLayerUpdateCrash) {
// Ensure no crash for bounds where size * size would overflow an int.
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), 0, NULL);
+ layer->Update(queue_.get(), NULL);
}
class TiledLayerPartialUpdateTest : public TiledLayerTest {
@@ -1056,7 +1057,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithoutOcclusion) {
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), 0, NULL);
+ layer->Update(queue_.get(), NULL);
EXPECT_EQ(2, layer->fake_layer_updater()->update_count());
}
@@ -1081,7 +1082,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusion) {
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
EXPECT_EQ(36 - 3, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1095,7 +1096,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusion) {
occluded.SetOcclusion(gfx::Rect(250, 200, 300, 100));
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
EXPECT_EQ(36 - 2, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1110,7 +1111,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusion) {
occluded.SetOcclusion(gfx::Rect(250, 250, 300, 100));
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
EXPECT_EQ(36, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1141,7 +1142,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndVisiblityConstraints) {
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
EXPECT_EQ(24 - 3, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1159,7 +1160,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndVisiblityConstraints) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
EXPECT_EQ(24 - 6, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1178,7 +1179,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndVisiblityConstraints) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
EXPECT_EQ(24 - 6, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1207,7 +1208,7 @@ TEST_F(TiledLayerTest, TilesNotPaintedWithoutInvalidation) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
EXPECT_EQ(36 - 3, layer->fake_layer_updater()->update_count());
{ UpdateTextures(); }
@@ -1222,7 +1223,7 @@ TEST_F(TiledLayerTest, TilesNotPaintedWithoutInvalidation) {
// Repaint without marking it dirty. The 3 culled tiles will be pre-painted
// now.
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
EXPECT_EQ(3, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1257,7 +1258,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndTransforms) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
EXPECT_EQ(36 - 3, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1296,7 +1297,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndScaling) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(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.
@@ -1320,7 +1321,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndScaling) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
EXPECT_EQ(9 - 1, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1347,7 +1348,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndScaling) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
EXPECT_EQ(9 - 1, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1385,7 +1386,7 @@ TEST_F(TiledLayerTest, VisibleContentOpaqueRegion) {
layer->InvalidateContentRect(content_bounds);
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
opaque_contents = layer->VisibleContentOpaqueRegion();
EXPECT_TRUE(opaque_contents.IsEmpty());
@@ -1402,7 +1403,7 @@ TEST_F(TiledLayerTest, VisibleContentOpaqueRegion) {
layer->InvalidateContentRect(content_bounds);
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
UpdateTextures();
opaque_contents = layer->VisibleContentOpaqueRegion();
EXPECT_EQ(gfx::IntersectRects(opaque_paint_rect, visible_bounds).ToString(),
@@ -1419,7 +1420,7 @@ TEST_F(TiledLayerTest, VisibleContentOpaqueRegion) {
layer->fake_layer_updater()->SetOpaquePaintRect(gfx::Rect());
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
UpdateTextures();
opaque_contents = layer->VisibleContentOpaqueRegion();
EXPECT_EQ(gfx::IntersectRects(opaque_paint_rect, visible_bounds).ToString(),
@@ -1438,7 +1439,7 @@ TEST_F(TiledLayerTest, VisibleContentOpaqueRegion) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 1, 1));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
UpdateTextures();
opaque_contents = layer->VisibleContentOpaqueRegion();
EXPECT_EQ(gfx::IntersectRects(opaque_paint_rect, visible_bounds).ToString(),
@@ -1457,7 +1458,7 @@ TEST_F(TiledLayerTest, VisibleContentOpaqueRegion) {
layer->InvalidateContentRect(gfx::Rect(10, 10, 1, 1));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
UpdateTextures();
opaque_contents = layer->VisibleContentOpaqueRegion();
EXPECT_EQ(gfx::IntersectRects(gfx::Rect(10, 100, 90, 100),
@@ -1496,7 +1497,7 @@ TEST_F(TiledLayerTest, Pixels_paintedMetrics) {
layer->InvalidateContentRect(content_bounds);
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
UpdateTextures();
opaque_contents = layer->VisibleContentOpaqueRegion();
EXPECT_TRUE(opaque_contents.IsEmpty());
@@ -1515,7 +1516,7 @@ TEST_F(TiledLayerTest, Pixels_paintedMetrics) {
layer->InvalidateContentRect(gfx::Rect(50, 200, 10, 10));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded, NULL);
+ layer->Update(queue_.get(), &occluded);
UpdateTextures();
opaque_contents = layer->VisibleContentOpaqueRegion();
EXPECT_TRUE(opaque_contents.IsEmpty());
@@ -1717,7 +1718,8 @@ class UpdateTrackingTiledLayer : public FakeTiledLayer {
scoped_ptr<TrackingLayerPainter> painter(TrackingLayerPainter::Create());
tracking_layer_painter_ = painter.get();
layer_updater_ =
- BitmapContentLayerUpdater::Create(painter.PassAs<LayerPainter>());
+ BitmapContentLayerUpdater::Create(painter.PassAs<LayerPainter>(),
+ &stats_instrumentation_);
}
TrackingLayerPainter* tracking_layer_painter() const {
@@ -1732,6 +1734,7 @@ class UpdateTrackingTiledLayer : public FakeTiledLayer {
TrackingLayerPainter* tracking_layer_painter_;
scoped_refptr<BitmapContentLayerUpdater> layer_updater_;
+ FakeRenderingStatsInstrumentation stats_instrumentation_;
};
TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) {
@@ -1752,7 +1755,7 @@ TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) {
resource_manager_->PrioritizeTextures();
// Update the whole tile.
- layer->Update(queue_.get(), 0, NULL);
+ layer->Update(queue_.get(), NULL);
layer->tracking_layer_painter()->ResetPaintedRect();
EXPECT_RECT_EQ(gfx::Rect(), layer->tracking_layer_painter()->PaintedRect());
@@ -1761,7 +1764,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(content_rect);
- layer->Update(queue_.get(), 0, NULL);
+ layer->Update(queue_.get(), NULL);
EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect());
}
@@ -1784,7 +1787,7 @@ TEST_F(TiledLayerTest,
resource_manager_->PrioritizeTextures();
// Update the whole tile.
- layer->Update(queue_.get(), 0, NULL);
+ layer->Update(queue_.get(), NULL);
layer->tracking_layer_painter()->ResetPaintedRect();
EXPECT_RECT_EQ(gfx::Rect(), layer->tracking_layer_painter()->PaintedRect());
@@ -1793,7 +1796,7 @@ TEST_F(TiledLayerTest,
// Invalidate the entire layer in layer space. When painting, the rect given
// to webkit should match the layer's bounds.
layer->SetNeedsDisplayRect(layer_rect);
- layer->Update(queue_.get(), 0, NULL);
+ layer->Update(queue_.get(), NULL);
EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect());
}

Powered by Google App Engine
This is Rietveld 408576698