| 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/raster_buffer.h" | 7 #include "cc/resources/raster_buffer.h" |
| 8 #include "cc/resources/tile.h" | 8 #include "cc/resources/tile.h" |
| 9 #include "cc/resources/tile_priority.h" | 9 #include "cc/resources/tile_priority.h" |
| 10 #include "cc/test/begin_frame_args_test.h" | 10 #include "cc/test/begin_frame_args_test.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 int priority_count = 0; | 174 int priority_count = 0; |
| 175 | 175 |
| 176 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); | 176 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 10); |
| 177 bool resourceless_software_draw = false; | 177 bool resourceless_software_draw = false; |
| 178 for (const auto& layer : layers) | 178 for (const auto& layer : layers) |
| 179 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 179 layer->UpdateTiles(Occlusion(), resourceless_software_draw); |
| 180 | 180 |
| 181 timer_.Reset(); | 181 timer_.Reset(); |
| 182 do { | 182 do { |
| 183 RasterTilePriorityQueue queue; | 183 RasterTilePriorityQueue queue; |
| 184 host_impl_.BuildRasterQueue(&queue, priorities[priority_count]); | 184 host_impl_.BuildRasterQueue(&queue, priorities[priority_count], |
| 185 RasterTilePriorityQueue::Type::ALL); |
| 185 priority_count = (priority_count + 1) % arraysize(priorities); | 186 priority_count = (priority_count + 1) % arraysize(priorities); |
| 186 timer_.NextLap(); | 187 timer_.NextLap(); |
| 187 } while (!timer_.HasTimeLimitExpired()); | 188 } while (!timer_.HasTimeLimitExpired()); |
| 188 | 189 |
| 189 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", | 190 perf_test::PrintResult("tile_manager_raster_tile_queue_construct", |
| 190 "", | 191 "", |
| 191 test_name, | 192 test_name, |
| 192 timer_.LapsPerSecond(), | 193 timer_.LapsPerSecond(), |
| 193 "runs/s", | 194 "runs/s", |
| 194 true); | 195 true); |
| 195 } | 196 } |
| 196 | 197 |
| 197 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, | 198 void RunRasterQueueConstructAndIterateTest(const std::string& test_name, |
| 198 int layer_count, | 199 int layer_count, |
| 199 int tile_count) { | 200 int tile_count) { |
| 200 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | 201 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, |
| 201 SMOOTHNESS_TAKES_PRIORITY, | 202 SMOOTHNESS_TAKES_PRIORITY, |
| 202 NEW_CONTENT_TAKES_PRIORITY}; | 203 NEW_CONTENT_TAKES_PRIORITY}; |
| 203 | 204 |
| 204 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); | 205 std::vector<FakePictureLayerImpl*> layers = CreateLayers(layer_count, 100); |
| 205 bool resourceless_software_draw = false; | 206 bool resourceless_software_draw = false; |
| 206 for (const auto& layer : layers) | 207 for (const auto& layer : layers) |
| 207 layer->UpdateTiles(Occlusion(), resourceless_software_draw); | 208 layer->UpdateTiles(Occlusion(), resourceless_software_draw); |
| 208 | 209 |
| 209 int priority_count = 0; | 210 int priority_count = 0; |
| 210 timer_.Reset(); | 211 timer_.Reset(); |
| 211 do { | 212 do { |
| 212 int count = tile_count; | 213 int count = tile_count; |
| 213 RasterTilePriorityQueue queue; | 214 RasterTilePriorityQueue queue; |
| 214 host_impl_.BuildRasterQueue(&queue, priorities[priority_count]); | 215 host_impl_.BuildRasterQueue(&queue, priorities[priority_count], |
| 216 RasterTilePriorityQueue::Type::ALL); |
| 215 while (count--) { | 217 while (count--) { |
| 216 ASSERT_FALSE(queue.IsEmpty()); | 218 ASSERT_FALSE(queue.IsEmpty()); |
| 217 ASSERT_TRUE(queue.Top() != NULL); | 219 ASSERT_TRUE(queue.Top() != NULL); |
| 218 queue.Pop(); | 220 queue.Pop(); |
| 219 } | 221 } |
| 220 priority_count = (priority_count + 1) % arraysize(priorities); | 222 priority_count = (priority_count + 1) % arraysize(priorities); |
| 221 timer_.NextLap(); | 223 timer_.NextLap(); |
| 222 } while (!timer_.HasTimeLimitExpired()); | 224 } while (!timer_.HasTimeLimitExpired()); |
| 223 | 225 |
| 224 perf_test::PrintResult( | 226 perf_test::PrintResult( |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); | 469 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); |
| 468 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 470 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
| 469 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 471 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
| 470 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 472 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
| 471 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 473 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
| 472 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 474 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
| 473 } | 475 } |
| 474 | 476 |
| 475 } // namespace | 477 } // namespace |
| 476 } // namespace cc | 478 } // namespace cc |
| OLD | NEW |