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 401df7e2710c3c5a76c202a9331ac12463fe8245..67b2782d98b16dad31a2e0577bba119e5141c517 100644 |
--- a/cc/layers/picture_layer_impl_unittest.cc |
+++ b/cc/layers/picture_layer_impl_unittest.cc |
@@ -1239,27 +1239,6 @@ TEST_F(PictureLayerImplTest, DisallowTileDrawQuads) { |
EXPECT_EQ(DrawQuad::PICTURE_CONTENT, render_pass->quad_list[0]->material); |
} |
-TEST_F(PictureLayerImplTest, MarkRequiredNullTiles) { |
vmpstr
2014/07/02 23:51:29
These types of tests no longer apply, since MarkVi
|
- 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); |
@@ -1272,43 +1251,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()); |
@@ -1322,7 +1276,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); |
@@ -1337,7 +1291,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()); |
} |
@@ -1347,6 +1300,8 @@ TEST_F(PictureLayerImplTest, HighResRequiredWhenMissingHighResFlagOn) { |
gfx::Size tile_size(100, 100); |
SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size); |
+ host_impl_.active_tree()->SetRequiresHighResToDraw(); |
vmpstr
2014/07/02 23:51:29
The order here is kind of important, since creatin
|
+ |
// All tiles shared (no invalidation). |
CreateHighLowResAndSetAllTilesVisible(); |
@@ -1357,8 +1312,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()); |
} |
@@ -1376,7 +1329,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()); |
} |
@@ -1406,7 +1358,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()); |
} |
@@ -1431,7 +1382,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()); |
} |
@@ -1445,12 +1395,21 @@ TEST_F(PictureLayerImplTest, HighResRequiredWhenActiveHasDifferentBounds) { |
pending_layer_->SetBounds(pending_layer_bounds); |
CreateHighLowResAndSetAllTilesVisible(); |
+ pending_layer_->HighResTiling()->SetLayerBounds(pending_layer_bounds); |
+ 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()); |
} |
@@ -1976,6 +1935,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)); |
} |
@@ -2119,6 +2079,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); |
@@ -2210,7 +2171,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()); |
@@ -2227,34 +2187,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; } |
@@ -2326,27 +2258,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); |
@@ -2360,7 +2271,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()); |
@@ -2393,7 +2303,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()); |
@@ -2961,6 +2870,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( |
@@ -2997,6 +2907,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( |
@@ -3066,6 +2977,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; |