Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: cc/tiles/tile_manager_perftest.cc

Issue 1974033004: (reland) cc: Refactor layer/tile manager unittest to extract common code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix perftests Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/test_layer_tree_host_base.cc ('k') | cc/tiles/tile_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "cc/debug/lap_timer.h" 12 #include "cc/debug/lap_timer.h"
13 #include "cc/raster/raster_buffer.h" 13 #include "cc/raster/raster_buffer.h"
14 #include "cc/test/begin_frame_args_test.h" 14 #include "cc/test/begin_frame_args_test.h"
15 #include "cc/test/fake_impl_task_runner_provider.h" 15 #include "cc/test/fake_impl_task_runner_provider.h"
16 #include "cc/test/fake_layer_tree_host_impl.h" 16 #include "cc/test/fake_layer_tree_host_impl.h"
17 #include "cc/test/fake_output_surface.h" 17 #include "cc/test/fake_output_surface.h"
18 #include "cc/test/fake_output_surface_client.h" 18 #include "cc/test/fake_output_surface_client.h"
19 #include "cc/test/fake_picture_layer_impl.h" 19 #include "cc/test/fake_picture_layer_impl.h"
20 #include "cc/test/fake_raster_source.h" 20 #include "cc/test/fake_raster_source.h"
21 #include "cc/test/fake_tile_manager.h" 21 #include "cc/test/fake_tile_manager.h"
22 #include "cc/test/fake_tile_manager_client.h" 22 #include "cc/test/fake_tile_manager_client.h"
23 #include "cc/test/fake_tile_task_manager.h" 23 #include "cc/test/fake_tile_task_manager.h"
24 #include "cc/test/test_layer_tree_host_base.h"
24 #include "cc/test/test_shared_bitmap_manager.h" 25 #include "cc/test/test_shared_bitmap_manager.h"
25 #include "cc/test/test_task_graph_runner.h" 26 #include "cc/test/test_task_graph_runner.h"
26 #include "cc/test/test_tile_priorities.h" 27 #include "cc/test/test_tile_priorities.h"
27 #include "cc/tiles/tile.h" 28 #include "cc/tiles/tile.h"
28 #include "cc/tiles/tile_priority.h" 29 #include "cc/tiles/tile_priority.h"
29 #include "cc/trees/layer_tree_impl.h" 30 #include "cc/trees/layer_tree_impl.h"
30 31
31 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
32 #include "testing/perf/perf_test.h" 33 #include "testing/perf/perf_test.h"
33 34
34 namespace cc { 35 namespace cc {
35 namespace { 36 namespace {
36 37
37 static const int kTimeLimitMillis = 2000; 38 static const int kTimeLimitMillis = 2000;
38 static const int kWarmupRuns = 5; 39 static const int kWarmupRuns = 5;
39 static const int kTimeCheckInterval = 10; 40 static const int kTimeCheckInterval = 10;
40 41
41 base::LazyInstance<FakeTileTaskManagerImpl> g_fake_tile_task_manager = 42 base::LazyInstance<FakeTileTaskManagerImpl> g_fake_tile_task_manager =
42 LAZY_INSTANCE_INITIALIZER; 43 LAZY_INSTANCE_INITIALIZER;
43 44
44 class TileManagerPerfTest : public testing::Test { 45 class TileManagerPerfTest : public TestLayerTreeHostBase {
45 public: 46 public:
46 TileManagerPerfTest() 47 TileManagerPerfTest()
47 : memory_limit_policy_(ALLOW_ANYTHING), 48 : timer_(kWarmupRuns,
48 max_tiles_(10000),
49 id_(7),
50 task_runner_provider_(base::ThreadTaskRunnerHandle::Get()),
51 output_surface_(FakeOutputSurface::Create3d()),
52 host_impl_(LayerTreeSettings(),
53 &task_runner_provider_,
54 &shared_bitmap_manager_,
55 &task_graph_runner_),
56 timer_(kWarmupRuns,
57 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), 49 base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
58 kTimeCheckInterval) {} 50 kTimeCheckInterval) {}
59 51
60 void SetTreePriority(TreePriority tree_priority) { 52 void InitializeRenderer() override {
61 GlobalStateThatImpactsTilePriority state; 53 host_impl()->SetVisible(true);
62 gfx::Size tile_size(256, 256); 54 host_impl()->InitializeRenderer(output_surface());
63
64 state.soft_memory_limit_in_bytes = 100 * 1000 * 1000;
65 state.num_resources_limit = max_tiles_;
66 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2;
67 state.memory_limit_policy = memory_limit_policy_;
68 state.tree_priority = tree_priority;
69
70 global_state_ = state;
71 host_impl_.resource_pool()->SetResourceUsageLimits(
72 state.soft_memory_limit_in_bytes, state.num_resources_limit);
73 host_impl_.tile_manager()->SetGlobalStateForTesting(state);
74 }
75
76 void SetUp() override {
77 InitializeRenderer();
78 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES);
79 }
80
81 virtual void InitializeRenderer() {
82 host_impl_.SetVisible(true);
83 host_impl_.InitializeRenderer(output_surface_.get());
84 tile_manager()->SetTileTaskManagerForTesting( 55 tile_manager()->SetTileTaskManagerForTesting(
85 g_fake_tile_task_manager.Pointer()); 56 g_fake_tile_task_manager.Pointer());
86 } 57 }
87 58
88 void SetupDefaultTrees(const gfx::Size& layer_bounds) { 59 void SetupDefaultTreesWithFixedTileSize(const gfx::Size& layer_bounds,
60 const gfx::Size& tile_size) {
89 scoped_refptr<FakeRasterSource> pending_raster_source = 61 scoped_refptr<FakeRasterSource> pending_raster_source =
90 FakeRasterSource::CreateFilled(layer_bounds); 62 FakeRasterSource::CreateFilled(layer_bounds);
91 scoped_refptr<FakeRasterSource> active_raster_source = 63 scoped_refptr<FakeRasterSource> active_raster_source =
92 FakeRasterSource::CreateFilled(layer_bounds); 64 FakeRasterSource::CreateFilled(layer_bounds);
93 65
94 SetupTrees(pending_raster_source, active_raster_source); 66 SetupPendingTree(std::move(active_raster_source), tile_size, Region());
95 }
96
97 void ActivateTree() {
98 host_impl_.ActivateSyncTree();
99 CHECK(!host_impl_.pending_tree());
100 pending_root_layer_ = NULL;
101 active_root_layer_ = static_cast<FakePictureLayerImpl*>(
102 host_impl_.active_tree()->LayerById(id_));
103 }
104
105 void SetupDefaultTreesWithFixedTileSize(const gfx::Size& layer_bounds,
106 const gfx::Size& tile_size) {
107 SetupDefaultTrees(layer_bounds);
108 pending_root_layer_->set_fixed_tile_size(tile_size);
109 active_root_layer_->set_fixed_tile_size(tile_size);
110 }
111
112 void SetupTrees(scoped_refptr<RasterSource> pending_raster_source,
113 scoped_refptr<RasterSource> active_raster_source) {
114 SetupPendingTree(active_raster_source);
115 ActivateTree(); 67 ActivateTree();
116 SetupPendingTree(pending_raster_source); 68 SetupPendingTree(std::move(pending_raster_source), tile_size, Region());
117 }
118
119 void SetupPendingTree(scoped_refptr<RasterSource> raster_source) {
120 host_impl_.CreatePendingTree();
121 LayerTreeImpl* pending_tree = host_impl_.pending_tree();
122 // Clear recycled tree.
123 pending_tree->ClearLayers();
124
125 std::unique_ptr<FakePictureLayerImpl> pending_layer =
126 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_,
127 raster_source);
128 pending_layer->SetDrawsContent(true);
129 pending_layer->test_properties()->force_render_surface = true;
130 pending_tree->SetRootLayer(std::move(pending_layer));
131 pending_tree->BuildPropertyTreesForTesting();
132
133 pending_root_layer_ = static_cast<FakePictureLayerImpl*>(
134 host_impl_.pending_tree()->LayerById(id_));
135 } 69 }
136 70
137 void RunRasterQueueConstructTest(const std::string& test_name, 71 void RunRasterQueueConstructTest(const std::string& test_name,
138 int layer_count) { 72 int layer_count) {
139 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, 73 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
140 SMOOTHNESS_TAKES_PRIORITY, 74 SMOOTHNESS_TAKES_PRIORITY,
141 NEW_CONTENT_TAKES_PRIORITY}; 75 NEW_CONTENT_TAKES_PRIORITY};
142 int priority_count = 0; 76 int priority_count = 0;
143 77
144 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); 78 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10);
145 for (const auto& layer : layers) 79 for (const auto& layer : layers)
146 layer->UpdateTiles(); 80 layer->UpdateTiles();
147 81
148 timer_.Reset(); 82 timer_.Reset();
149 do { 83 do {
150 std::unique_ptr<RasterTilePriorityQueue> queue( 84 std::unique_ptr<RasterTilePriorityQueue> queue(
151 host_impl_.BuildRasterQueue(priorities[priority_count], 85 host_impl()->BuildRasterQueue(priorities[priority_count],
152 RasterTilePriorityQueue::Type::ALL)); 86 RasterTilePriorityQueue::Type::ALL));
153 priority_count = (priority_count + 1) % arraysize(priorities); 87 priority_count = (priority_count + 1) % arraysize(priorities);
154 timer_.NextLap(); 88 timer_.NextLap();
155 } while (!timer_.HasTimeLimitExpired()); 89 } while (!timer_.HasTimeLimitExpired());
156 90
157 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", 91 perf_test::PrintResult("tile_manager_raster_tile_queue_construct",
158 "", 92 "",
159 test_name, 93 test_name,
160 timer_.LapsPerSecond(), 94 timer_.LapsPerSecond(),
161 "runs/s", 95 "runs/s",
162 true); 96 true);
163 } 97 }
164 98
165 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, 99 void RunRasterQueueConstructAndIterateTest(const std::string& test_name,
166 int layer_count, 100 int layer_count,
167 int tile_count) { 101 int tile_count) {
168 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, 102 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES,
169 SMOOTHNESS_TAKES_PRIORITY, 103 SMOOTHNESS_TAKES_PRIORITY,
170 NEW_CONTENT_TAKES_PRIORITY}; 104 NEW_CONTENT_TAKES_PRIORITY};
171 105
172 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); 106 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100);
173 for (const auto& layer : layers) 107 for (const auto& layer : layers)
174 layer->UpdateTiles(); 108 layer->UpdateTiles();
175 109
176 int priority_count = 0; 110 int priority_count = 0;
177 timer_.Reset(); 111 timer_.Reset();
178 do { 112 do {
179 int count = tile_count; 113 int count = tile_count;
180 std::unique_ptr<RasterTilePriorityQueue> queue( 114 std::unique_ptr<RasterTilePriorityQueue> queue(
181 host_impl_.BuildRasterQueue(priorities[priority_count], 115 host_impl()->BuildRasterQueue(priorities[priority_count],
182 RasterTilePriorityQueue::Type::ALL)); 116 RasterTilePriorityQueue::Type::ALL));
183 while (count--) { 117 while (count--) {
184 ASSERT_FALSE(queue->IsEmpty()); 118 ASSERT_FALSE(queue->IsEmpty());
185 ASSERT_TRUE(queue->Top().tile()); 119 ASSERT_TRUE(queue->Top().tile());
186 queue->Pop(); 120 queue->Pop();
187 } 121 }
188 priority_count = (priority_count + 1) % arraysize(priorities); 122 priority_count = (priority_count + 1) % arraysize(priorities);
189 timer_.NextLap(); 123 timer_.NextLap();
190 } while (!timer_.HasTimeLimitExpired()); 124 } while (!timer_.HasTimeLimitExpired());
191 125
192 perf_test::PrintResult( 126 perf_test::PrintResult(
(...skipping 17 matching lines...) Expand all
210 layer->UpdateTiles(); 144 layer->UpdateTiles();
211 for (size_t i = 0; i < layer->num_tilings(); ++i) { 145 for (size_t i = 0; i < layer->num_tilings(); ++i) {
212 tile_manager()->InitializeTilesWithResourcesForTesting( 146 tile_manager()->InitializeTilesWithResourcesForTesting(
213 layer->tilings()->tiling_at(i)->AllTilesForTesting()); 147 layer->tilings()->tiling_at(i)->AllTilesForTesting());
214 } 148 }
215 } 149 }
216 150
217 timer_.Reset(); 151 timer_.Reset();
218 do { 152 do {
219 std::unique_ptr<EvictionTilePriorityQueue> queue( 153 std::unique_ptr<EvictionTilePriorityQueue> queue(
220 host_impl_.BuildEvictionQueue(priorities[priority_count])); 154 host_impl()->BuildEvictionQueue(priorities[priority_count]));
221 priority_count = (priority_count + 1) % arraysize(priorities); 155 priority_count = (priority_count + 1) % arraysize(priorities);
222 timer_.NextLap(); 156 timer_.NextLap();
223 } while (!timer_.HasTimeLimitExpired()); 157 } while (!timer_.HasTimeLimitExpired());
224 158
225 perf_test::PrintResult("tile_manager_eviction_tile_queue_construct", 159 perf_test::PrintResult("tile_manager_eviction_tile_queue_construct",
226 "", 160 "",
227 test_name, 161 test_name,
228 timer_.LapsPerSecond(), 162 timer_.LapsPerSecond(),
229 "runs/s", 163 "runs/s",
230 true); 164 true);
(...skipping 14 matching lines...) Expand all
245 for (size_t i = 0; i < layer->num_tilings(); ++i) { 179 for (size_t i = 0; i < layer->num_tilings(); ++i) {
246 tile_manager()->InitializeTilesWithResourcesForTesting( 180 tile_manager()->InitializeTilesWithResourcesForTesting(
247 layer->tilings()->tiling_at(i)->AllTilesForTesting()); 181 layer->tilings()->tiling_at(i)->AllTilesForTesting());
248 } 182 }
249 } 183 }
250 184
251 timer_.Reset(); 185 timer_.Reset();
252 do { 186 do {
253 int count = tile_count; 187 int count = tile_count;
254 std::unique_ptr<EvictionTilePriorityQueue> queue( 188 std::unique_ptr<EvictionTilePriorityQueue> queue(
255 host_impl_.BuildEvictionQueue(priorities[priority_count])); 189 host_impl()->BuildEvictionQueue(priorities[priority_count]));
256 while (count--) { 190 while (count--) {
257 ASSERT_FALSE(queue->IsEmpty()); 191 ASSERT_FALSE(queue->IsEmpty());
258 ASSERT_TRUE(queue->Top().tile()); 192 ASSERT_TRUE(queue->Top().tile());
259 queue->Pop(); 193 queue->Pop();
260 } 194 }
261 priority_count = (priority_count + 1) % arraysize(priorities); 195 priority_count = (priority_count + 1) % arraysize(priorities);
262 timer_.NextLap(); 196 timer_.NextLap();
263 } while (!timer_.HasTimeLimitExpired()); 197 } while (!timer_.HasTimeLimitExpired());
264 198
265 perf_test::PrintResult( 199 perf_test::PrintResult(
266 "tile_manager_eviction_tile_queue_construct_and_iterate", 200 "tile_manager_eviction_tile_queue_construct_and_iterate",
267 "", 201 "",
268 test_name, 202 test_name,
269 timer_.LapsPerSecond(), 203 timer_.LapsPerSecond(),
270 "runs/s", 204 "runs/s",
271 true); 205 true);
272 } 206 }
273 207
274 std::vector<FakePictureLayerImpl*> CreateLayers(int layer_count, 208 std::vector<FakePictureLayerImpl*> CreateLayers(int layer_count,
275 int tiles_per_layer_count) { 209 int num_tiles_in_high_res) {
276 // Compute the width/height required for high res to get 210 // Compute the width/height required for high res to get
277 // tiles_per_layer_count tiles. 211 // num_tiles_in_high_res tiles.
278 float width = std::sqrt(static_cast<float>(tiles_per_layer_count)); 212 float width = std::sqrt(static_cast<float>(num_tiles_in_high_res));
279 float height = tiles_per_layer_count / width; 213 float height = num_tiles_in_high_res / width;
280 214
281 // Adjust the width and height to account for the fact that tiles 215 // Adjust the width and height to account for the fact that tiles
282 // are bigger than 1x1. Also, account for the fact that that we 216 // are bigger than 1x1.
283 // will be creating one high res and one low res tiling. That is, 217 LayerTreeSettings settings;
284 // width and height should be smaller by sqrt(1 + low_res_scale). 218 width *= settings.default_tile_size.width();
285 // This gives us _approximately_ correct counts. 219 height *= settings.default_tile_size.height();
286 width *= settings_.default_tile_size.width() /
287 std::sqrt(1 + settings_.low_res_contents_scale_factor);
288 height *= settings_.default_tile_size.height() /
289 std::sqrt(1 + settings_.low_res_contents_scale_factor);
290 220
291 // Ensure that we start with blank trees and no tiles. 221 // Ensure that we start with blank trees and no tiles.
292 host_impl_.ResetTreesForTesting(); 222 host_impl()->ResetTreesForTesting();
293 tile_manager()->FreeResourcesAndCleanUpReleasedTilesForTesting(); 223 tile_manager()->FreeResourcesAndCleanUpReleasedTilesForTesting();
294 224
295 gfx::Size layer_bounds(width, height); 225 gfx::Size layer_bounds(width, height);
296 gfx::Size viewport(width / 5, height / 5); 226 gfx::Size viewport(width / 5, height / 5);
297 host_impl_.SetViewportSize(viewport); 227 host_impl()->SetViewportSize(viewport);
298 SetupDefaultTreesWithFixedTileSize(layer_bounds, 228 SetupDefaultTreesWithFixedTileSize(layer_bounds,
299 settings_.default_tile_size); 229 settings.default_tile_size);
300 230
301 std::vector<FakePictureLayerImpl*> layers; 231 std::vector<FakePictureLayerImpl*> layers;
302 232
303 // Pending layer counts as one layer. 233 // Pending layer counts as one layer.
304 layers.push_back(pending_root_layer_); 234 layers.push_back(pending_layer());
305 int next_id = id_ + 1; 235 int next_id = layer_id() + 1;
306 236
307 // Create the rest of the layers as children of the root layer. 237 // Create the rest of the layers as children of the root layer.
308 scoped_refptr<FakeRasterSource> raster_source = 238 scoped_refptr<FakeRasterSource> raster_source =
309 FakeRasterSource::CreateFilled(layer_bounds); 239 FakeRasterSource::CreateFilled(layer_bounds);
310 while (static_cast<int>(layers.size()) < layer_count) { 240 while (static_cast<int>(layers.size()) < layer_count) {
311 std::unique_ptr<FakePictureLayerImpl> layer = 241 std::unique_ptr<FakePictureLayerImpl> child_layer =
312 FakePictureLayerImpl::CreateWithRasterSource( 242 FakePictureLayerImpl::CreateWithRasterSource(
313 host_impl_.pending_tree(), next_id, raster_source); 243 host_impl()->pending_tree(), next_id, raster_source);
314 layer->SetBounds(layer_bounds); 244 child_layer->SetBounds(layer_bounds);
315 layer->SetDrawsContent(true); 245 child_layer->SetDrawsContent(true);
316 layers.push_back(layer.get()); 246 layers.push_back(child_layer.get());
317 pending_root_layer_->AddChild(std::move(layer)); 247 pending_layer()->AddChild(std::move(child_layer));
318 ++next_id; 248 ++next_id;
319 } 249 }
320 250
321 // Property trees need to be rebuilt because layers were added above. 251 // Property trees need to be rebuilt because layers were added above.
322 host_impl_.pending_tree()->property_trees()->needs_rebuild = true; 252 host_impl()->pending_tree()->property_trees()->needs_rebuild = true;
323 host_impl_.pending_tree()->BuildPropertyTreesForTesting(); 253 host_impl()->pending_tree()->BuildPropertyTreesForTesting();
324 bool update_lcd_text = false; 254 bool update_lcd_text = false;
325 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 255 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text);
326 for (FakePictureLayerImpl* layer : layers) 256 for (FakePictureLayerImpl* layer : layers)
327 layer->CreateAllTiles(); 257 layer->CreateAllTiles();
328 258
329 return layers; 259 return layers;
330 } 260 }
331 261
332 GlobalStateThatImpactsTilePriority GlobalStateForTest() { 262 GlobalStateThatImpactsTilePriority GlobalStateForTest() {
333 GlobalStateThatImpactsTilePriority state; 263 GlobalStateThatImpactsTilePriority state;
334 gfx::Size tile_size = settings_.default_tile_size; 264 gfx::Size tile_size = LayerTreeSettings().default_tile_size;
335 state.soft_memory_limit_in_bytes = 265 state.soft_memory_limit_in_bytes =
336 10000u * 4u * 266 10000u * 4u *
337 static_cast<size_t>(tile_size.width() * tile_size.height()); 267 static_cast<size_t>(tile_size.width() * tile_size.height());
338 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes; 268 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes;
339 state.num_resources_limit = 10000; 269 state.num_resources_limit = 10000;
340 state.memory_limit_policy = ALLOW_ANYTHING; 270 state.memory_limit_policy = ALLOW_ANYTHING;
341 state.tree_priority = SMOOTHNESS_TAKES_PRIORITY; 271 state.tree_priority = SMOOTHNESS_TAKES_PRIORITY;
342 return state; 272 return state;
343 } 273 }
344 274
345 void RunPrepareTilesTest(const std::string& test_name, 275 void RunPrepareTilesTest(const std::string& test_name,
346 int layer_count, 276 int layer_count,
347 int approximate_tile_count_per_layer) { 277 int approximate_tile_count_per_layer) {
348 std::vector<FakePictureLayerImpl*> layers = 278 std::vector<FakePictureLayerImpl*> layers =
349 CreateLayers(layer_count, approximate_tile_count_per_layer); 279 CreateLayers(layer_count, approximate_tile_count_per_layer);
350 280
351 timer_.Reset(); 281 timer_.Reset();
352 do { 282 do {
353 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 283 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
354 for (const auto& layer : layers) 284 for (const auto& layer : layers)
355 layer->UpdateTiles(); 285 layer->UpdateTiles();
356 286
357 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); 287 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest());
358 tile_manager()->PrepareTiles(global_state); 288 tile_manager()->PrepareTiles(global_state);
359 tile_manager()->Flush(); 289 tile_manager()->Flush();
360 timer_.NextLap(); 290 timer_.NextLap();
361 } while (!timer_.HasTimeLimitExpired()); 291 } while (!timer_.HasTimeLimitExpired());
362 292
363 perf_test::PrintResult("prepare_tiles", "", test_name, 293 perf_test::PrintResult("prepare_tiles", "", test_name,
364 timer_.LapsPerSecond(), "runs/s", true); 294 timer_.LapsPerSecond(), "runs/s", true);
365 } 295 }
366 296
367 TileManager* tile_manager() { return host_impl_.tile_manager(); } 297 TileManager* tile_manager() { return host_impl()->tile_manager(); }
368 298
369 protected: 299 protected:
370 GlobalStateThatImpactsTilePriority global_state_;
371
372 TestSharedBitmapManager shared_bitmap_manager_;
373 TestTaskGraphRunner task_graph_runner_;
374 TileMemoryLimitPolicy memory_limit_policy_;
375 int max_tiles_;
376 int id_;
377 FakeImplTaskRunnerProvider task_runner_provider_;
378 std::unique_ptr<OutputSurface> output_surface_;
379 FakeLayerTreeHostImpl host_impl_;
380 FakePictureLayerImpl* pending_root_layer_;
381 FakePictureLayerImpl* active_root_layer_;
382 LapTimer timer_; 300 LapTimer timer_;
383 LayerTreeSettings settings_;
384 }; 301 };
385 302
386 TEST_F(TileManagerPerfTest, PrepareTiles) { 303 TEST_F(TileManagerPerfTest, PrepareTiles) {
387 RunPrepareTilesTest("2_100", 2, 100); 304 RunPrepareTilesTest("2_100", 2, 100);
388 RunPrepareTilesTest("2_500", 2, 500); 305 RunPrepareTilesTest("2_500", 2, 500);
389 RunPrepareTilesTest("2_1000", 2, 1000); 306 RunPrepareTilesTest("2_1000", 2, 1000);
390 RunPrepareTilesTest("10_100", 10, 100); 307 RunPrepareTilesTest("10_100", 10, 100);
391 RunPrepareTilesTest("10_500", 10, 500); 308 RunPrepareTilesTest("10_500", 10, 500);
392 RunPrepareTilesTest("10_1000", 10, 1000); 309 RunPrepareTilesTest("10_1000", 10, 1000);
393 RunPrepareTilesTest("50_100", 100, 100); 310 RunPrepareTilesTest("50_100", 100, 100);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); 349 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64);
433 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); 350 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128);
434 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); 351 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16);
435 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); 352 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32);
436 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); 353 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64);
437 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); 354 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128);
438 } 355 }
439 356
440 } // namespace 357 } // namespace
441 } // namespace cc 358 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_layer_tree_host_base.cc ('k') | cc/tiles/tile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698