| Index: cc/resources/tile_manager_unittest.cc
|
| diff --git a/cc/resources/tile_manager_unittest.cc b/cc/resources/tile_manager_unittest.cc
|
| index e9562c94f14c564a655cf9036e7ac22759fdac88..f6492a473615c06103c7946bf0f3794924773fd1 100644
|
| --- a/cc/resources/tile_manager_unittest.cc
|
| +++ b/cc/resources/tile_manager_unittest.cc
|
| @@ -150,7 +150,8 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) {
|
| SetupDefaultTrees(layer_bounds);
|
|
|
| RasterTilePriorityQueue queue;
|
| - host_impl_.BuildRasterQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES);
|
| + host_impl_.BuildRasterQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES,
|
| + RasterTilePriorityQueue::Type::ALL);
|
| EXPECT_FALSE(queue.IsEmpty());
|
|
|
| size_t tile_count = 0;
|
| @@ -168,7 +169,8 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) {
|
| // Sanity check, all tiles should be visible.
|
| std::set<Tile*> smoothness_tiles;
|
| queue.Reset();
|
| - host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY);
|
| + host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY,
|
| + RasterTilePriorityQueue::Type::ALL);
|
| bool had_low_res = false;
|
| while (!queue.IsEmpty()) {
|
| Tile* tile = queue.Top();
|
| @@ -184,6 +186,33 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) {
|
| EXPECT_EQ(all_tiles, smoothness_tiles);
|
| EXPECT_TRUE(had_low_res);
|
|
|
| + // Check that everything is required for activation.
|
| + queue.Reset();
|
| + host_impl_.BuildRasterQueue(
|
| + &queue, SMOOTHNESS_TAKES_PRIORITY,
|
| + RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION);
|
| + std::set<Tile*> required_for_activation_tiles;
|
| + while (!queue.IsEmpty()) {
|
| + Tile* tile = queue.Top();
|
| + EXPECT_TRUE(tile->required_for_activation());
|
| + required_for_activation_tiles.insert(tile);
|
| + queue.Pop();
|
| + }
|
| + EXPECT_EQ(all_tiles, required_for_activation_tiles);
|
| +
|
| + // Check that everything is required for draw.
|
| + queue.Reset();
|
| + host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY,
|
| + RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW);
|
| + std::set<Tile*> required_for_draw_tiles;
|
| + while (!queue.IsEmpty()) {
|
| + Tile* tile = queue.Top();
|
| + EXPECT_TRUE(tile->required_for_draw());
|
| + required_for_draw_tiles.insert(tile);
|
| + queue.Pop();
|
| + }
|
| + EXPECT_EQ(all_tiles, required_for_draw_tiles);
|
| +
|
| Region invalidation(gfx::Rect(0, 0, 500, 500));
|
|
|
| // Invalidate the pending tree.
|
| @@ -238,7 +267,10 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) {
|
| size_t correct_order_tiles = 0u;
|
| // Here we expect to get increasing ACTIVE_TREE priority_bin.
|
| queue.Reset();
|
| - host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY);
|
| + host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY,
|
| + RasterTilePriorityQueue::Type::ALL);
|
| + std::set<Tile*> actual_required_for_draw_tiles;
|
| + std::set<Tile*> actual_required_for_activation_tiles;
|
| while (!queue.IsEmpty()) {
|
| Tile* tile = queue.Top();
|
| EXPECT_TRUE(tile);
|
| @@ -274,6 +306,10 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) {
|
| last_tile = tile;
|
| ++tile_count;
|
| smoothness_tiles.insert(tile);
|
| + if (tile->required_for_draw())
|
| + actual_required_for_draw_tiles.insert(tile);
|
| + if (tile->required_for_activation())
|
| + actual_required_for_activation_tiles.insert(tile);
|
| queue.Pop();
|
| }
|
|
|
| @@ -283,12 +319,41 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) {
|
| // should check that we're _mostly_ right.
|
| EXPECT_GT(correct_order_tiles, 3 * tile_count / 4);
|
|
|
| + // Check that we have consistent required_for_activation tiles.
|
| + queue.Reset();
|
| + host_impl_.BuildRasterQueue(
|
| + &queue, SMOOTHNESS_TAKES_PRIORITY,
|
| + RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION);
|
| + required_for_activation_tiles.clear();
|
| + while (!queue.IsEmpty()) {
|
| + Tile* tile = queue.Top();
|
| + EXPECT_TRUE(tile->required_for_activation());
|
| + required_for_activation_tiles.insert(tile);
|
| + queue.Pop();
|
| + }
|
| + EXPECT_EQ(actual_required_for_activation_tiles,
|
| + required_for_activation_tiles);
|
| +
|
| + // Check that we have consistent required_for_draw tiles.
|
| + queue.Reset();
|
| + host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY,
|
| + RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW);
|
| + required_for_draw_tiles.clear();
|
| + while (!queue.IsEmpty()) {
|
| + Tile* tile = queue.Top();
|
| + EXPECT_TRUE(tile->required_for_draw());
|
| + required_for_draw_tiles.insert(tile);
|
| + queue.Pop();
|
| + }
|
| + EXPECT_EQ(actual_required_for_draw_tiles, required_for_draw_tiles);
|
| +
|
| std::set<Tile*> new_content_tiles;
|
| last_tile = NULL;
|
| size_t increasing_distance_tiles = 0u;
|
| // Here we expect to get increasing PENDING_TREE priority_bin.
|
| queue.Reset();
|
| - host_impl_.BuildRasterQueue(&queue, NEW_CONTENT_TAKES_PRIORITY);
|
| + host_impl_.BuildRasterQueue(&queue, NEW_CONTENT_TAKES_PRIORITY,
|
| + RasterTilePriorityQueue::Type::ALL);
|
| tile_count = 0;
|
| while (!queue.IsEmpty()) {
|
| Tile* tile = queue.Top();
|
| @@ -324,6 +389,34 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) {
|
| // Since we don't guarantee increasing distance due to spiral iterator, we
|
| // should check that we're _mostly_ right.
|
| EXPECT_GE(increasing_distance_tiles, 3 * tile_count / 4);
|
| +
|
| + // Check that we have consistent required_for_activation tiles.
|
| + queue.Reset();
|
| + host_impl_.BuildRasterQueue(
|
| + &queue, NEW_CONTENT_TAKES_PRIORITY,
|
| + RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION);
|
| + required_for_activation_tiles.clear();
|
| + while (!queue.IsEmpty()) {
|
| + Tile* tile = queue.Top();
|
| + EXPECT_TRUE(tile->required_for_activation());
|
| + required_for_activation_tiles.insert(tile);
|
| + queue.Pop();
|
| + }
|
| + EXPECT_EQ(actual_required_for_activation_tiles,
|
| + required_for_activation_tiles);
|
| +
|
| + // Check that we have consistent required_for_draw tiles.
|
| + queue.Reset();
|
| + host_impl_.BuildRasterQueue(&queue, NEW_CONTENT_TAKES_PRIORITY,
|
| + RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW);
|
| + required_for_draw_tiles.clear();
|
| + while (!queue.IsEmpty()) {
|
| + Tile* tile = queue.Top();
|
| + EXPECT_TRUE(tile->required_for_draw());
|
| + required_for_draw_tiles.insert(tile);
|
| + queue.Pop();
|
| + }
|
| + EXPECT_EQ(actual_required_for_draw_tiles, required_for_draw_tiles);
|
| }
|
|
|
| TEST_F(TileManagerTilePriorityQueueTest, ActivationComesBeforeEventually) {
|
| @@ -355,7 +448,8 @@ TEST_F(TileManagerTilePriorityQueueTest, ActivationComesBeforeEventually) {
|
|
|
| RasterTilePriorityQueue queue;
|
| host_impl_.SetRequiresHighResToDraw();
|
| - host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY);
|
| + host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY,
|
| + RasterTilePriorityQueue::Type::ALL);
|
| EXPECT_FALSE(queue.IsEmpty());
|
|
|
| // Get all the tiles that are NOW or SOON and make sure they are ready to
|
| @@ -390,7 +484,8 @@ TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueue) {
|
| size_t tile_count = 0;
|
|
|
| RasterTilePriorityQueue raster_queue;
|
| - host_impl_.BuildRasterQueue(&raster_queue, SAME_PRIORITY_FOR_BOTH_TREES);
|
| + host_impl_.BuildRasterQueue(&raster_queue, SAME_PRIORITY_FOR_BOTH_TREES,
|
| + RasterTilePriorityQueue::Type::ALL);
|
| while (!raster_queue.IsEmpty()) {
|
| ++tile_count;
|
| EXPECT_TRUE(raster_queue.Top());
|
| @@ -587,7 +682,8 @@ TEST_F(TileManagerTilePriorityQueueTest,
|
| std::set<Tile*> all_tiles;
|
| size_t tile_count = 0;
|
| RasterTilePriorityQueue raster_queue;
|
| - host_impl_.BuildRasterQueue(&raster_queue, SAME_PRIORITY_FOR_BOTH_TREES);
|
| + host_impl_.BuildRasterQueue(&raster_queue, SAME_PRIORITY_FOR_BOTH_TREES,
|
| + RasterTilePriorityQueue::Type::ALL);
|
| while (!raster_queue.IsEmpty()) {
|
| ++tile_count;
|
| EXPECT_TRUE(raster_queue.Top());
|
| @@ -792,7 +888,8 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueEmptyLayers) {
|
| SetupDefaultTrees(layer_bounds);
|
|
|
| RasterTilePriorityQueue queue;
|
| - host_impl_.BuildRasterQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES);
|
| + host_impl_.BuildRasterQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES,
|
| + RasterTilePriorityQueue::Type::ALL);
|
| EXPECT_FALSE(queue.IsEmpty());
|
|
|
| size_t tile_count = 0;
|
| @@ -816,7 +913,8 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueEmptyLayers) {
|
| pending_layer_->AddChild(pending_layer.Pass());
|
| }
|
|
|
| - host_impl_.BuildRasterQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES);
|
| + host_impl_.BuildRasterQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES,
|
| + RasterTilePriorityQueue::Type::ALL);
|
| EXPECT_FALSE(queue.IsEmpty());
|
|
|
| tile_count = 0;
|
| @@ -837,7 +935,8 @@ TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueueEmptyLayers) {
|
| SetupDefaultTrees(layer_bounds);
|
|
|
| RasterTilePriorityQueue raster_queue;
|
| - host_impl_.BuildRasterQueue(&raster_queue, SAME_PRIORITY_FOR_BOTH_TREES);
|
| + host_impl_.BuildRasterQueue(&raster_queue, SAME_PRIORITY_FOR_BOTH_TREES,
|
| + RasterTilePriorityQueue::Type::ALL);
|
| EXPECT_FALSE(raster_queue.IsEmpty());
|
|
|
| size_t tile_count = 0;
|
|
|