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/lazy_instance.h" | 5 #include "base/lazy_instance.h" |
6 #include "base/location.h" | 6 #include "base/location.h" |
7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "cc/debug/lap_timer.h" | 9 #include "cc/debug/lap_timer.h" |
10 #include "cc/raster/raster_buffer.h" | 10 #include "cc/raster/raster_buffer.h" |
11 #include "cc/test/begin_frame_args_test.h" | 11 #include "cc/test/begin_frame_args_test.h" |
12 #include "cc/test/fake_display_list_raster_source.h" | 12 #include "cc/test/fake_display_list_raster_source.h" |
13 #include "cc/test/fake_impl_proxy.h" | 13 #include "cc/test/fake_impl_task_runner_provider.h" |
14 #include "cc/test/fake_layer_tree_host_impl.h" | 14 #include "cc/test/fake_layer_tree_host_impl.h" |
15 #include "cc/test/fake_output_surface.h" | 15 #include "cc/test/fake_output_surface.h" |
16 #include "cc/test/fake_output_surface_client.h" | 16 #include "cc/test/fake_output_surface_client.h" |
17 #include "cc/test/fake_picture_layer_impl.h" | 17 #include "cc/test/fake_picture_layer_impl.h" |
18 #include "cc/test/fake_tile_manager.h" | 18 #include "cc/test/fake_tile_manager.h" |
19 #include "cc/test/fake_tile_manager_client.h" | 19 #include "cc/test/fake_tile_manager_client.h" |
20 #include "cc/test/test_shared_bitmap_manager.h" | 20 #include "cc/test/test_shared_bitmap_manager.h" |
21 #include "cc/test/test_task_graph_runner.h" | 21 #include "cc/test/test_task_graph_runner.h" |
22 #include "cc/test/test_tile_priorities.h" | 22 #include "cc/test/test_tile_priorities.h" |
23 #include "cc/tiles/tile.h" | 23 #include "cc/tiles/tile.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 }; | 85 }; |
86 base::LazyInstance<FakeTileTaskRunnerImpl> g_fake_tile_task_runner = | 86 base::LazyInstance<FakeTileTaskRunnerImpl> g_fake_tile_task_runner = |
87 LAZY_INSTANCE_INITIALIZER; | 87 LAZY_INSTANCE_INITIALIZER; |
88 | 88 |
89 class TileManagerPerfTest : public testing::Test { | 89 class TileManagerPerfTest : public testing::Test { |
90 public: | 90 public: |
91 TileManagerPerfTest() | 91 TileManagerPerfTest() |
92 : memory_limit_policy_(ALLOW_ANYTHING), | 92 : memory_limit_policy_(ALLOW_ANYTHING), |
93 max_tiles_(10000), | 93 max_tiles_(10000), |
94 id_(7), | 94 id_(7), |
95 proxy_(base::ThreadTaskRunnerHandle::Get()), | 95 task_runner_provider_(base::ThreadTaskRunnerHandle::Get()), |
96 output_surface_(FakeOutputSurface::Create3d()), | 96 output_surface_(FakeOutputSurface::Create3d()), |
97 host_impl_(LayerTreeSettings(), | 97 host_impl_(LayerTreeSettings(), |
98 &proxy_, | 98 &task_runner_provider_, |
99 &shared_bitmap_manager_, | 99 &shared_bitmap_manager_, |
100 &task_graph_runner_), | 100 &task_graph_runner_), |
101 timer_(kWarmupRuns, | 101 timer_(kWarmupRuns, |
102 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 102 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
103 kTimeCheckInterval) {} | 103 kTimeCheckInterval) {} |
104 | 104 |
105 void SetTreePriority(TreePriority tree_priority) { | 105 void SetTreePriority(TreePriority tree_priority) { |
106 GlobalStateThatImpactsTilePriority state; | 106 GlobalStateThatImpactsTilePriority state; |
107 gfx::Size tile_size(256, 256); | 107 gfx::Size tile_size(256, 256); |
108 | 108 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 TileManager* tile_manager() { return host_impl_.tile_manager(); } | 411 TileManager* tile_manager() { return host_impl_.tile_manager(); } |
412 | 412 |
413 protected: | 413 protected: |
414 GlobalStateThatImpactsTilePriority global_state_; | 414 GlobalStateThatImpactsTilePriority global_state_; |
415 | 415 |
416 TestSharedBitmapManager shared_bitmap_manager_; | 416 TestSharedBitmapManager shared_bitmap_manager_; |
417 TestTaskGraphRunner task_graph_runner_; | 417 TestTaskGraphRunner task_graph_runner_; |
418 TileMemoryLimitPolicy memory_limit_policy_; | 418 TileMemoryLimitPolicy memory_limit_policy_; |
419 int max_tiles_; | 419 int max_tiles_; |
420 int id_; | 420 int id_; |
421 FakeImplProxy proxy_; | 421 FakeImplTaskRunnerProvider task_runner_provider_; |
422 scoped_ptr<OutputSurface> output_surface_; | 422 scoped_ptr<OutputSurface> output_surface_; |
423 FakeLayerTreeHostImpl host_impl_; | 423 FakeLayerTreeHostImpl host_impl_; |
424 FakePictureLayerImpl* pending_root_layer_; | 424 FakePictureLayerImpl* pending_root_layer_; |
425 FakePictureLayerImpl* active_root_layer_; | 425 FakePictureLayerImpl* active_root_layer_; |
426 LapTimer timer_; | 426 LapTimer timer_; |
427 LayerTreeSettings settings_; | 427 LayerTreeSettings settings_; |
428 }; | 428 }; |
429 | 429 |
430 TEST_F(TileManagerPerfTest, PrepareTiles) { | 430 TEST_F(TileManagerPerfTest, PrepareTiles) { |
431 RunPrepareTilesTest("2_100", 2, 100); | 431 RunPrepareTilesTest("2_100", 2, 100); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); | 476 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); |
477 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 477 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
478 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 478 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
479 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 479 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
480 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 480 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
481 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 481 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
482 } | 482 } |
483 | 483 |
484 } // namespace | 484 } // namespace |
485 } // namespace cc | 485 } // namespace cc |
OLD | NEW |