| 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 79dfec685dabe2c4001a7d7bc32e4c601ef33f02..0a95f317d7203962ba68d997cdc82f7df70c32e8 100644
|
| --- a/cc/layers/picture_layer_impl_unittest.cc
|
| +++ b/cc/layers/picture_layer_impl_unittest.cc
|
| @@ -636,6 +636,10 @@ TEST_F(PictureLayerImplTest, ClonePartialInvalidation) {
|
| // Add a non-shared tiling on the active tree.
|
| PictureLayerTiling* tiling = active_layer_->AddTiling(3.f);
|
| tiling->CreateAllTilesForTesting();
|
| +
|
| + // Ensure UpdateTiles won't remove any tilings.
|
| + active_layer_->MarkAllTilingsUsed();
|
| +
|
| // Then setup a new pending tree and activate it.
|
| SetupTreesWithFixedTileSize(pending_pile, active_pile, gfx::Size(50, 50),
|
| layer_invalidation);
|
| @@ -919,6 +923,9 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) {
|
| EXPECT_BOTH_EQ(tilings()->tiling_at(1)->contents_scale(),
|
| 2.f * low_res_factor);
|
|
|
| + // Ensure UpdateTiles won't remove any tilings.
|
| + active_layer_->MarkAllTilingsUsed();
|
| +
|
| // Start a pinch gesture.
|
| host_impl_.PinchGestureBegin();
|
|
|
| @@ -933,6 +940,9 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) {
|
| EXPECT_FLOAT_EQ(2.0f * low_res_factor,
|
| active_layer_->tilings()->tiling_at(2)->contents_scale());
|
|
|
| + // Ensure UpdateTiles won't remove any tilings.
|
| + active_layer_->MarkAllTilingsUsed();
|
| +
|
| // Zoom out further, close to our low-res scale factor. We should
|
| // use that tiling as high-res, and not create a new tiling.
|
| SetContentsScaleOnBothLayers(low_res_factor * 2.1f, 1.0f,
|
| @@ -969,6 +979,9 @@ TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) {
|
| EXPECT_FLOAT_EQ(0.0625f,
|
| active_layer_->tilings()->tiling_at(1)->contents_scale());
|
|
|
| + // Ensure UpdateTiles won't remove any tilings.
|
| + active_layer_->MarkAllTilingsUsed();
|
| +
|
| // Start a pinch gesture.
|
| host_impl_.PinchGestureBegin();
|
|
|
| @@ -983,6 +996,9 @@ TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) {
|
| EXPECT_FLOAT_EQ(0.0625,
|
| active_layer_->tilings()->tiling_at(2)->contents_scale());
|
|
|
| + // Ensure UpdateTiles won't remove any tilings.
|
| + active_layer_->MarkAllTilingsUsed();
|
| +
|
| // Zoom out further, close to our low-res scale factor. We should
|
| // use that tiling as high-res, and not create a new tiling.
|
| SetContentsScaleOnBothLayers(0.1f, 1.0f, 0.1f, 1.0f, false);
|
| @@ -1022,6 +1038,11 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
|
| EXPECT_EQ(2u, active_layer_->tilings()->num_tilings());
|
| EXPECT_EQ(1.f, active_layer_->HighResTiling()->contents_scale());
|
|
|
| + // Ensure UpdateTiles won't remove any tilings. Note this is unrelated to
|
| + // |used_tilings| variable, and it's here only to ensure that active_layer_
|
| + // won't remove tilings before the test has a chance to verify behavior.
|
| + active_layer_->MarkAllTilingsUsed();
|
| +
|
| // We only have ideal tilings, so they aren't removed.
|
| used_tilings.clear();
|
| active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
|
| @@ -1054,6 +1075,9 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
|
| 1.f * low_res_factor,
|
| active_layer_->tilings()->tiling_at(3)->contents_scale());
|
|
|
| + // Ensure UpdateTiles won't remove any tilings.
|
| + active_layer_->MarkAllTilingsUsed();
|
| +
|
| // Mark the non-ideal tilings as used. They won't be removed.
|
| used_tilings.clear();
|
| used_tilings.push_back(active_layer_->tilings()->tiling_at(1));
|
| @@ -1146,6 +1170,9 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) {
|
| EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), low_res_factor);
|
| EXPECT_BOTH_EQ(num_tilings(), 2u);
|
|
|
| + // Ensure UpdateTiles won't remove any tilings.
|
| + active_layer_->MarkAllTilingsUsed();
|
| +
|
| // Page scale animation, new high res, but no low res. We still have
|
| // a tiling at the previous scale, it's just not marked as low res on the
|
| // active layer. The pending layer drops non-ideal tilings.
|
| @@ -3255,18 +3282,18 @@ TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) {
|
| SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, invalidation);
|
|
|
| // All pending layer tiles required are not ready.
|
| - EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
|
| + EXPECT_FALSE(host_impl_.tile_manager()->IsReadyToActivate());
|
|
|
| // Initialize all low-res tiles.
|
| pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling());
|
|
|
| // Low-res tiles should not be enough.
|
| - EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
|
| + EXPECT_FALSE(host_impl_.tile_manager()->IsReadyToActivate());
|
|
|
| // Initialize remaining tiles.
|
| pending_layer_->SetAllTilesReady();
|
|
|
| - EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
|
| + EXPECT_TRUE(host_impl_.tile_manager()->IsReadyToActivate());
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, HighResReadyToDrawEnoughToActivate) {
|
| @@ -3278,13 +3305,13 @@ TEST_F(PictureLayerImplTest, HighResReadyToDrawEnoughToActivate) {
|
| SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, invalidation);
|
|
|
| // All pending layer tiles required are not ready.
|
| - EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
|
| + EXPECT_FALSE(host_impl_.tile_manager()->IsReadyToActivate());
|
|
|
| // Initialize all high-res tiles.
|
| pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
|
|
|
| // High-res tiles should be enough, since they cover everything visible.
|
| - EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
|
| + EXPECT_TRUE(host_impl_.tile_manager()->IsReadyToActivate());
|
| }
|
|
|
| TEST_F(PictureLayerImplTest,
|
| @@ -3302,11 +3329,11 @@ TEST_F(PictureLayerImplTest,
|
| pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling());
|
|
|
| // The unshared high-res tiles are not ready, so we cannot activate.
|
| - EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
|
| + EXPECT_FALSE(host_impl_.tile_manager()->IsReadyToActivate());
|
|
|
| // When the unshared pending high-res tiles are ready, we can activate.
|
| pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
|
| - EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
|
| + EXPECT_TRUE(host_impl_.tile_manager()->IsReadyToActivate());
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, SharedActiveHighResReadyNotEnoughToActivate) {
|
| @@ -3321,11 +3348,11 @@ TEST_F(PictureLayerImplTest, SharedActiveHighResReadyNotEnoughToActivate) {
|
| active_layer_->SetAllTilesReadyInTiling(active_layer_->HighResTiling());
|
|
|
| // The unshared high-res tiles are not ready, so we cannot activate.
|
| - EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
|
| + EXPECT_FALSE(host_impl_.tile_manager()->IsReadyToActivate());
|
|
|
| // When the unshared pending high-res tiles are ready, we can activate.
|
| pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
|
| - EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
|
| + EXPECT_TRUE(host_impl_.tile_manager()->IsReadyToActivate());
|
| }
|
|
|
| TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) {
|
| @@ -3612,6 +3639,11 @@ TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) {
|
| SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, false);
|
| ASSERT_EQ(1u, active_layer_->tilings()->num_tilings());
|
|
|
| + // Ensure UpdateTiles won't remove any tilings. Note this is unrelated to
|
| + // |used_tilings| variable, and it's here only to ensure that active_layer_
|
| + // won't remove tilings before the test has a chance to verify behavior.
|
| + active_layer_->MarkAllTilingsUsed();
|
| +
|
| // We only have ideal tilings, so they aren't removed.
|
| used_tilings.clear();
|
| active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
|
| @@ -3640,6 +3672,9 @@ TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) {
|
| EXPECT_FLOAT_EQ(1.f,
|
| active_layer_->tilings()->tiling_at(1)->contents_scale());
|
|
|
| + // Ensure UpdateTiles won't remove any tilings.
|
| + active_layer_->MarkAllTilingsUsed();
|
| +
|
| // Mark the non-ideal tilings as used. They won't be removed.
|
| used_tilings.clear();
|
| used_tilings.push_back(active_layer_->tilings()->tiling_at(1));
|
| @@ -4732,7 +4767,7 @@ TEST_F(PictureLayerImplTest, ChangeInViewportAllowsTilingUpdates) {
|
| pending_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting();
|
|
|
| // Ensure we can't activate.
|
| - EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
|
| + EXPECT_FALSE(host_impl_.tile_manager()->IsReadyToActivate());
|
|
|
| // Now in the same frame, move the viewport (this can happen during
|
| // animation).
|
| @@ -4759,7 +4794,7 @@ TEST_F(PictureLayerImplTest, ChangeInViewportAllowsTilingUpdates) {
|
| host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles);
|
|
|
| // Ensure we can activate.
|
| - EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
|
| + EXPECT_TRUE(host_impl_.tile_manager()->IsReadyToActivate());
|
| }
|
|
|
| TEST_F(PictureLayerImplTest, CloneMissingRecordings) {
|
|
|