| Index: cc/resources/picture_layer_tiling_unittest.cc
|
| diff --git a/cc/resources/picture_layer_tiling_unittest.cc b/cc/resources/picture_layer_tiling_unittest.cc
|
| index 0795e118f02965efcfee0b9e4fd7b175cf66683d..e64191d3b323bd72ddc731835c0c3f742d1be8a0 100644
|
| --- a/cc/resources/picture_layer_tiling_unittest.cc
|
| +++ b/cc/resources/picture_layer_tiling_unittest.cc
|
| @@ -44,9 +44,7 @@ static void UpdateAllTilePriorities(PictureLayerTilingSet* set,
|
| visible_layer_rect,
|
| layer_contents_scale,
|
| current_frame_time_in_seconds,
|
| - NULL,
|
| - NULL,
|
| - gfx::Transform());
|
| + Occlusion());
|
| }
|
| }
|
|
|
| @@ -540,8 +538,7 @@ TEST(PictureLayerTilingTest, SkewportLimits) {
|
| client.SetTileSize(gfx::Size(100, 100));
|
| tiling = TestablePictureLayerTiling::Create(1.0f, layer_bounds, &client);
|
|
|
| - tiling->UpdateTilePriorities(
|
| - ACTIVE_TREE, viewport, 1.f, 1.0, NULL, NULL, gfx::Transform());
|
| + tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.f, 1.0, Occlusion());
|
|
|
| // Move viewport down 50 pixels in 0.5 seconds.
|
| gfx::Rect down_skewport =
|
| @@ -607,8 +604,7 @@ TEST(PictureLayerTilingTest, ComputeSkewport) {
|
| client.set_tree(ACTIVE_TREE);
|
| tiling = TestablePictureLayerTiling::Create(1.0f, layer_bounds, &client);
|
|
|
| - tiling->UpdateTilePriorities(
|
| - ACTIVE_TREE, viewport, 1.f, 1.0, NULL, NULL, gfx::Transform());
|
| + tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.f, 1.0, Occlusion());
|
|
|
| // Move viewport down 50 pixels in 0.5 seconds.
|
| gfx::Rect down_skewport =
|
| @@ -675,8 +671,7 @@ TEST(PictureLayerTilingTest, ViewportDistanceWithScale) {
|
| gfx::Rect viewport_in_content_space =
|
| gfx::ToEnclosedRect(gfx::ScaleRect(viewport, 0.25f));
|
|
|
| - tiling->UpdateTilePriorities(
|
| - ACTIVE_TREE, viewport, 1.f, 1.0, NULL, NULL, gfx::Transform());
|
| + tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.f, 1.0, Occlusion());
|
|
|
| gfx::Rect soon_rect = viewport;
|
| soon_rect.Inset(-312.f, -312.f, -312.f, -312.f);
|
| @@ -760,8 +755,7 @@ TEST(PictureLayerTilingTest, ViewportDistanceWithScale) {
|
| EXPECT_EQ(25, skewport.width());
|
| EXPECT_EQ(35, skewport.height());
|
|
|
| - tiling->UpdateTilePriorities(
|
| - ACTIVE_TREE, viewport, 1.f, 2.0, NULL, NULL, gfx::Transform());
|
| + tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.f, 2.0, Occlusion());
|
|
|
| have_now = false;
|
| have_eventually = false;
|
| @@ -812,8 +806,7 @@ TEST(PictureLayerTilingTest, ViewportDistanceWithScale) {
|
| EXPECT_FLOAT_EQ(4.f, priority.distance_to_visible);
|
|
|
| // Change the underlying layer scale.
|
| - tiling->UpdateTilePriorities(
|
| - ACTIVE_TREE, viewport, 2.0f, 3.0, NULL, NULL, gfx::Transform());
|
| + tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 2.0f, 3.0, Occlusion());
|
|
|
| priority = tiling->TileAt(5, 1)->priority(ACTIVE_TREE);
|
| EXPECT_FLOAT_EQ(136.f, priority.distance_to_visible);
|
| @@ -826,8 +819,7 @@ TEST(PictureLayerTilingTest, ViewportDistanceWithScale) {
|
|
|
| // Test additional scales.
|
| tiling = TestablePictureLayerTiling::Create(0.2f, layer_bounds, &client);
|
| - tiling->UpdateTilePriorities(
|
| - ACTIVE_TREE, viewport, 1.0f, 4.0, NULL, NULL, gfx::Transform());
|
| + tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.0f, 4.0, Occlusion());
|
|
|
| priority = tiling->TileAt(5, 1)->priority(ACTIVE_TREE);
|
| EXPECT_FLOAT_EQ(110.f, priority.distance_to_visible);
|
| @@ -838,8 +830,7 @@ TEST(PictureLayerTilingTest, ViewportDistanceWithScale) {
|
| priority = tiling->TileAt(3, 4)->priority(ACTIVE_TREE);
|
| EXPECT_FLOAT_EQ(60.f, priority.distance_to_visible);
|
|
|
| - tiling->UpdateTilePriorities(
|
| - ACTIVE_TREE, viewport, 0.5f, 5.0, NULL, NULL, gfx::Transform());
|
| + tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 0.5f, 5.0, Occlusion());
|
|
|
| priority = tiling->TileAt(5, 1)->priority(ACTIVE_TREE);
|
| EXPECT_FLOAT_EQ(55.f, priority.distance_to_visible);
|
| @@ -1087,8 +1078,7 @@ TEST(PictureLayerTilingTest, TilingRasterTileIteratorStaticViewport) {
|
| client.set_tree(ACTIVE_TREE);
|
|
|
| tiling = TestablePictureLayerTiling::Create(1.0f, layer_bounds, &client);
|
| - tiling->UpdateTilePriorities(
|
| - ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform());
|
| + tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion());
|
|
|
| PictureLayerTiling::TilingRasterTileIterator empty_iterator;
|
| EXPECT_FALSE(empty_iterator);
|
| @@ -1196,10 +1186,9 @@ TEST(PictureLayerTilingTest, TilingRasterTileIteratorMovingViewport) {
|
| client.set_tree(ACTIVE_TREE);
|
|
|
| tiling = TestablePictureLayerTiling::Create(1.f, layer_bounds, &client);
|
| + tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion());
|
| tiling->UpdateTilePriorities(
|
| - ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform());
|
| - tiling->UpdateTilePriorities(
|
| - ACTIVE_TREE, moved_viewport, 1.0f, 2.0, NULL, NULL, gfx::Transform());
|
| + ACTIVE_TREE, moved_viewport, 1.0f, 2.0, Occlusion());
|
|
|
| gfx::Rect soon_rect = moved_viewport;
|
| soon_rect.Inset(-312.f, -312.f, -312.f, -312.f);
|
| @@ -1272,8 +1261,7 @@ TEST(PictureLayerTilingTest, TilingEvictionTileIteratorStaticViewport) {
|
| client.set_tree(ACTIVE_TREE);
|
|
|
| tiling = TestablePictureLayerTiling::Create(1.0f, layer_bounds, &client);
|
| - tiling->UpdateTilePriorities(
|
| - ACTIVE_TREE, viewport, 1.0f, 1.0, NULL, NULL, gfx::Transform());
|
| + tiling->UpdateTilePriorities(ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion());
|
|
|
| PictureLayerTiling::TilingRasterTileIterator empty_iterator;
|
| EXPECT_FALSE(empty_iterator);
|
| @@ -1351,19 +1339,15 @@ TEST_F(PictureLayerTilingIteratorTest, TilesExist) {
|
| gfx::Rect(layer_bounds), // visible content rect
|
| 1.f, // current contents scale
|
| 1.0, // current frame time
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + Occlusion());
|
| VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true));
|
|
|
| // Make the viewport rect empty. All tiles are killed and become zombies.
|
| tiling_->UpdateTilePriorities(ACTIVE_TREE,
|
| - gfx::Rect(), // visible content rect
|
| - 1.f, // current contents scale
|
| - 2.0, // current frame time
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + gfx::Rect(), // visible content rect
|
| + 1.f, // current contents scale
|
| + 2.0, // current frame time
|
| + Occlusion());
|
| VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false));
|
| }
|
|
|
| @@ -1381,19 +1365,15 @@ TEST_F(PictureLayerTilingIteratorTest, TilesExistGiantViewport) {
|
| gfx::Rect(layer_bounds), // visible content rect
|
| 1.f, // current contents scale
|
| 1.0, // current frame time
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + Occlusion());
|
| VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true));
|
|
|
| // If the visible content rect is empty, it should still have live tiles.
|
| tiling_->UpdateTilePriorities(ACTIVE_TREE,
|
| - giant_rect, // visible content rect
|
| - 1.f, // current contents scale
|
| - 2.0, // current frame time
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + giant_rect, // visible content rect
|
| + 1.f, // current contents scale
|
| + 2.0, // current frame time
|
| + Occlusion());
|
| VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true));
|
| }
|
|
|
| @@ -1410,12 +1390,10 @@ TEST_F(PictureLayerTilingIteratorTest, TilesExistOutsideViewport) {
|
|
|
| client_.set_tree(ACTIVE_TREE);
|
| tiling_->UpdateTilePriorities(ACTIVE_TREE,
|
| - viewport_rect, // visible content rect
|
| - 1.f, // current contents scale
|
| - 1.0, // current frame time
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + viewport_rect, // visible content rect
|
| + 1.f, // current contents scale
|
| + 1.0, // current frame time
|
| + Occlusion());
|
| VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true));
|
| }
|
|
|
| @@ -1442,12 +1420,10 @@ TEST_F(PictureLayerTilingIteratorTest,
|
| client_.set_tree(ACTIVE_TREE);
|
| set_max_tiles_for_interest_area(1);
|
| tiling_->UpdateTilePriorities(ACTIVE_TREE,
|
| - visible_rect, // visible content rect
|
| - 1.f, // current contents scale
|
| - 1.0, // current frame time
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + visible_rect, // visible content rect
|
| + 1.f, // current contents scale
|
| + 1.0, // current frame time
|
| + Occlusion());
|
| VerifyTiles(1.f,
|
| gfx::Rect(layer_bounds),
|
| base::Bind(&TilesIntersectingRectExist, visible_rect, true));
|
| @@ -1533,9 +1509,7 @@ TEST(UpdateTilePrioritiesTest, VisibleTiles) {
|
| viewport_in_layer_space,
|
| current_layer_contents_scale,
|
| current_frame_time_in_seconds,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + Occlusion());
|
|
|
| ASSERT_TRUE(tiling->TileAt(0, 0));
|
| ASSERT_TRUE(tiling->TileAt(0, 1));
|
| @@ -1590,9 +1564,7 @@ TEST(UpdateTilePrioritiesTest, OffscreenTiles) {
|
| viewport_in_layer_space,
|
| current_layer_contents_scale,
|
| current_frame_time_in_seconds,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + Occlusion());
|
|
|
| ASSERT_TRUE(tiling->TileAt(0, 0));
|
| ASSERT_TRUE(tiling->TileAt(0, 1));
|
| @@ -1657,9 +1629,7 @@ TEST(UpdateTilePrioritiesTest, PartiallyOffscreenLayer) {
|
| viewport_in_layer_space,
|
| current_layer_contents_scale,
|
| current_frame_time_in_seconds,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + Occlusion());
|
|
|
| ASSERT_TRUE(tiling->TileAt(0, 0));
|
| ASSERT_TRUE(tiling->TileAt(0, 1));
|
| @@ -1718,9 +1688,7 @@ TEST(UpdateTilePrioritiesTest, PartiallyOffscreenRotatedLayer) {
|
| viewport_in_layer_space,
|
| current_layer_contents_scale,
|
| current_frame_time_in_seconds,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + Occlusion());
|
|
|
| ASSERT_TRUE(tiling->TileAt(0, 0));
|
| ASSERT_TRUE(tiling->TileAt(0, 1));
|
| @@ -1803,9 +1771,7 @@ TEST(UpdateTilePrioritiesTest, PerspectiveLayer) {
|
| viewport_in_layer_space,
|
| current_layer_contents_scale,
|
| current_frame_time_in_seconds,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + Occlusion());
|
|
|
| ASSERT_TRUE(tiling->TileAt(0, 0));
|
| ASSERT_TRUE(tiling->TileAt(0, 1));
|
| @@ -1898,9 +1864,7 @@ TEST(UpdateTilePrioritiesTest, PerspectiveLayerClippedByW) {
|
| viewport_in_layer_space,
|
| current_layer_contents_scale,
|
| current_frame_time_in_seconds,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + Occlusion());
|
|
|
| ASSERT_TRUE(tiling->TileAt(0, 0));
|
| ASSERT_TRUE(tiling->TileAt(0, 1));
|
| @@ -1964,18 +1928,14 @@ TEST(UpdateTilePrioritiesTest, BasicMotion) {
|
| viewport_in_layer_space,
|
| last_layer_contents_scale,
|
| last_frame_time_in_seconds,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + Occlusion());
|
|
|
| // current frame
|
| tiling->UpdateTilePriorities(ACTIVE_TREE,
|
| viewport_in_layer_space,
|
| current_layer_contents_scale,
|
| current_frame_time_in_seconds,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + Occlusion());
|
|
|
| ASSERT_TRUE(tiling->TileAt(0, 0));
|
| ASSERT_TRUE(tiling->TileAt(0, 1));
|
| @@ -2046,18 +2006,14 @@ TEST(UpdateTilePrioritiesTest, RotationMotion) {
|
| viewport_in_layer_space,
|
| last_layer_contents_scale,
|
| last_frame_time_in_seconds,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + Occlusion());
|
|
|
| // current frame
|
| tiling->UpdateTilePriorities(ACTIVE_TREE,
|
| viewport_in_layer_space,
|
| current_layer_contents_scale,
|
| current_frame_time_in_seconds,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + Occlusion());
|
|
|
| ASSERT_TRUE(tiling->TileAt(0, 0));
|
| ASSERT_TRUE(tiling->TileAt(0, 1));
|
| @@ -2086,13 +2042,8 @@ TEST(PictureLayerTilingTest, ResetClearsPriorities) {
|
| tiling = TestablePictureLayerTiling::Create(1.0f, // contents_scale
|
| gfx::Size(100, 100),
|
| &client);
|
| - tiling->UpdateTilePriorities(ACTIVE_TREE,
|
| - gfx::Rect(0, 0, 100, 100),
|
| - 1.0f,
|
| - 1.0f,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + tiling->UpdateTilePriorities(
|
| + ACTIVE_TREE, gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, Occlusion());
|
|
|
| std::vector<scoped_refptr<Tile> > tiles = tiling->AllRefTilesForTesting();
|
| ASSERT_GT(tiles.size(), 0u);
|
| @@ -2132,13 +2083,8 @@ TEST(PictureLayerTilingTest, RecycledTilesCleared) {
|
| gfx::Size(10000, 10000),
|
| &active_client);
|
| // Create all tiles on this tiling.
|
| - active_tiling->UpdateTilePriorities(ACTIVE_TREE,
|
| - gfx::Rect(0, 0, 100, 100),
|
| - 1.0f,
|
| - 1.0f,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + active_tiling->UpdateTilePriorities(
|
| + ACTIVE_TREE, gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, Occlusion());
|
|
|
| FakePictureLayerTilingClient recycle_client;
|
| recycle_client.SetTileSize(gfx::Size(100, 100));
|
| @@ -2152,13 +2098,8 @@ TEST(PictureLayerTilingTest, RecycledTilesCleared) {
|
| &recycle_client);
|
|
|
| // Create all tiles on the second tiling. All tiles should be shared.
|
| - recycle_tiling->UpdateTilePriorities(PENDING_TREE,
|
| - gfx::Rect(0, 0, 100, 100),
|
| - 1.0f,
|
| - 1.0f,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + recycle_tiling->UpdateTilePriorities(
|
| + PENDING_TREE, gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, Occlusion());
|
|
|
| // Set the second tiling as recycled.
|
| active_client.set_twin_tiling(NULL);
|
| @@ -2171,25 +2112,15 @@ TEST(PictureLayerTilingTest, RecycledTilesCleared) {
|
| EXPECT_EQ(active_tiling->TileAt(0, 0), recycle_tiling->TileAt(0, 0));
|
|
|
| // Move the viewport far away from the (0, 0) tile.
|
| - active_tiling->UpdateTilePriorities(ACTIVE_TREE,
|
| - gfx::Rect(9000, 9000, 100, 100),
|
| - 1.0f,
|
| - 2.0,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + active_tiling->UpdateTilePriorities(
|
| + ACTIVE_TREE, gfx::Rect(9000, 9000, 100, 100), 1.0f, 2.0, Occlusion());
|
| // Ensure the tile was deleted on both tilings.
|
| EXPECT_FALSE(active_tiling->TileAt(0, 0));
|
| EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
|
|
|
| // Move the viewport back to (0, 0) tile.
|
| - active_tiling->UpdateTilePriorities(ACTIVE_TREE,
|
| - gfx::Rect(0, 0, 100, 100),
|
| - 1.0f,
|
| - 3.0,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + active_tiling->UpdateTilePriorities(
|
| + ACTIVE_TREE, gfx::Rect(0, 0, 100, 100), 1.0f, 3.0, Occlusion());
|
|
|
| // Ensure that we now have a tile here, but the recycle tiling does not.
|
| EXPECT_TRUE(active_tiling->TileAt(0, 0));
|
| @@ -2206,13 +2137,8 @@ TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) {
|
| gfx::Size(100, 100),
|
| &active_client);
|
| // Create all tiles on this tiling.
|
| - active_tiling->UpdateTilePriorities(ACTIVE_TREE,
|
| - gfx::Rect(0, 0, 100, 100),
|
| - 1.0f,
|
| - 1.0f,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + active_tiling->UpdateTilePriorities(
|
| + ACTIVE_TREE, gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, Occlusion());
|
|
|
| FakePictureLayerTilingClient recycle_client;
|
| recycle_client.SetTileSize(gfx::Size(100, 100));
|
| @@ -2226,13 +2152,8 @@ TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) {
|
| &recycle_client);
|
|
|
| // Create all tiles on the recycle tiling. All tiles should be shared.
|
| - recycle_tiling->UpdateTilePriorities(PENDING_TREE,
|
| - gfx::Rect(0, 0, 100, 100),
|
| - 1.0f,
|
| - 1.0f,
|
| - NULL, // occlusion tracker
|
| - NULL, // render target
|
| - gfx::Transform()); // draw transform
|
| + recycle_tiling->UpdateTilePriorities(
|
| + PENDING_TREE, gfx::Rect(0, 0, 100, 100), 1.0f, 1.0f, Occlusion());
|
|
|
| // Set the second tiling as recycled.
|
| active_client.set_twin_tiling(NULL);
|
|
|