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/begin_frame_args_test.h" |
10 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 void RunRasterQueueConstructTest(const std::string& test_name, | 181 void RunRasterQueueConstructTest(const std::string& test_name, |
182 int layer_count) { | 182 int layer_count) { |
183 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 183 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
184 SMOOTHNESS_TAKES_PRIORITY, | 184 SMOOTHNESS_TAKES_PRIORITY, |
185 NEW_CONTENT_TAKES_PRIORITY}; | 185 NEW_CONTENT_TAKES_PRIORITY}; |
186 int priority_count = 0; | 186 int priority_count = 0; |
187 | 187 |
188 std::vector<LayerImpl*> layers = CreateLayers(layer_count, 10); | 188 std::vector<LayerImpl*> layers = CreateLayers(layer_count, 10); |
189 for (unsigned i = 0; i < layers.size(); ++i) | 189 for (unsigned i = 0; i < layers.size(); ++i) |
190 layers[i]->UpdateTiles(NULL); | 190 layers[i]->UpdateTiles(Occlusion()); |
191 | 191 |
192 timer_.Reset(); | 192 timer_.Reset(); |
193 do { | 193 do { |
194 RasterTilePriorityQueue queue; | 194 RasterTilePriorityQueue queue; |
195 host_impl_.BuildRasterQueue(&queue, priorities[priority_count]); | 195 host_impl_.BuildRasterQueue(&queue, priorities[priority_count]); |
196 priority_count = (priority_count + 1) % arraysize(priorities); | 196 priority_count = (priority_count + 1) % arraysize(priorities); |
197 timer_.NextLap(); | 197 timer_.NextLap(); |
198 } while (!timer_.HasTimeLimitExpired()); | 198 } while (!timer_.HasTimeLimitExpired()); |
199 | 199 |
200 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", | 200 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", |
201 "", | 201 "", |
202 test_name, | 202 test_name, |
203 timer_.LapsPerSecond(), | 203 timer_.LapsPerSecond(), |
204 "runs/s", | 204 "runs/s", |
205 true); | 205 true); |
206 } | 206 } |
207 | 207 |
208 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, | 208 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, |
209 int layer_count, | 209 int layer_count, |
210 unsigned tile_count) { | 210 unsigned tile_count) { |
211 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 211 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
212 SMOOTHNESS_TAKES_PRIORITY, | 212 SMOOTHNESS_TAKES_PRIORITY, |
213 NEW_CONTENT_TAKES_PRIORITY}; | 213 NEW_CONTENT_TAKES_PRIORITY}; |
214 | 214 |
215 std::vector<LayerImpl*> layers = CreateLayers(layer_count, 100); | 215 std::vector<LayerImpl*> layers = CreateLayers(layer_count, 100); |
216 for (unsigned i = 0; i < layers.size(); ++i) | 216 for (unsigned i = 0; i < layers.size(); ++i) |
217 layers[i]->UpdateTiles(NULL); | 217 layers[i]->UpdateTiles(Occlusion()); |
218 | 218 |
219 int priority_count = 0; | 219 int priority_count = 0; |
220 timer_.Reset(); | 220 timer_.Reset(); |
221 do { | 221 do { |
222 int count = tile_count; | 222 int count = tile_count; |
223 RasterTilePriorityQueue queue; | 223 RasterTilePriorityQueue queue; |
224 host_impl_.BuildRasterQueue(&queue, priorities[priority_count]); | 224 host_impl_.BuildRasterQueue(&queue, priorities[priority_count]); |
225 while (count--) { | 225 while (count--) { |
226 ASSERT_FALSE(queue.IsEmpty()); | 226 ASSERT_FALSE(queue.IsEmpty()); |
227 ASSERT_TRUE(queue.Top() != NULL); | 227 ASSERT_TRUE(queue.Top() != NULL); |
(...skipping 16 matching lines...) Expand all Loading... |
244 int layer_count) { | 244 int layer_count) { |
245 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 245 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
246 SMOOTHNESS_TAKES_PRIORITY, | 246 SMOOTHNESS_TAKES_PRIORITY, |
247 NEW_CONTENT_TAKES_PRIORITY}; | 247 NEW_CONTENT_TAKES_PRIORITY}; |
248 int priority_count = 0; | 248 int priority_count = 0; |
249 | 249 |
250 std::vector<LayerImpl*> layers = CreateLayers(layer_count, 10); | 250 std::vector<LayerImpl*> layers = CreateLayers(layer_count, 10); |
251 for (unsigned i = 0; i < layers.size(); ++i) { | 251 for (unsigned i = 0; i < layers.size(); ++i) { |
252 FakePictureLayerImpl* layer = | 252 FakePictureLayerImpl* layer = |
253 static_cast<FakePictureLayerImpl*>(layers[i]); | 253 static_cast<FakePictureLayerImpl*>(layers[i]); |
254 layer->UpdateTiles(NULL); | 254 layer->UpdateTiles(Occlusion()); |
255 for (size_t j = 0; j < layer->GetTilings()->num_tilings(); ++j) { | 255 for (size_t j = 0; j < layer->GetTilings()->num_tilings(); ++j) { |
256 tile_manager()->InitializeTilesWithResourcesForTesting( | 256 tile_manager()->InitializeTilesWithResourcesForTesting( |
257 layer->GetTilings()->tiling_at(j)->AllTilesForTesting()); | 257 layer->GetTilings()->tiling_at(j)->AllTilesForTesting()); |
258 } | 258 } |
259 } | 259 } |
260 | 260 |
261 timer_.Reset(); | 261 timer_.Reset(); |
262 do { | 262 do { |
263 EvictionTilePriorityQueue queue; | 263 EvictionTilePriorityQueue queue; |
264 host_impl_.BuildEvictionQueue(&queue, priorities[priority_count]); | 264 host_impl_.BuildEvictionQueue(&queue, priorities[priority_count]); |
(...skipping 14 matching lines...) Expand all Loading... |
279 unsigned tile_count) { | 279 unsigned tile_count) { |
280 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 280 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
281 SMOOTHNESS_TAKES_PRIORITY, | 281 SMOOTHNESS_TAKES_PRIORITY, |
282 NEW_CONTENT_TAKES_PRIORITY}; | 282 NEW_CONTENT_TAKES_PRIORITY}; |
283 int priority_count = 0; | 283 int priority_count = 0; |
284 | 284 |
285 std::vector<LayerImpl*> layers = CreateLayers(layer_count, tile_count); | 285 std::vector<LayerImpl*> layers = CreateLayers(layer_count, tile_count); |
286 for (unsigned i = 0; i < layers.size(); ++i) { | 286 for (unsigned i = 0; i < layers.size(); ++i) { |
287 FakePictureLayerImpl* layer = | 287 FakePictureLayerImpl* layer = |
288 static_cast<FakePictureLayerImpl*>(layers[i]); | 288 static_cast<FakePictureLayerImpl*>(layers[i]); |
289 layer->UpdateTiles(NULL); | 289 layer->UpdateTiles(Occlusion()); |
290 for (size_t j = 0; j < layer->GetTilings()->num_tilings(); ++j) { | 290 for (size_t j = 0; j < layer->GetTilings()->num_tilings(); ++j) { |
291 tile_manager()->InitializeTilesWithResourcesForTesting( | 291 tile_manager()->InitializeTilesWithResourcesForTesting( |
292 layer->GetTilings()->tiling_at(j)->AllTilesForTesting()); | 292 layer->GetTilings()->tiling_at(j)->AllTilesForTesting()); |
293 } | 293 } |
294 } | 294 } |
295 | 295 |
296 timer_.Reset(); | 296 timer_.Reset(); |
297 do { | 297 do { |
298 int count = tile_count; | 298 int count = tile_count; |
299 EvictionTilePriorityQueue queue; | 299 EvictionTilePriorityQueue queue; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 void RunManageTilesTest(const std::string& test_name, | 389 void RunManageTilesTest(const std::string& test_name, |
390 int layer_count, | 390 int layer_count, |
391 int approximate_tile_count_per_layer) { | 391 int approximate_tile_count_per_layer) { |
392 std::vector<LayerImpl*> layers = | 392 std::vector<LayerImpl*> layers = |
393 CreateLayers(layer_count, approximate_tile_count_per_layer); | 393 CreateLayers(layer_count, approximate_tile_count_per_layer); |
394 timer_.Reset(); | 394 timer_.Reset(); |
395 do { | 395 do { |
396 BeginFrameArgs args = CreateBeginFrameArgsForTesting(); | 396 BeginFrameArgs args = CreateBeginFrameArgsForTesting(); |
397 host_impl_.UpdateCurrentBeginFrameArgs(args); | 397 host_impl_.UpdateCurrentBeginFrameArgs(args); |
398 for (unsigned i = 0; i < layers.size(); ++i) | 398 for (unsigned i = 0; i < layers.size(); ++i) |
399 layers[i]->UpdateTiles(NULL); | 399 layers[i]->UpdateTiles(Occlusion()); |
400 | 400 |
401 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); | 401 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); |
402 tile_manager()->ManageTiles(global_state); | 402 tile_manager()->ManageTiles(global_state); |
403 tile_manager()->UpdateVisibleTiles(); | 403 tile_manager()->UpdateVisibleTiles(); |
404 timer_.NextLap(); | 404 timer_.NextLap(); |
405 host_impl_.ResetCurrentBeginFrameArgsForNextFrame(); | 405 host_impl_.ResetCurrentBeginFrameArgsForNextFrame(); |
406 } while (!timer_.HasTimeLimitExpired()); | 406 } while (!timer_.HasTimeLimitExpired()); |
407 | 407 |
408 perf_test::PrintResult( | 408 perf_test::PrintResult( |
409 "manage_tiles", "", test_name, timer_.LapsPerSecond(), "runs/s", true); | 409 "manage_tiles", "", test_name, timer_.LapsPerSecond(), "runs/s", true); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 485 |
486 } // namespace cc | 486 } // namespace cc |
OLD | NEW |