OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/resources/eviction_tile_priority_queue.h" | 5 #include "cc/resources/eviction_tile_priority_queue.h" |
6 #include "cc/resources/raster_tile_priority_queue.h" | 6 #include "cc/resources/raster_tile_priority_queue.h" |
7 #include "cc/resources/tile.h" | 7 #include "cc/resources/tile.h" |
8 #include "cc/resources/tile_priority.h" | 8 #include "cc/resources/tile_priority.h" |
9 #include "cc/test/begin_frame_args_test.h" | 9 #include "cc/test/begin_frame_args_test.h" |
10 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 host_impl_.BuildEvictionQueue(&queue, SMOOTHNESS_TAKES_PRIORITY); | 407 host_impl_.BuildEvictionQueue(&queue, SMOOTHNESS_TAKES_PRIORITY); |
408 EXPECT_FALSE(queue.IsEmpty()); | 408 EXPECT_FALSE(queue.IsEmpty()); |
409 | 409 |
410 // Sanity check, all tiles should be visible. | 410 // Sanity check, all tiles should be visible. |
411 std::set<Tile*> smoothness_tiles; | 411 std::set<Tile*> smoothness_tiles; |
412 while (!queue.IsEmpty()) { | 412 while (!queue.IsEmpty()) { |
413 Tile* tile = queue.Top(); | 413 Tile* tile = queue.Top(); |
414 EXPECT_TRUE(tile); | 414 EXPECT_TRUE(tile); |
415 EXPECT_EQ(TilePriority::NOW, tile->priority(ACTIVE_TREE).priority_bin); | 415 EXPECT_EQ(TilePriority::NOW, tile->priority(ACTIVE_TREE).priority_bin); |
416 EXPECT_EQ(TilePriority::NOW, tile->priority(PENDING_TREE).priority_bin); | 416 EXPECT_EQ(TilePriority::NOW, tile->priority(PENDING_TREE).priority_bin); |
417 EXPECT_TRUE(tile->HasResources()); | 417 EXPECT_TRUE(tile->HasResource()); |
418 smoothness_tiles.insert(tile); | 418 smoothness_tiles.insert(tile); |
419 queue.Pop(); | 419 queue.Pop(); |
420 } | 420 } |
421 EXPECT_EQ(all_tiles, smoothness_tiles); | 421 EXPECT_EQ(all_tiles, smoothness_tiles); |
422 | 422 |
423 tile_manager()->ReleaseTileResourcesForTesting( | 423 tile_manager()->ReleaseTileResourcesForTesting( |
424 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); | 424 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); |
425 | 425 |
426 Region invalidation(gfx::Rect(0, 0, 500, 500)); | 426 Region invalidation(gfx::Rect(0, 0, 500, 500)); |
427 | 427 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 smoothness_tiles.clear(); | 473 smoothness_tiles.clear(); |
474 tile_count = 0; | 474 tile_count = 0; |
475 // Here we expect to get increasing ACTIVE_TREE priority_bin. | 475 // Here we expect to get increasing ACTIVE_TREE priority_bin. |
476 queue.Reset(); | 476 queue.Reset(); |
477 host_impl_.BuildEvictionQueue(&queue, SMOOTHNESS_TAKES_PRIORITY); | 477 host_impl_.BuildEvictionQueue(&queue, SMOOTHNESS_TAKES_PRIORITY); |
478 int distance_increasing = 0; | 478 int distance_increasing = 0; |
479 int distance_decreasing = 0; | 479 int distance_decreasing = 0; |
480 while (!queue.IsEmpty()) { | 480 while (!queue.IsEmpty()) { |
481 Tile* tile = queue.Top(); | 481 Tile* tile = queue.Top(); |
482 EXPECT_TRUE(tile); | 482 EXPECT_TRUE(tile); |
483 EXPECT_TRUE(tile->HasResources()); | 483 EXPECT_TRUE(tile->HasResource()); |
484 | 484 |
485 if (!last_tile) | 485 if (!last_tile) |
486 last_tile = tile; | 486 last_tile = tile; |
487 | 487 |
488 EXPECT_GE(last_tile->priority(ACTIVE_TREE).priority_bin, | 488 EXPECT_GE(last_tile->priority(ACTIVE_TREE).priority_bin, |
489 tile->priority(ACTIVE_TREE).priority_bin); | 489 tile->priority(ACTIVE_TREE).priority_bin); |
490 if (last_tile->priority(ACTIVE_TREE).priority_bin == | 490 if (last_tile->priority(ACTIVE_TREE).priority_bin == |
491 tile->priority(ACTIVE_TREE).priority_bin) { | 491 tile->priority(ACTIVE_TREE).priority_bin) { |
492 EXPECT_LE(last_tile->required_for_activation(), | 492 EXPECT_LE(last_tile->required_for_activation(), |
493 tile->required_for_activation()); | 493 tile->required_for_activation()); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 all_tiles.insert(queue.Top()); | 872 all_tiles.insert(queue.Top()); |
873 ++tile_count; | 873 ++tile_count; |
874 queue.Pop(); | 874 queue.Pop(); |
875 } | 875 } |
876 EXPECT_EQ(tile_count, all_tiles.size()); | 876 EXPECT_EQ(tile_count, all_tiles.size()); |
877 EXPECT_EQ(16u, tile_count); | 877 EXPECT_EQ(16u, tile_count); |
878 } | 878 } |
879 | 879 |
880 } // namespace | 880 } // namespace |
881 } // namespace cc | 881 } // namespace cc |
OLD | NEW |