Index: cc/layers/picture_layer_impl_unittest.cc |
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc |
index 505d6f5d7267060436cf98f188c72c09f09400f4..0cc53bf643db5299e4d5264c5964f23172d7d797 100644 |
--- a/cc/layers/picture_layer_impl_unittest.cc |
+++ b/cc/layers/picture_layer_impl_unittest.cc |
@@ -1241,27 +1241,6 @@ TEST_F(PictureLayerImplTest, DisallowTileDrawQuads) { |
EXPECT_EQ(DrawQuad::PICTURE_CONTENT, render_pass->quad_list[0]->material); |
} |
-TEST_F(PictureLayerImplTest, MarkRequiredNullTiles) { |
- gfx::Size tile_size(100, 100); |
- gfx::Size layer_bounds(1000, 1000); |
- |
- scoped_refptr<FakePicturePileImpl> pending_pile = |
- FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); |
- // Layers with entirely empty piles can't get tilings. |
- pending_pile->AddRecordingAt(0, 0); |
- |
- SetupPendingTree(pending_pile); |
- |
- ASSERT_TRUE(pending_layer_->CanHaveTilings()); |
- pending_layer_->AddTiling(1.0f); |
- pending_layer_->AddTiling(2.0f); |
- |
- // It should be safe to call this (and MarkVisibleResourcesAsRequired) |
- // on a layer with no recordings. |
- host_impl_.pending_tree()->UpdateDrawProperties(); |
- pending_layer_->MarkVisibleResourcesAsRequired(); |
-} |
- |
TEST_F(PictureLayerImplTest, MarkRequiredOffscreenTiles) { |
gfx::Size tile_size(100, 100); |
gfx::Size layer_bounds(200, 200); |
@@ -1274,43 +1253,18 @@ TEST_F(PictureLayerImplTest, MarkRequiredOffscreenTiles) { |
ASSERT_TRUE(pending_layer_->CanHaveTilings()); |
PictureLayerTiling* tiling = pending_layer_->AddTiling(1.f); |
host_impl_.pending_tree()->UpdateDrawProperties(); |
- EXPECT_EQ(tiling->resolution(), HIGH_RESOLUTION); |
- |
pending_layer_->draw_properties().visible_content_rect = |
gfx::Rect(0, 0, 100, 200); |
+ pending_layer_->UpdateTiles(NULL); |
- // Fake set priorities. |
- for (PictureLayerTiling::CoverageIterator iter( |
- tiling, pending_layer_->contents_scale_x(), gfx::Rect(layer_bounds)); |
- iter; |
- ++iter) { |
- if (!*iter) |
- continue; |
- Tile* tile = *iter; |
- TilePriority priority; |
- priority.resolution = HIGH_RESOLUTION; |
- gfx::Rect tile_bounds = iter.geometry_rect(); |
- if (pending_layer_->visible_content_rect().Intersects(tile_bounds)) { |
- priority.priority_bin = TilePriority::NOW; |
- priority.distance_to_visible = 0.f; |
- } else { |
- priority.priority_bin = TilePriority::SOON; |
- priority.distance_to_visible = 1.f; |
- } |
- tile->SetPriority(PENDING_TREE, priority); |
- } |
- |
- pending_layer_->MarkVisibleResourcesAsRequired(); |
+ EXPECT_EQ(tiling->resolution(), HIGH_RESOLUTION); |
int num_visible = 0; |
int num_offscreen = 0; |
- for (PictureLayerTiling::CoverageIterator iter( |
- tiling, pending_layer_->contents_scale_x(), gfx::Rect(layer_bounds)); |
+ for (PictureLayerTiling::TilingRasterTileIterator iter(tiling, PENDING_TREE); |
iter; |
++iter) { |
- if (!*iter) |
- continue; |
const Tile* tile = *iter; |
if (tile->priority(PENDING_TREE).distance_to_visible == 0.f) { |
EXPECT_TRUE(tile->required_for_activation()); |
@@ -1324,7 +1278,7 @@ TEST_F(PictureLayerImplTest, MarkRequiredOffscreenTiles) { |
EXPECT_GT(num_visible, 0); |
EXPECT_GT(num_offscreen, 0); |
} |
- |
+// |
TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) { |
gfx::Size layer_bounds(400, 400); |
gfx::Size tile_size(100, 100); |
@@ -1339,7 +1293,6 @@ TEST_F(PictureLayerImplTest, HighResRequiredWhenUnsharedActiveAllReady) { |
// No shared tiles and all active tiles ready, so pending can only |
// activate with all high res tiles. |
- pending_layer_->MarkVisibleResourcesAsRequired(); |
AssertAllTilesRequired(pending_layer_->HighResTiling()); |
AssertNoTilesRequired(pending_layer_->LowResTiling()); |
} |
@@ -1349,6 +1302,8 @@ TEST_F(PictureLayerImplTest, HighResRequiredWhenMissingHighResFlagOn) { |
gfx::Size tile_size(100, 100); |
SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
+ host_impl_.active_tree()->SetRequiresHighResToDraw(); |
+ |
// All tiles shared (no invalidation). |
CreateHighLowResAndSetAllTilesVisible(); |
@@ -1359,8 +1314,6 @@ TEST_F(PictureLayerImplTest, HighResRequiredWhenMissingHighResFlagOn) { |
// When high res are required, even if the active tree is not ready, |
// the high res tiles must be ready. |
- host_impl_.active_tree()->SetRequiresHighResToDraw(); |
- pending_layer_->MarkVisibleResourcesAsRequired(); |
AssertAllTilesRequired(pending_layer_->HighResTiling()); |
AssertNoTilesRequired(pending_layer_->LowResTiling()); |
} |
@@ -1378,7 +1331,6 @@ TEST_F(PictureLayerImplTest, NothingRequiredIfAllHighResTilesShared) { |
// All tiles shared (no invalidation), so even though the active tree's |
// tiles aren't ready, there is nothing required. |
- pending_layer_->MarkVisibleResourcesAsRequired(); |
AssertNoTilesRequired(pending_layer_->HighResTiling()); |
AssertNoTilesRequired(pending_layer_->LowResTiling()); |
} |
@@ -1408,7 +1360,6 @@ TEST_F(PictureLayerImplTest, NothingRequiredIfActiveMissingTiles) { |
// Since the active layer has no tiles at all, the pending layer doesn't |
// need content in order to activate. |
- pending_layer_->MarkVisibleResourcesAsRequired(); |
AssertNoTilesRequired(pending_layer_->HighResTiling()); |
AssertNoTilesRequired(pending_layer_->LowResTiling()); |
} |
@@ -1433,7 +1384,6 @@ TEST_F(PictureLayerImplTest, HighResRequiredIfActiveCantHaveTiles) { |
// to the case where there is no active layer, to avoid flashing content. |
// This can happen if a layer exists for a while and switches from |
// not being able to have content to having content. |
- pending_layer_->MarkVisibleResourcesAsRequired(); |
AssertAllTilesRequired(pending_layer_->HighResTiling()); |
AssertNoTilesRequired(pending_layer_->LowResTiling()); |
} |
@@ -1447,12 +1397,20 @@ TEST_F(PictureLayerImplTest, HighResRequiredWhenActiveHasDifferentBounds) { |
pending_layer_->SetBounds(pending_layer_bounds); |
CreateHighLowResAndSetAllTilesVisible(); |
+ pending_layer_->HighResTiling()->UpdateTilePriorities( |
+ PENDING_TREE, |
+ gfx::Rect(pending_layer_bounds), |
+ 1.f, |
+ 1.f, |
+ NULL, |
+ NULL, |
+ gfx::Transform()); |
+ pending_layer_->HighResTiling()->CreateAllTilesForTesting(); |
active_layer_->SetAllTilesReady(); |
// Since the active layer has different bounds, the pending layer needs all |
// high res tiles in order to activate. |
- pending_layer_->MarkVisibleResourcesAsRequired(); |
AssertAllTilesRequired(pending_layer_->HighResTiling()); |
AssertNoTilesRequired(pending_layer_->LowResTiling()); |
} |
@@ -1556,6 +1514,9 @@ TEST_F(PictureLayerImplTest, RemoveInvalidActiveTreeTilesOnSync) { |
ASSERT_TRUE(active_tiling); |
ASSERT_TRUE(pending_tiling); |
+ active_tiling->CreateAllTilesForTesting(); |
+ pending_tiling->CreateAllTilesForTesting(); |
+ |
EXPECT_TRUE(active_tiling->TileAt(0, 0)); |
EXPECT_TRUE(active_tiling->TileAt(1, 0)); |
EXPECT_TRUE(active_tiling->TileAt(0, 1)); |
@@ -1566,7 +1527,7 @@ TEST_F(PictureLayerImplTest, RemoveInvalidActiveTreeTilesOnSync) { |
EXPECT_TRUE(pending_tiling->TileAt(0, 1)); |
EXPECT_TRUE(pending_tiling->TileAt(1, 1)); |
- EXPECT_NE(active_tiling->TileAt(0, 0), pending_tiling->TileAt(0, 0)); |
+ EXPECT_EQ(active_tiling->TileAt(0, 0), pending_tiling->TileAt(0, 0)); |
EXPECT_EQ(active_tiling->TileAt(1, 0), pending_tiling->TileAt(1, 0)); |
EXPECT_EQ(active_tiling->TileAt(0, 1), pending_tiling->TileAt(0, 1)); |
EXPECT_EQ(active_tiling->TileAt(1, 1), pending_tiling->TileAt(1, 1)); |
@@ -1600,6 +1561,9 @@ TEST_F(PictureLayerImplTest, RemoveInvalidPendingTreeTilesOnSync) { |
ASSERT_TRUE(active_tiling); |
ASSERT_TRUE(pending_tiling); |
+ active_tiling->CreateAllTilesForTesting(); |
+ pending_tiling->CreateAllTilesForTesting(); |
+ |
EXPECT_TRUE(active_tiling->TileAt(0, 0)); |
EXPECT_TRUE(active_tiling->TileAt(1, 0)); |
EXPECT_TRUE(active_tiling->TileAt(0, 1)); |
@@ -2066,6 +2030,7 @@ TEST_F(PictureLayerImplTest, LayerEvictionTileIterator) { |
tilings.begin(); |
tiling_iterator != tilings.end(); |
++tiling_iterator) { |
+ (*tiling_iterator)->CreateAllTilesForTesting(); |
std::vector<Tile*> tiles = (*tiling_iterator)->AllTilesForTesting(); |
std::copy(tiles.begin(), tiles.end(), std::back_inserter(all_tiles)); |
} |
@@ -2085,7 +2050,7 @@ TEST_F(PictureLayerImplTest, LayerEvictionTileIterator) { |
++iter) { |
if (mark_required) { |
number_of_marked_tiles++; |
- iter->MarkRequiredForActivation(); |
+ iter->set_required_for_activation(true); |
} else { |
number_of_unmarked_tiles++; |
} |
@@ -2209,6 +2174,7 @@ TEST_F(PictureLayerImplTest, Occlusion) { |
host_impl_.SetViewportSize(viewport_size); |
host_impl_.active_tree()->UpdateDrawProperties(); |
+ active_layer_->HighResTiling()->CreateAllTilesForTesting(); |
std::vector<Tile*> tiles = |
active_layer_->HighResTiling()->AllTilesForTesting(); |
host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); |
@@ -2300,7 +2266,6 @@ TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) { |
CreateHighLowResAndSetAllTilesVisible(); |
active_layer_->SetAllTilesReady(); |
- pending_layer_->MarkVisibleResourcesAsRequired(); |
// All pending layer tiles required are not ready. |
EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
@@ -2317,34 +2282,6 @@ TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) { |
EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
} |
-TEST_F(PictureLayerImplTest, HighResReadyToDrawNotEnoughToActivate) { |
- gfx::Size tile_size(100, 100); |
- gfx::Size layer_bounds(1000, 1000); |
- |
- SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
- |
- // Make sure some tiles are not shared. |
- pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size)); |
- |
- CreateHighLowResAndSetAllTilesVisible(); |
- active_layer_->SetAllTilesReady(); |
- pending_layer_->MarkVisibleResourcesAsRequired(); |
- |
- // All pending layer tiles required are not ready. |
- EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
- |
- // Initialize all high-res tiles. |
- pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling()); |
- |
- // High-res tiles should not be enough. |
- EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
- |
- // Initialize remaining tiles. |
- pending_layer_->SetAllTilesReady(); |
- |
- EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw()); |
-} |
- |
class NoLowResTilingsSettings : public ImplSidePaintingSettings { |
public: |
NoLowResTilingsSettings() { create_low_res_tiling = false; } |
@@ -2416,27 +2353,6 @@ TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) { |
pending_layer_->tilings()->tiling_at(0)->contents_scale()); |
} |
-TEST_F(NoLowResPictureLayerImplTest, MarkRequiredNullTiles) { |
- gfx::Size tile_size(100, 100); |
- gfx::Size layer_bounds(1000, 1000); |
- |
- scoped_refptr<FakePicturePileImpl> pending_pile = |
- FakePicturePileImpl::CreateEmptyPile(tile_size, layer_bounds); |
- // Layers with entirely empty piles can't get tilings. |
- pending_pile->AddRecordingAt(0, 0); |
- |
- SetupPendingTree(pending_pile); |
- |
- ASSERT_TRUE(pending_layer_->CanHaveTilings()); |
- pending_layer_->AddTiling(1.0f); |
- pending_layer_->AddTiling(2.0f); |
- |
- // It should be safe to call this (and MarkVisibleResourcesAsRequired) |
- // on a layer with no recordings. |
- host_impl_.pending_tree()->UpdateDrawProperties(); |
- pending_layer_->MarkVisibleResourcesAsRequired(); |
-} |
- |
TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfAllHighResTilesShared) { |
gfx::Size layer_bounds(400, 400); |
gfx::Size tile_size(100, 100); |
@@ -2450,7 +2366,6 @@ TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfAllHighResTilesShared) { |
// All tiles shared (no invalidation), so even though the active tree's |
// tiles aren't ready, there is nothing required. |
- pending_layer_->MarkVisibleResourcesAsRequired(); |
AssertNoTilesRequired(pending_layer_->HighResTiling()); |
if (host_impl_.settings().create_low_res_tiling) { |
AssertNoTilesRequired(pending_layer_->LowResTiling()); |
@@ -2483,7 +2398,6 @@ TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfActiveMissingTiles) { |
// Since the active layer has no tiles at all, the pending layer doesn't |
// need content in order to activate. |
- pending_layer_->MarkVisibleResourcesAsRequired(); |
AssertNoTilesRequired(pending_layer_->HighResTiling()); |
if (host_impl_.settings().create_low_res_tiling) |
AssertNoTilesRequired(pending_layer_->LowResTiling()); |
@@ -3053,6 +2967,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, |
for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { |
PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); |
+ tiling->CreateAllTilesForTesting(); |
occluded_tile_count = 0; |
for (PictureLayerTiling::CoverageIterator iter( |
@@ -3089,6 +3004,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, |
for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { |
PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); |
+ tiling->CreateAllTilesForTesting(); |
occluded_tile_count = 0; |
for (PictureLayerTiling::CoverageIterator iter( |
@@ -3158,6 +3074,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, OcclusionForDifferentScales) { |
tilings.begin(); |
tiling_iterator != tilings.end(); |
++tiling_iterator) { |
+ (*tiling_iterator)->CreateAllTilesForTesting(); |
std::vector<Tile*> tiles = (*tiling_iterator)->AllTilesForTesting(); |
occluded_tile_count = 0; |