| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include "cc/debug/lap_timer.h" | 7 #include "cc/debug/lap_timer.h" |
| 8 #include "cc/test/fake_impl_proxy.h" | 8 #include "cc/test/fake_impl_proxy.h" |
| 9 #include "cc/test/fake_layer_tree_host_impl.h" | 9 #include "cc/test/fake_layer_tree_host_impl.h" |
| 10 #include "cc/test/fake_output_surface.h" | 10 #include "cc/test/fake_output_surface.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 const gfx::Size& viewport_size) { | 73 const gfx::Size& viewport_size) { |
| 74 host_impl_.SetViewportSize(viewport_size); | 74 host_impl_.SetViewportSize(viewport_size); |
| 75 host_impl_.pending_tree()->UpdateDrawProperties(); | 75 host_impl_.pending_tree()->UpdateDrawProperties(); |
| 76 | 76 |
| 77 timer_.Reset(); | 77 timer_.Reset(); |
| 78 do { | 78 do { |
| 79 int count = num_tiles; | 79 int count = num_tiles; |
| 80 PictureLayerImpl::LayerRasterTileIterator it(pending_layer_, false); | 80 PictureLayerImpl::LayerRasterTileIterator it(pending_layer_, false); |
| 81 while (count--) { | 81 while (count--) { |
| 82 ASSERT_TRUE(it) << "count: " << count; | 82 ASSERT_TRUE(it) << "count: " << count; |
| 83 ASSERT_TRUE(*it != NULL) << "count: " << count; | 83 ASSERT_TRUE(*it != nullptr) << "count: " << count; |
| 84 ++it; | 84 ++it; |
| 85 } | 85 } |
| 86 timer_.NextLap(); | 86 timer_.NextLap(); |
| 87 } while (!timer_.HasTimeLimitExpired()); | 87 } while (!timer_.HasTimeLimitExpired()); |
| 88 | 88 |
| 89 perf_test::PrintResult("layer_raster_tile_iterator_construct_and_iterate", | 89 perf_test::PrintResult("layer_raster_tile_iterator_construct_and_iterate", |
| 90 "", | 90 "", |
| 91 test_name, | 91 test_name, |
| 92 timer_.LapsPerSecond(), | 92 timer_.LapsPerSecond(), |
| 93 "runs/s", | 93 "runs/s", |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 SMOOTHNESS_TAKES_PRIORITY, | 126 SMOOTHNESS_TAKES_PRIORITY, |
| 127 NEW_CONTENT_TAKES_PRIORITY}; | 127 NEW_CONTENT_TAKES_PRIORITY}; |
| 128 int priority_count = 0; | 128 int priority_count = 0; |
| 129 timer_.Reset(); | 129 timer_.Reset(); |
| 130 do { | 130 do { |
| 131 int count = num_tiles; | 131 int count = num_tiles; |
| 132 PictureLayerImpl::LayerEvictionTileIterator it( | 132 PictureLayerImpl::LayerEvictionTileIterator it( |
| 133 pending_layer_, priorities[priority_count]); | 133 pending_layer_, priorities[priority_count]); |
| 134 while (count--) { | 134 while (count--) { |
| 135 ASSERT_TRUE(it) << "count: " << count; | 135 ASSERT_TRUE(it) << "count: " << count; |
| 136 ASSERT_TRUE(*it != NULL) << "count: " << count; | 136 ASSERT_TRUE(*it != nullptr) << "count: " << count; |
| 137 ++it; | 137 ++it; |
| 138 } | 138 } |
| 139 priority_count = (priority_count + 1) % arraysize(priorities); | 139 priority_count = (priority_count + 1) % arraysize(priorities); |
| 140 timer_.NextLap(); | 140 timer_.NextLap(); |
| 141 } while (!timer_.HasTimeLimitExpired()); | 141 } while (!timer_.HasTimeLimitExpired()); |
| 142 | 142 |
| 143 perf_test::PrintResult("layer_eviction_tile_iterator_construct_and_iterate", | 143 perf_test::PrintResult("layer_eviction_tile_iterator_construct_and_iterate", |
| 144 "", | 144 "", |
| 145 test_name, | 145 test_name, |
| 146 timer_.LapsPerSecond(), | 146 timer_.LapsPerSecond(), |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | 231 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
| 232 | 232 |
| 233 std::vector<Tile*> all_tiles; | 233 std::vector<Tile*> all_tiles; |
| 234 AddTiling(low_res_factor, pending_layer_, &all_tiles); | 234 AddTiling(low_res_factor, pending_layer_, &all_tiles); |
| 235 AddTiling(0.3f, pending_layer_, &all_tiles); | 235 AddTiling(0.3f, pending_layer_, &all_tiles); |
| 236 AddTiling(0.7f, pending_layer_, &all_tiles); | 236 AddTiling(0.7f, pending_layer_, &all_tiles); |
| 237 AddTiling(1.0f, pending_layer_, &all_tiles); | 237 AddTiling(1.0f, pending_layer_, &all_tiles); |
| 238 AddTiling(2.0f, pending_layer_, &all_tiles); | 238 AddTiling(2.0f, pending_layer_, &all_tiles); |
| 239 | 239 |
| 240 ASSERT_TRUE(host_impl_.tile_manager() != NULL); | 240 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); |
| 241 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); | 241 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); |
| 242 | 242 |
| 243 RunEvictionIteratorConstructAndIterateTest( | 243 RunEvictionIteratorConstructAndIterateTest( |
| 244 "32_100x100", 32, gfx::Size(100, 100)); | 244 "32_100x100", 32, gfx::Size(100, 100)); |
| 245 RunEvictionIteratorConstructAndIterateTest( | 245 RunEvictionIteratorConstructAndIterateTest( |
| 246 "32_500x500", 32, gfx::Size(500, 500)); | 246 "32_500x500", 32, gfx::Size(500, 500)); |
| 247 RunEvictionIteratorConstructAndIterateTest( | 247 RunEvictionIteratorConstructAndIterateTest( |
| 248 "64_100x100", 64, gfx::Size(100, 100)); | 248 "64_100x100", 64, gfx::Size(100, 100)); |
| 249 RunEvictionIteratorConstructAndIterateTest( | 249 RunEvictionIteratorConstructAndIterateTest( |
| 250 "64_500x500", 64, gfx::Size(500, 500)); | 250 "64_500x500", 64, gfx::Size(500, 500)); |
| 251 } | 251 } |
| 252 | 252 |
| 253 TEST_F(PictureLayerImplPerfTest, LayerEvictionTileIteratorConstruct) { | 253 TEST_F(PictureLayerImplPerfTest, LayerEvictionTileIteratorConstruct) { |
| 254 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256)); | 254 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256)); |
| 255 | 255 |
| 256 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | 256 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
| 257 | 257 |
| 258 std::vector<Tile*> all_tiles; | 258 std::vector<Tile*> all_tiles; |
| 259 AddTiling(low_res_factor, pending_layer_, &all_tiles); | 259 AddTiling(low_res_factor, pending_layer_, &all_tiles); |
| 260 AddTiling(0.3f, pending_layer_, &all_tiles); | 260 AddTiling(0.3f, pending_layer_, &all_tiles); |
| 261 AddTiling(0.7f, pending_layer_, &all_tiles); | 261 AddTiling(0.7f, pending_layer_, &all_tiles); |
| 262 AddTiling(1.0f, pending_layer_, &all_tiles); | 262 AddTiling(1.0f, pending_layer_, &all_tiles); |
| 263 AddTiling(2.0f, pending_layer_, &all_tiles); | 263 AddTiling(2.0f, pending_layer_, &all_tiles); |
| 264 | 264 |
| 265 ASSERT_TRUE(host_impl_.tile_manager() != NULL); | 265 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); |
| 266 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); | 266 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); |
| 267 | 267 |
| 268 RunEvictionIteratorConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); | 268 RunEvictionIteratorConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); |
| 269 RunEvictionIteratorConstructTest("5000_0_100x100", | 269 RunEvictionIteratorConstructTest("5000_0_100x100", |
| 270 gfx::Rect(5000, 0, 100, 100)); | 270 gfx::Rect(5000, 0, 100, 100)); |
| 271 RunEvictionIteratorConstructTest("9999_0_100x100", | 271 RunEvictionIteratorConstructTest("9999_0_100x100", |
| 272 gfx::Rect(9999, 0, 100, 100)); | 272 gfx::Rect(9999, 0, 100, 100)); |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace | 275 } // namespace |
| 276 } // namespace cc | 276 } // namespace cc |
| OLD | NEW |