| 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 2b1d0dc06f1e5cb1b77c3def6e15d840d169b0a4..3920779c3ff8d043ec0155a3f2ce02e1e4e4368e 100644
|
| --- a/cc/layers/picture_layer_impl_unittest.cc
|
| +++ b/cc/layers/picture_layer_impl_unittest.cc
|
| @@ -138,23 +138,12 @@ class PictureLayerImplTest : public testing::Test {
|
| host_impl_.CreatePendingTree();
|
| host_impl_.pending_tree()->SetPageScaleFactorAndLimits(1.f, 0.25f, 100.f);
|
| LayerTreeImpl* pending_tree = host_impl_.pending_tree();
|
| + // Clear recycled tree.
|
| + pending_tree->DetachLayerTree();
|
|
|
| - // Steal from the recycled tree.
|
| - scoped_ptr<LayerImpl> old_pending_root = pending_tree->DetachLayerTree();
|
| - DCHECK_IMPLIES(old_pending_root, old_pending_root->id() == id_);
|
| -
|
| - scoped_ptr<FakePictureLayerImpl> pending_layer;
|
| - if (old_pending_root) {
|
| - pending_layer.reset(
|
| - static_cast<FakePictureLayerImpl*>(old_pending_root.release()));
|
| - pending_layer->SetPile(pile);
|
| - } else {
|
| - pending_layer =
|
| - FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile);
|
| - pending_layer->SetDrawsContent(true);
|
| - }
|
| - // The bounds() just mirror the pile size.
|
| - pending_layer->SetBounds(pending_layer->pile()->tiling_size());
|
| + scoped_ptr<FakePictureLayerImpl> pending_layer =
|
| + FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile);
|
| + pending_layer->SetDrawsContent(true);
|
| pending_tree->SetRootLayer(pending_layer.Pass());
|
|
|
| pending_layer_ = static_cast<FakePictureLayerImpl*>(
|
| @@ -2037,62 +2026,6 @@ TEST_F(PictureLayerImplTest, ActivateUninitializedLayer) {
|
| EXPECT_FALSE(active_layer_->needs_post_commit_initialization());
|
| }
|
|
|
| -TEST_F(PictureLayerImplTest, ShareTilesOnNextFrame) {
|
| - SetupDefaultTrees(gfx::Size(1500, 1500));
|
| -
|
| - PictureLayerTiling* tiling = pending_layer_->AddTiling(1.f);
|
| - gfx::Rect first_invalidate = tiling->TilingDataForTesting().TileBounds(0, 0);
|
| - first_invalidate.Inset(tiling->TilingDataForTesting().border_texels(),
|
| - tiling->TilingDataForTesting().border_texels());
|
| - gfx::Rect second_invalidate = tiling->TilingDataForTesting().TileBounds(1, 1);
|
| - second_invalidate.Inset(tiling->TilingDataForTesting().border_texels(),
|
| - tiling->TilingDataForTesting().border_texels());
|
| -
|
| - // Make a pending tree with an invalidated raster tile 0,0.
|
| - tiling->CreateAllTilesForTesting();
|
| - pending_layer_->set_invalidation(first_invalidate);
|
| -
|
| - // Activate and make a pending tree with an invalidated raster tile 1,1.
|
| - ActivateTree();
|
| -
|
| - host_impl_.CreatePendingTree();
|
| - pending_layer_ = static_cast<FakePictureLayerImpl*>(
|
| - host_impl_.pending_tree()->root_layer());
|
| - pending_layer_->set_invalidation(second_invalidate);
|
| -
|
| - PictureLayerTiling* pending_tiling = pending_layer_->tilings()->tiling_at(0);
|
| - PictureLayerTiling* active_tiling = active_layer_->tilings()->tiling_at(0);
|
| -
|
| - pending_tiling->CreateAllTilesForTesting();
|
| -
|
| - // Tile 0,0 should be shared, but tile 1,1 should not be.
|
| - 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_NE(active_tiling->TileAt(1, 1), pending_tiling->TileAt(1, 1));
|
| - EXPECT_TRUE(pending_tiling->TileAt(0, 0)->is_shared());
|
| - EXPECT_TRUE(pending_tiling->TileAt(1, 0)->is_shared());
|
| - EXPECT_TRUE(pending_tiling->TileAt(0, 1)->is_shared());
|
| - EXPECT_FALSE(pending_tiling->TileAt(1, 1)->is_shared());
|
| -
|
| - // Drop the tiles on the active tree and recreate them. The same tiles
|
| - // should be shared or not.
|
| - active_tiling->ComputeTilePriorityRects(
|
| - ACTIVE_TREE, gfx::Rect(), 1.f, 1.0, Occlusion());
|
| - EXPECT_TRUE(active_tiling->AllTilesForTesting().empty());
|
| - active_tiling->CreateAllTilesForTesting();
|
| -
|
| - // Tile 0,0 should be shared, but tile 1,1 should not be.
|
| - 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_NE(active_tiling->TileAt(1, 1), pending_tiling->TileAt(1, 1));
|
| - EXPECT_TRUE(pending_tiling->TileAt(0, 0)->is_shared());
|
| - EXPECT_TRUE(pending_tiling->TileAt(1, 0)->is_shared());
|
| - EXPECT_TRUE(pending_tiling->TileAt(0, 1)->is_shared());
|
| - EXPECT_FALSE(pending_tiling->TileAt(1, 1)->is_shared());
|
| -}
|
| -
|
| TEST_F(PictureLayerImplTest, ShareTilesOnSync) {
|
| SetupDefaultTrees(gfx::Size(1500, 1500));
|
| AddDefaultTilingsWithInvalidation(gfx::Rect());
|
| @@ -2315,11 +2248,12 @@ TEST_F(PictureLayerImplTest, HighResCreatedWhenBoundsShrink) {
|
| // other words we want the pending layer to sync from the active layer.
|
| pending_layer_->SetBounds(gfx::Size(1, 1));
|
| pending_layer_->SetNeedsPostCommitInitialization();
|
| + pending_layer_->set_twin_layer(nullptr);
|
| + active_layer_->set_twin_layer(nullptr);
|
| EXPECT_TRUE(pending_layer_->needs_post_commit_initialization());
|
|
|
| // Update the draw properties: sync from active tree should happen here.
|
| host_impl_.pending_tree()->UpdateDrawProperties();
|
| - EXPECT_FALSE(pending_layer_->needs_post_commit_initialization());
|
|
|
| // Another sanity check.
|
| ASSERT_EQ(1.f, pending_layer_->MinimumContentsScale());
|
| @@ -4209,8 +4143,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, DifferentOcclusionOnTrees) {
|
| // All tiles are unoccluded on the pending tree.
|
| EXPECT_FALSE(tile->is_occluded(PENDING_TREE));
|
|
|
| - Tile* twin_tile = pending_layer_->GetPendingOrActiveTwinTiling(tiling)
|
| - ->TileAt(iter.i(), iter.j());
|
| + Tile* twin_tile =
|
| + pending_layer_->GetTwinTiling(tiling)->TileAt(iter.i(), iter.j());
|
| gfx::Rect scaled_content_rect = ScaleToEnclosingRect(
|
| tile->content_rect(), 1.0f / tile->contents_scale());
|
|
|
| @@ -4244,8 +4178,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, DifferentOcclusionOnTrees) {
|
| continue;
|
| const Tile* tile = *iter;
|
|
|
| - Tile* twin_tile = active_layer_->GetPendingOrActiveTwinTiling(tiling)
|
| - ->TileAt(iter.i(), iter.j());
|
| + Tile* twin_tile =
|
| + active_layer_->GetTwinTiling(tiling)->TileAt(iter.i(), iter.j());
|
| gfx::Rect scaled_content_rect = ScaleToEnclosingRect(
|
| tile->content_rect(), 1.0f / tile->contents_scale());
|
|
|
| @@ -4422,33 +4356,6 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
|
| total_expected_occluded_tile_count);
|
| }
|
|
|
| -TEST_F(PictureLayerImplTest, PendingOrActiveTwinLayer) {
|
| - gfx::Size tile_size(102, 102);
|
| - gfx::Size layer_bounds(1000, 1000);
|
| -
|
| - scoped_refptr<FakePicturePileImpl> pile =
|
| - FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| - SetupPendingTree(pile);
|
| - EXPECT_FALSE(pending_layer_->GetPendingOrActiveTwinLayer());
|
| -
|
| - ActivateTree();
|
| - EXPECT_FALSE(active_layer_->GetPendingOrActiveTwinLayer());
|
| -
|
| - SetupPendingTree(pile);
|
| - EXPECT_TRUE(pending_layer_->GetPendingOrActiveTwinLayer());
|
| - EXPECT_TRUE(active_layer_->GetPendingOrActiveTwinLayer());
|
| - EXPECT_EQ(pending_layer_, active_layer_->GetPendingOrActiveTwinLayer());
|
| - EXPECT_EQ(active_layer_, pending_layer_->GetPendingOrActiveTwinLayer());
|
| -
|
| - ActivateTree();
|
| - EXPECT_FALSE(active_layer_->GetPendingOrActiveTwinLayer());
|
| -
|
| - // Make an empty pending tree.
|
| - host_impl_.CreatePendingTree();
|
| - host_impl_.pending_tree()->DetachLayerTree();
|
| - EXPECT_FALSE(active_layer_->GetPendingOrActiveTwinLayer());
|
| -}
|
| -
|
| TEST_F(PictureLayerImplTest, RecycledTwinLayer) {
|
| gfx::Size tile_size(102, 102);
|
| gfx::Size layer_bounds(1000, 1000);
|
| @@ -4470,9 +4377,7 @@ TEST_F(PictureLayerImplTest, RecycledTwinLayer) {
|
| EXPECT_TRUE(active_layer_->GetRecycledTwinLayer());
|
| EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer());
|
|
|
| - // Make an empty pending tree.
|
| - host_impl_.CreatePendingTree();
|
| - host_impl_.pending_tree()->DetachLayerTree();
|
| + host_impl_.ResetRecycleTreeForTesting();
|
| EXPECT_FALSE(active_layer_->GetRecycledTwinLayer());
|
| }
|
|
|
|
|