| 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 <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" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 void RunRasterQueueConstructTest(const std::string& test_name, | 71 void RunRasterQueueConstructTest(const std::string& test_name, |
| 72 int layer_count) { | 72 int layer_count) { |
| 73 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 73 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
| 74 SMOOTHNESS_TAKES_PRIORITY, | 74 SMOOTHNESS_TAKES_PRIORITY, |
| 75 NEW_CONTENT_TAKES_PRIORITY}; | 75 NEW_CONTENT_TAKES_PRIORITY}; |
| 76 int priority_count = 0; | 76 int priority_count = 0; |
| 77 | 77 |
| 78 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); | 78 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); |
| 79 for (const auto& layer : layers) | 79 for (auto* layer : layers) |
| 80 layer->UpdateTiles(); | 80 layer->UpdateTiles(); |
| 81 | 81 |
| 82 timer_.Reset(); | 82 timer_.Reset(); |
| 83 do { | 83 do { |
| 84 std::unique_ptr<RasterTilePriorityQueue> queue( | 84 std::unique_ptr<RasterTilePriorityQueue> queue( |
| 85 host_impl()->BuildRasterQueue(priorities[priority_count], | 85 host_impl()->BuildRasterQueue(priorities[priority_count], |
| 86 RasterTilePriorityQueue::Type::ALL)); | 86 RasterTilePriorityQueue::Type::ALL)); |
| 87 priority_count = (priority_count + 1) % arraysize(priorities); | 87 priority_count = (priority_count + 1) % arraysize(priorities); |
| 88 timer_.NextLap(); | 88 timer_.NextLap(); |
| 89 } while (!timer_.HasTimeLimitExpired()); | 89 } while (!timer_.HasTimeLimitExpired()); |
| 90 | 90 |
| 91 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", | 91 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", |
| 92 "", | 92 "", |
| 93 test_name, | 93 test_name, |
| 94 timer_.LapsPerSecond(), | 94 timer_.LapsPerSecond(), |
| 95 "runs/s", | 95 "runs/s", |
| 96 true); | 96 true); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, | 99 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, |
| 100 int layer_count, | 100 int layer_count, |
| 101 int tile_count) { | 101 int tile_count) { |
| 102 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 102 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
| 103 SMOOTHNESS_TAKES_PRIORITY, | 103 SMOOTHNESS_TAKES_PRIORITY, |
| 104 NEW_CONTENT_TAKES_PRIORITY}; | 104 NEW_CONTENT_TAKES_PRIORITY}; |
| 105 | 105 |
| 106 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); | 106 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); |
| 107 for (const auto& layer : layers) | 107 for (auto* layer : layers) |
| 108 layer->UpdateTiles(); | 108 layer->UpdateTiles(); |
| 109 | 109 |
| 110 int priority_count = 0; | 110 int priority_count = 0; |
| 111 timer_.Reset(); | 111 timer_.Reset(); |
| 112 do { | 112 do { |
| 113 int count = tile_count; | 113 int count = tile_count; |
| 114 std::unique_ptr<RasterTilePriorityQueue> queue( | 114 std::unique_ptr<RasterTilePriorityQueue> queue( |
| 115 host_impl()->BuildRasterQueue(priorities[priority_count], | 115 host_impl()->BuildRasterQueue(priorities[priority_count], |
| 116 RasterTilePriorityQueue::Type::ALL)); | 116 RasterTilePriorityQueue::Type::ALL)); |
| 117 while (count--) { | 117 while (count--) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 133 } | 133 } |
| 134 | 134 |
| 135 void RunEvictionQueueConstructTest(const std::string& test_name, | 135 void RunEvictionQueueConstructTest(const std::string& test_name, |
| 136 int layer_count) { | 136 int layer_count) { |
| 137 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 137 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
| 138 SMOOTHNESS_TAKES_PRIORITY, | 138 SMOOTHNESS_TAKES_PRIORITY, |
| 139 NEW_CONTENT_TAKES_PRIORITY}; | 139 NEW_CONTENT_TAKES_PRIORITY}; |
| 140 int priority_count = 0; | 140 int priority_count = 0; |
| 141 | 141 |
| 142 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); | 142 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); |
| 143 for (const auto& layer : layers) { | 143 for (auto* layer : layers) { |
| 144 layer->UpdateTiles(); | 144 layer->UpdateTiles(); |
| 145 for (size_t i = 0; i < layer->num_tilings(); ++i) { | 145 for (size_t i = 0; i < layer->num_tilings(); ++i) { |
| 146 tile_manager()->InitializeTilesWithResourcesForTesting( | 146 tile_manager()->InitializeTilesWithResourcesForTesting( |
| 147 layer->tilings()->tiling_at(i)->AllTilesForTesting()); | 147 layer->tilings()->tiling_at(i)->AllTilesForTesting()); |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 | 150 |
| 151 timer_.Reset(); | 151 timer_.Reset(); |
| 152 do { | 152 do { |
| 153 std::unique_ptr<EvictionTilePriorityQueue> queue( | 153 std::unique_ptr<EvictionTilePriorityQueue> queue( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 167 void RunEvictionQueueConstructAndIterateTest(const std::string& test_name, | 167 void RunEvictionQueueConstructAndIterateTest(const std::string& test_name, |
| 168 int layer_count, | 168 int layer_count, |
| 169 int tile_count) { | 169 int tile_count) { |
| 170 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 170 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
| 171 SMOOTHNESS_TAKES_PRIORITY, | 171 SMOOTHNESS_TAKES_PRIORITY, |
| 172 NEW_CONTENT_TAKES_PRIORITY}; | 172 NEW_CONTENT_TAKES_PRIORITY}; |
| 173 int priority_count = 0; | 173 int priority_count = 0; |
| 174 | 174 |
| 175 std::vector<FakePictureLayerImpl*> layers = | 175 std::vector<FakePictureLayerImpl*> layers = |
| 176 CreateLayers(layer_count, tile_count); | 176 CreateLayers(layer_count, tile_count); |
| 177 for (const auto& layer : layers) { | 177 for (auto* layer : layers) { |
| 178 layer->UpdateTiles(); | 178 layer->UpdateTiles(); |
| 179 for (size_t i = 0; i < layer->num_tilings(); ++i) { | 179 for (size_t i = 0; i < layer->num_tilings(); ++i) { |
| 180 tile_manager()->InitializeTilesWithResourcesForTesting( | 180 tile_manager()->InitializeTilesWithResourcesForTesting( |
| 181 layer->tilings()->tiling_at(i)->AllTilesForTesting()); | 181 layer->tilings()->tiling_at(i)->AllTilesForTesting()); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 timer_.Reset(); | 185 timer_.Reset(); |
| 186 do { | 186 do { |
| 187 int count = tile_count; | 187 int count = tile_count; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 274 |
| 275 void RunPrepareTilesTest(const std::string& test_name, | 275 void RunPrepareTilesTest(const std::string& test_name, |
| 276 int layer_count, | 276 int layer_count, |
| 277 int approximate_tile_count_per_layer) { | 277 int approximate_tile_count_per_layer) { |
| 278 std::vector<FakePictureLayerImpl*> layers = | 278 std::vector<FakePictureLayerImpl*> layers = |
| 279 CreateLayers(layer_count, approximate_tile_count_per_layer); | 279 CreateLayers(layer_count, approximate_tile_count_per_layer); |
| 280 | 280 |
| 281 timer_.Reset(); | 281 timer_.Reset(); |
| 282 do { | 282 do { |
| 283 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 283 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
| 284 for (const auto& layer : layers) | 284 for (auto* layer : layers) |
| 285 layer->UpdateTiles(); | 285 layer->UpdateTiles(); |
| 286 | 286 |
| 287 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); | 287 GlobalStateThatImpactsTilePriority global_state(GlobalStateForTest()); |
| 288 tile_manager()->PrepareTiles(global_state); | 288 tile_manager()->PrepareTiles(global_state); |
| 289 tile_manager()->Flush(); | 289 tile_manager()->Flush(); |
| 290 timer_.NextLap(); | 290 timer_.NextLap(); |
| 291 } while (!timer_.HasTimeLimitExpired()); | 291 } while (!timer_.HasTimeLimitExpired()); |
| 292 | 292 |
| 293 perf_test::PrintResult("prepare_tiles", "", test_name, | 293 perf_test::PrintResult("prepare_tiles", "", test_name, |
| 294 timer_.LapsPerSecond(), "runs/s", true); | 294 timer_.LapsPerSecond(), "runs/s", true); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); | 349 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); |
| 350 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 350 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
| 351 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 351 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
| 352 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 352 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
| 353 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 353 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
| 354 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 354 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
| 355 } | 355 } |
| 356 | 356 |
| 357 } // namespace | 357 } // namespace |
| 358 } // namespace cc | 358 } // namespace cc |
| OLD | NEW |