| 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/location.h" | 5 #include "base/location.h" |
| 6 #include "base/thread_task_runner_handle.h" | 6 #include "base/thread_task_runner_handle.h" |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "cc/debug/lap_timer.h" | 8 #include "cc/debug/lap_timer.h" |
| 9 #include "cc/raster/raster_buffer.h" | 9 #include "cc/raster/raster_buffer.h" |
| 10 #include "cc/test/begin_frame_args_test.h" | 10 #include "cc/test/begin_frame_args_test.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 base::LazyInstance<FakeTileTaskRunnerImpl> g_fake_tile_task_runner = | 82 base::LazyInstance<FakeTileTaskRunnerImpl> g_fake_tile_task_runner = |
| 83 LAZY_INSTANCE_INITIALIZER; | 83 LAZY_INSTANCE_INITIALIZER; |
| 84 | 84 |
| 85 class TileManagerPerfTest : public testing::Test { | 85 class TileManagerPerfTest : public testing::Test { |
| 86 public: | 86 public: |
| 87 TileManagerPerfTest() | 87 TileManagerPerfTest() |
| 88 : memory_limit_policy_(ALLOW_ANYTHING), | 88 : memory_limit_policy_(ALLOW_ANYTHING), |
| 89 max_tiles_(10000), | 89 max_tiles_(10000), |
| 90 id_(7), | 90 id_(7), |
| 91 proxy_(base::ThreadTaskRunnerHandle::Get()), | 91 proxy_(base::ThreadTaskRunnerHandle::Get()), |
| 92 output_surface_(FakeOutputSurface::Create3d()), | |
| 93 host_impl_(LayerTreeSettings(), | 92 host_impl_(LayerTreeSettings(), |
| 94 &proxy_, | 93 &proxy_, |
| 95 &shared_bitmap_manager_, | 94 &shared_bitmap_manager_, |
| 96 &task_graph_runner_), | 95 &task_graph_runner_), |
| 97 timer_(kWarmupRuns, | 96 timer_(kWarmupRuns, |
| 98 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 97 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 99 kTimeCheckInterval) {} | 98 kTimeCheckInterval) {} |
| 100 | 99 |
| 101 void SetTreePriority(TreePriority tree_priority) { | 100 void SetTreePriority(TreePriority tree_priority) { |
| 102 GlobalStateThatImpactsTilePriority state; | 101 GlobalStateThatImpactsTilePriority state; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 113 state.soft_memory_limit_in_bytes, state.num_resources_limit); | 112 state.soft_memory_limit_in_bytes, state.num_resources_limit); |
| 114 host_impl_.tile_manager()->SetGlobalStateForTesting(state); | 113 host_impl_.tile_manager()->SetGlobalStateForTesting(state); |
| 115 } | 114 } |
| 116 | 115 |
| 117 void SetUp() override { | 116 void SetUp() override { |
| 118 InitializeRenderer(); | 117 InitializeRenderer(); |
| 119 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 118 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
| 120 } | 119 } |
| 121 | 120 |
| 122 virtual void InitializeRenderer() { | 121 virtual void InitializeRenderer() { |
| 123 host_impl_.InitializeRenderer(output_surface_.get()); | 122 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d().Pass()); |
| 124 tile_manager()->SetTileTaskRunnerForTesting( | 123 tile_manager()->SetTileTaskRunnerForTesting( |
| 125 g_fake_tile_task_runner.Pointer()); | 124 g_fake_tile_task_runner.Pointer()); |
| 126 } | 125 } |
| 127 | 126 |
| 128 void SetupDefaultTrees(const gfx::Size& layer_bounds) { | 127 void SetupDefaultTrees(const gfx::Size& layer_bounds) { |
| 129 scoped_refptr<FakePicturePileImpl> pending_pile = | 128 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 130 FakePicturePileImpl::CreateFilledPile(kDefaultTileSize, layer_bounds); | 129 FakePicturePileImpl::CreateFilledPile(kDefaultTileSize, layer_bounds); |
| 131 scoped_refptr<FakePicturePileImpl> active_pile = | 130 scoped_refptr<FakePicturePileImpl> active_pile = |
| 132 FakePicturePileImpl::CreateFilledPile(kDefaultTileSize, layer_bounds); | 131 FakePicturePileImpl::CreateFilledPile(kDefaultTileSize, layer_bounds); |
| 133 | 132 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 | 405 |
| 407 protected: | 406 protected: |
| 408 GlobalStateThatImpactsTilePriority global_state_; | 407 GlobalStateThatImpactsTilePriority global_state_; |
| 409 | 408 |
| 410 TestSharedBitmapManager shared_bitmap_manager_; | 409 TestSharedBitmapManager shared_bitmap_manager_; |
| 411 TestTaskGraphRunner task_graph_runner_; | 410 TestTaskGraphRunner task_graph_runner_; |
| 412 TileMemoryLimitPolicy memory_limit_policy_; | 411 TileMemoryLimitPolicy memory_limit_policy_; |
| 413 int max_tiles_; | 412 int max_tiles_; |
| 414 int id_; | 413 int id_; |
| 415 FakeImplProxy proxy_; | 414 FakeImplProxy proxy_; |
| 416 scoped_ptr<OutputSurface> output_surface_; | |
| 417 FakeLayerTreeHostImpl host_impl_; | 415 FakeLayerTreeHostImpl host_impl_; |
| 418 FakePictureLayerImpl* pending_root_layer_; | 416 FakePictureLayerImpl* pending_root_layer_; |
| 419 FakePictureLayerImpl* active_root_layer_; | 417 FakePictureLayerImpl* active_root_layer_; |
| 420 LapTimer timer_; | 418 LapTimer timer_; |
| 421 LayerTreeSettings settings_; | 419 LayerTreeSettings settings_; |
| 422 | 420 |
| 423 static const gfx::Size kDefaultTileSize; | 421 static const gfx::Size kDefaultTileSize; |
| 424 }; | 422 }; |
| 425 | 423 |
| 426 const gfx::Size TileManagerPerfTest::kDefaultTileSize(100, 100); | 424 const gfx::Size TileManagerPerfTest::kDefaultTileSize(100, 100); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); | 472 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); |
| 475 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 473 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
| 476 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 474 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
| 477 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 475 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
| 478 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 476 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
| 479 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 477 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
| 480 } | 478 } |
| 481 | 479 |
| 482 } // namespace | 480 } // namespace |
| 483 } // namespace cc | 481 } // namespace cc |
| OLD | NEW |