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