| 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 990cdd4708455d1a4e57cd2179b7fd45ad5c0b6b..4eeba22450038da9ac4703d53da1c06b9431beaa 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);
|
| @@ -1083,8 +1074,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);
|
| @@ -1192,10 +1182,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);
|
| @@ -1268,8 +1257,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);
|
| @@ -1347,19 +1335,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));
|
| }
|
|
|
| @@ -1377,19 +1361,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));
|
| }
|
|
|
| @@ -1406,12 +1386,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));
|
| }
|
|
|
| @@ -1438,12 +1416,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));
|
| @@ -1470,9 +1446,7 @@ TEST_F(PictureLayerTilingIteratorTest,
|
| 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());
|
|
|
| int num_tiles = 0;
|
| VerifyTiles(1.f,
|
| @@ -1564,9 +1538,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));
|
| @@ -1621,9 +1593,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));
|
| @@ -1688,9 +1658,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));
|
| @@ -1749,9 +1717,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));
|
| @@ -1834,9 +1800,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));
|
| @@ -1929,9 +1893,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));
|
| @@ -1995,18 +1957,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));
|
| @@ -2077,18 +2035,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));
|
| @@ -2117,13 +2071,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);
|
| @@ -2163,13 +2112,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));
|
| @@ -2183,13 +2127,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);
|
| @@ -2202,25 +2141,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));
|
| @@ -2237,13 +2166,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));
|
| @@ -2257,13 +2181,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);
|
|
|