| Index: cc/resources/tile_manager_unittest.cc
|
| diff --git a/cc/resources/tile_manager_unittest.cc b/cc/resources/tile_manager_unittest.cc
|
| index 2f0735c33d332055641cb5baf83e788169f1af25..a25367201771d0837ceb54feffc1826dfa29fcaf 100644
|
| --- a/cc/resources/tile_manager_unittest.cc
|
| +++ b/cc/resources/tile_manager_unittest.cc
|
| @@ -109,14 +109,14 @@ class TileManagerTilePriorityQueueTest : public testing::Test {
|
| if (old_pending_root) {
|
| pending_layer.reset(
|
| static_cast<FakePictureLayerImpl*>(old_pending_root.release()));
|
| - pending_layer->SetPile(pile);
|
| + pending_layer->SetRasterSource(pile);
|
| } else {
|
| pending_layer =
|
| - FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile);
|
| + FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_, pile);
|
| pending_layer->SetDrawsContent(true);
|
| }
|
| // The bounds() just mirror the pile size.
|
| - pending_layer->SetBounds(pending_layer->pile()->tiling_size());
|
| + pending_layer->SetBounds(pending_layer->raster_source()->GetSize());
|
| pending_tree->SetRootLayer(pending_layer.Pass());
|
|
|
| pending_layer_ = static_cast<FakePictureLayerImpl*>(
|
| @@ -193,9 +193,9 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) {
|
|
|
| // Invalidate the pending tree.
|
| pending_layer_->set_invalidation(invalidation);
|
| - pending_layer_->HighResTiling()->UpdateTilesToCurrentPile(
|
| + pending_layer_->HighResTiling()->UpdateTilesToCurrentRasterSource(
|
| invalidation, gfx::Size(1000, 1000));
|
| - pending_layer_->LowResTiling()->UpdateTilesToCurrentPile(
|
| + pending_layer_->LowResTiling()->UpdateTilesToCurrentRasterSource(
|
| invalidation, gfx::Size(1000, 1000));
|
|
|
| active_layer_->ResetAllTilesPriorities();
|
| @@ -344,8 +344,8 @@ TEST_F(TileManagerTilePriorityQueueTest, ActivationComesBeforeEventually) {
|
| scoped_refptr<FakePicturePileImpl> pending_pile =
|
| FakePicturePileImpl::CreateFilledPile(tile_size, gfx::Size(1000, 1000));
|
| scoped_ptr<FakePictureLayerImpl> pending_child =
|
| - FakePictureLayerImpl::CreateWithPile(
|
| - host_impl_.pending_tree(), id_ + 1, pending_pile);
|
| + FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(),
|
| + id_ + 1, pending_pile);
|
| pending_layer_->AddChild(pending_child.Pass());
|
| FakePictureLayerImpl* pending_child_raw = static_cast<FakePictureLayerImpl*>(
|
| host_impl_.pending_tree()->LayerById(id_ + 1));
|
| @@ -441,9 +441,9 @@ TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueue) {
|
|
|
| // Invalidate the pending tree.
|
| pending_layer_->set_invalidation(invalidation);
|
| - pending_layer_->HighResTiling()->UpdateTilesToCurrentPile(
|
| + pending_layer_->HighResTiling()->UpdateTilesToCurrentRasterSource(
|
| invalidation, gfx::Size(1000, 1000));
|
| - pending_layer_->LowResTiling()->UpdateTilesToCurrentPile(
|
| + pending_layer_->LowResTiling()->UpdateTilesToCurrentRasterSource(
|
| invalidation, gfx::Size(1000, 1000));
|
|
|
| active_layer_->ResetAllTilesPriorities();
|
| @@ -566,8 +566,8 @@ TEST_F(TileManagerTilePriorityQueueTest,
|
| pending_layer_->CreateDefaultTilingsAndTiles();
|
|
|
| scoped_ptr<FakePictureLayerImpl> pending_child =
|
| - FakePictureLayerImpl::CreateWithPile(
|
| - host_impl_.pending_tree(), 2, pending_pile);
|
| + FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 2,
|
| + pending_pile);
|
| pending_layer_->AddChild(pending_child.Pass());
|
|
|
| FakePictureLayerImpl* pending_child_layer =
|
| @@ -669,6 +669,104 @@ TEST_F(TileManagerTilePriorityQueueTest,
|
| EXPECT_EQ(expected_occluded_count, occluded_count);
|
| }
|
|
|
| +TEST_F(TileManagerTilePriorityQueueTest,
|
| + EvictionTilePriorityQueueWithTransparentLayer) {
|
| + gfx::Size tile_size(102, 102);
|
| + gfx::Size layer_bounds(1000, 1000);
|
| +
|
| + scoped_refptr<FakePicturePileImpl> pending_pile =
|
| + FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
|
| + SetupPendingTree(pending_pile);
|
| + pending_layer_->CreateDefaultTilingsAndTiles();
|
| +
|
| + scoped_ptr<FakePictureLayerImpl> pending_child =
|
| + FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 2,
|
| + pending_pile);
|
| + pending_layer_->AddChild(pending_child.Pass());
|
| +
|
| + // Create a fully transparent child layer so that its tile priorities are not
|
| + // considered to be valid.
|
| + FakePictureLayerImpl* pending_child_layer =
|
| + static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0]);
|
| + pending_child_layer->SetDrawsContent(true);
|
| + pending_child_layer->CreateDefaultTilingsAndTiles();
|
| + pending_child_layer->SetOpacity(0.0);
|
| + pending_child_layer->layer_tree_impl()->UpdateDrawProperties();
|
| + pending_child_layer->DoPostCommitInitializationIfNeeded();
|
| +
|
| + // Renew all of the tile priorities.
|
| + gfx::Rect viewport(layer_bounds);
|
| + pending_layer_->HighResTiling()->ComputeTilePriorityRects(
|
| + PENDING_TREE, viewport, 1.0f, 1.0, Occlusion());
|
| + pending_layer_->LowResTiling()->ComputeTilePriorityRects(
|
| + PENDING_TREE, viewport, 1.0f, 1.0, Occlusion());
|
| + pending_child_layer->HighResTiling()->ComputeTilePriorityRects(
|
| + PENDING_TREE, viewport, 1.0f, 1.0, Occlusion());
|
| + pending_child_layer->LowResTiling()->ComputeTilePriorityRects(
|
| + PENDING_TREE, viewport, 1.0f, 1.0, Occlusion());
|
| +
|
| + // Populate all tiles directly from the tilings.
|
| + std::set<Tile*> all_pending_tiles;
|
| + std::vector<Tile*> pending_high_res_tiles =
|
| + pending_layer_->HighResTiling()->AllTilesForTesting();
|
| + all_pending_tiles.insert(pending_high_res_tiles.begin(),
|
| + pending_high_res_tiles.end());
|
| + EXPECT_EQ(16u, pending_high_res_tiles.size());
|
| +
|
| + std::vector<Tile*> pending_low_res_tiles =
|
| + pending_layer_->LowResTiling()->AllTilesForTesting();
|
| + all_pending_tiles.insert(pending_low_res_tiles.begin(),
|
| + pending_low_res_tiles.end());
|
| + EXPECT_EQ(1u, pending_low_res_tiles.size());
|
| +
|
| + std::set<Tile*> all_pending_child_tiles;
|
| + std::vector<Tile*> pending_child_high_res_tiles =
|
| + pending_child_layer->HighResTiling()->AllTilesForTesting();
|
| + all_pending_child_tiles.insert(pending_child_high_res_tiles.begin(),
|
| + pending_child_high_res_tiles.end());
|
| + EXPECT_EQ(16u, pending_child_high_res_tiles.size());
|
| +
|
| + std::vector<Tile*> pending_child_low_res_tiles =
|
| + pending_child_layer->LowResTiling()->AllTilesForTesting();
|
| + all_pending_child_tiles.insert(pending_child_low_res_tiles.begin(),
|
| + pending_child_low_res_tiles.end());
|
| + EXPECT_EQ(1u, pending_child_low_res_tiles.size());
|
| +
|
| + std::set<Tile*> all_tiles = all_pending_tiles;
|
| + all_tiles.insert(all_pending_child_tiles.begin(),
|
| + all_pending_child_tiles.end());
|
| +
|
| + tile_manager()->InitializeTilesWithResourcesForTesting(
|
| + std::vector<Tile*>(all_tiles.begin(), all_tiles.end()));
|
| +
|
| + EXPECT_TRUE(pending_layer_->HasValidTilePriorities());
|
| + EXPECT_FALSE(pending_child_layer->HasValidTilePriorities());
|
| +
|
| + // Verify that eviction queue returns tiles also from layers without valid
|
| + // tile priorities and that the tile priority bin of those tiles is (at most)
|
| + // EVENTUALLY.
|
| + TreePriority tree_priority = NEW_CONTENT_TAKES_PRIORITY;
|
| + std::set<Tile*> new_content_tiles;
|
| + size_t tile_count = 0;
|
| + EvictionTilePriorityQueue queue;
|
| + host_impl_.BuildEvictionQueue(&queue, tree_priority);
|
| + while (!queue.IsEmpty()) {
|
| + Tile* tile = queue.Top();
|
| + const TilePriority& pending_priority = tile->priority(PENDING_TREE);
|
| + EXPECT_NE(std::numeric_limits<float>::infinity(),
|
| + pending_priority.distance_to_visible);
|
| + if (all_pending_child_tiles.find(tile) != all_pending_child_tiles.end())
|
| + EXPECT_EQ(TilePriority::EVENTUALLY, pending_priority.priority_bin);
|
| + else
|
| + EXPECT_EQ(TilePriority::NOW, pending_priority.priority_bin);
|
| + new_content_tiles.insert(tile);
|
| + ++tile_count;
|
| + queue.Pop();
|
| + }
|
| + EXPECT_EQ(tile_count, new_content_tiles.size());
|
| + EXPECT_EQ(all_tiles, new_content_tiles);
|
| +}
|
| +
|
| TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueEmptyLayers) {
|
| SetupDefaultTrees(gfx::Size(1000, 1000));
|
|
|
|
|