| 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 "base/time/time.h" | 5 #include "base/time/time.h" |
| 6 #include "cc/debug/lap_timer.h" | 6 #include "cc/debug/lap_timer.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/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
| 10 #include "cc/test/fake_layer_tree_host_impl.h" | 11 #include "cc/test/fake_layer_tree_host_impl.h" |
| 11 #include "cc/test/fake_output_surface.h" | 12 #include "cc/test/fake_output_surface.h" |
| 12 #include "cc/test/fake_output_surface_client.h" | 13 #include "cc/test/fake_output_surface_client.h" |
| 13 #include "cc/test/fake_picture_layer_impl.h" | 14 #include "cc/test/fake_picture_layer_impl.h" |
| 14 #include "cc/test/fake_picture_pile_impl.h" | 15 #include "cc/test/fake_picture_pile_impl.h" |
| 15 #include "cc/test/fake_tile_manager.h" | 16 #include "cc/test/fake_tile_manager.h" |
| 16 #include "cc/test/fake_tile_manager_client.h" | 17 #include "cc/test/fake_tile_manager_client.h" |
| 17 #include "cc/test/impl_side_painting_settings.h" | 18 #include "cc/test/impl_side_painting_settings.h" |
| 18 #include "cc/test/test_shared_bitmap_manager.h" | 19 #include "cc/test/test_shared_bitmap_manager.h" |
| 19 #include "cc/test/test_tile_priorities.h" | 20 #include "cc/test/test_tile_priorities.h" |
| 20 #include "cc/trees/layer_tree_impl.h" | 21 #include "cc/trees/layer_tree_impl.h" |
| 21 | 22 |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include "testing/perf/perf_test.h" | 24 #include "testing/perf/perf_test.h" |
| 24 | 25 |
| 26 #include "ui/gfx/frame_time.h" |
| 27 |
| 25 namespace cc { | 28 namespace cc { |
| 26 | 29 |
| 27 namespace { | 30 namespace { |
| 28 | 31 |
| 29 static const int kTimeLimitMillis = 2000; | 32 static const int kTimeLimitMillis = 2000; |
| 30 static const int kWarmupRuns = 5; | 33 static const int kWarmupRuns = 5; |
| 31 static const int kTimeCheckInterval = 10; | 34 static const int kTimeCheckInterval = 10; |
| 32 | 35 |
| 33 class FakeRasterizerImpl : public Rasterizer, public RasterizerTaskClient { | 36 class FakeRasterizerImpl : public Rasterizer, public RasterizerTaskClient { |
| 34 public: | 37 public: |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 return state; | 386 return state; |
| 384 } | 387 } |
| 385 | 388 |
| 386 void RunManageTilesTest(const std::string& test_name, | 389 void RunManageTilesTest(const std::string& test_name, |
| 387 int layer_count, | 390 int layer_count, |
| 388 int approximate_tile_count_per_layer) { | 391 int approximate_tile_count_per_layer) { |
| 389 std::vector<LayerImpl*> layers = | 392 std::vector<LayerImpl*> layers = |
| 390 CreateLayers(layer_count, approximate_tile_count_per_layer); | 393 CreateLayers(layer_count, approximate_tile_count_per_layer); |
| 391 timer_.Reset(); | 394 timer_.Reset(); |
| 392 do { | 395 do { |
| 393 host_impl_.UpdateCurrentFrameTime(); | 396 BeginFrameArgs args = CreateBeginFrameArgsForTesting(); |
| 397 host_impl_.UpdateCurrentBeginFrameArgs(args); |
| 394 for (unsigned i = 0; i < layers.size(); ++i) | 398 for (unsigned i = 0; i < layers.size(); ++i) |
| 395 layers[i]->UpdateTiles(NULL); | 399 layers[i]->UpdateTiles(NULL); |
| 396 | 400 |
| 397 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); | 401 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); |
| 398 tile_manager()->ManageTiles(global_state); | 402 tile_manager()->ManageTiles(global_state); |
| 399 tile_manager()->UpdateVisibleTiles(); | 403 tile_manager()->UpdateVisibleTiles(); |
| 400 timer_.NextLap(); | 404 timer_.NextLap(); |
| 401 host_impl_.ResetCurrentFrameTimeForNextFrame(); | 405 host_impl_.ResetCurrentBeginFrameArgsForNextFrame(); |
| 402 } while (!timer_.HasTimeLimitExpired()); | 406 } while (!timer_.HasTimeLimitExpired()); |
| 403 | 407 |
| 404 perf_test::PrintResult( | 408 perf_test::PrintResult( |
| 405 "manage_tiles", "", test_name, timer_.LapsPerSecond(), "runs/s", true); | 409 "manage_tiles", "", test_name, timer_.LapsPerSecond(), "runs/s", true); |
| 406 } | 410 } |
| 407 | 411 |
| 408 TileManager* tile_manager() { return host_impl_.tile_manager(); } | 412 TileManager* tile_manager() { return host_impl_.tile_manager(); } |
| 409 | 413 |
| 410 protected: | 414 protected: |
| 411 GlobalStateThatImpactsTilePriority global_state_; | 415 GlobalStateThatImpactsTilePriority global_state_; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 477 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
| 474 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 478 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
| 475 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 479 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
| 476 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 480 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
| 477 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 481 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
| 478 } | 482 } |
| 479 | 483 |
| 480 } // namespace | 484 } // namespace |
| 481 | 485 |
| 482 } // namespace cc | 486 } // namespace cc |
| OLD | NEW |