| Index: cc/resources/tile_manager_perftest.cc
|
| diff --git a/cc/resources/tile_manager_perftest.cc b/cc/resources/tile_manager_perftest.cc
|
| index 0c7b40a77895b190f749cb34eb1e9620603b7553..8e2fd3e6a724657e40b4a597dd9ce38d62bcd706 100644
|
| --- a/cc/resources/tile_manager_perftest.cc
|
| +++ b/cc/resources/tile_manager_perftest.cc
|
| @@ -225,6 +225,56 @@ class TileManagerPerfTest : public testing::Test {
|
| true);
|
| }
|
|
|
| + void RunEvictionQueueConstructTest(const std::string& test_name) {
|
| + TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
|
| + SMOOTHNESS_TAKES_PRIORITY,
|
| + NEW_CONTENT_TAKES_PRIORITY};
|
| + int priority_count = 0;
|
| + timer_.Reset();
|
| + do {
|
| + EvictionTilePriorityQueue queue;
|
| + host_impl_.BuildEvictionQueue(&queue, priorities[priority_count]);
|
| + priority_count = (priority_count + 1) % arraysize(priorities);
|
| + timer_.NextLap();
|
| + } while (!timer_.HasTimeLimitExpired());
|
| +
|
| + perf_test::PrintResult("tile_manager_eviction_tile_queue_construct",
|
| + "",
|
| + test_name,
|
| + timer_.LapsPerSecond(),
|
| + "runs/s",
|
| + true);
|
| + }
|
| +
|
| + void RunEvictionQueueConstructAndIterateTest(const std::string& test_name,
|
| + unsigned tile_count) {
|
| + TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
|
| + SMOOTHNESS_TAKES_PRIORITY,
|
| + NEW_CONTENT_TAKES_PRIORITY};
|
| + int priority_count = 0;
|
| + timer_.Reset();
|
| + do {
|
| + int count = tile_count;
|
| + EvictionTilePriorityQueue queue;
|
| + host_impl_.BuildEvictionQueue(&queue, priorities[priority_count]);
|
| + while (count--) {
|
| + ASSERT_FALSE(queue.IsEmpty());
|
| + ASSERT_TRUE(queue.Top() != NULL);
|
| + queue.Pop();
|
| + }
|
| + priority_count = (priority_count + 1) % arraysize(priorities);
|
| + timer_.NextLap();
|
| + } while (!timer_.HasTimeLimitExpired());
|
| +
|
| + perf_test::PrintResult(
|
| + "tile_manager_eviction_tile_queue_construct_and_iterate",
|
| + "",
|
| + test_name,
|
| + timer_.LapsPerSecond(),
|
| + "runs/s",
|
| + true);
|
| + }
|
| +
|
| std::vector<LayerImpl*> CreateLayers(int layer_count,
|
| int tiles_per_layer_count) {
|
| // Compute the width/height required for high res to get
|
| @@ -386,6 +436,64 @@ TEST_F(TileManagerPerfTest, RasterTileQueueConstructAndIterate) {
|
| RunRasterQueueConstructAndIterateTest("2_128", 128);
|
| }
|
|
|
| +TEST_F(TileManagerPerfTest, EvictionTileQueueConstruct) {
|
| + SetupDefaultTrees(gfx::Size(1000, 1000));
|
| + active_root_layer_->CreateDefaultTilingsAndTiles();
|
| + for (size_t i = 0; i < active_root_layer_->GetTilings()->num_tilings(); ++i) {
|
| + tile_manager()->InitializeTilesWithResourcesForTesting(
|
| + active_root_layer_->GetTilings()->tiling_at(i)->AllTilesForTesting());
|
| + }
|
| + pending_root_layer_->CreateDefaultTilingsAndTiles();
|
| + for (size_t i = 0; i < pending_root_layer_->GetTilings()->num_tilings();
|
| + ++i) {
|
| + tile_manager()->InitializeTilesWithResourcesForTesting(
|
| + pending_root_layer_->GetTilings()->tiling_at(i)->AllTilesForTesting());
|
| + }
|
| +
|
| + RunEvictionQueueConstructTest("2");
|
| +
|
| + int number_of_tilings = 2;
|
| + for (; number_of_tilings < 10; ++number_of_tilings) {
|
| + PictureLayerTiling* tiling =
|
| + active_root_layer_->AddTiling(1.0f + number_of_tilings * 0.3f);
|
| + tiling->CreateAllTilesForTesting();
|
| + tile_manager()->InitializeTilesWithResourcesForTesting(
|
| + tiling->AllTilesForTesting());
|
| + }
|
| +
|
| + RunEvictionQueueConstructTest("10");
|
| +
|
| + for (; number_of_tilings < 50; ++number_of_tilings) {
|
| + PictureLayerTiling* tiling =
|
| + active_root_layer_->AddTiling(1.0f + number_of_tilings * 0.3f);
|
| + tiling->CreateAllTilesForTesting();
|
| + tile_manager()->InitializeTilesWithResourcesForTesting(
|
| + tiling->AllTilesForTesting());
|
| + }
|
| +
|
| + RunEvictionQueueConstructTest("50");
|
| +}
|
| +
|
| +TEST_F(TileManagerPerfTest, EvictionTileQueueConstructAndIterate) {
|
| + SetupDefaultTrees(gfx::Size(10000, 10000));
|
| + active_root_layer_->CreateDefaultTilingsAndTiles();
|
| + for (size_t i = 0; i < active_root_layer_->GetTilings()->num_tilings(); ++i) {
|
| + tile_manager()->InitializeTilesWithResourcesForTesting(
|
| + active_root_layer_->GetTilings()->tiling_at(i)->AllTilesForTesting());
|
| + }
|
| + pending_root_layer_->CreateDefaultTilingsAndTiles();
|
| + for (size_t i = 0; i < pending_root_layer_->GetTilings()->num_tilings();
|
| + ++i) {
|
| + tile_manager()->InitializeTilesWithResourcesForTesting(
|
| + pending_root_layer_->GetTilings()->tiling_at(i)->AllTilesForTesting());
|
| + }
|
| +
|
| + RunEvictionQueueConstructAndIterateTest("2_16", 16);
|
| + RunEvictionQueueConstructAndIterateTest("2_32", 32);
|
| + RunEvictionQueueConstructAndIterateTest("2_64", 64);
|
| + RunEvictionQueueConstructAndIterateTest("2_128", 128);
|
| +}
|
| +
|
| } // namespace
|
|
|
| } // namespace cc
|
|
|