| 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 "cc/debug/lap_timer.h" | 5 #include "cc/debug/lap_timer.h" |
| 6 #include "cc/resources/picture_layer_tiling.h" | 6 #include "cc/resources/picture_layer_tiling.h" |
| 7 #include "cc/resources/resource_provider.h" | 7 #include "cc/resources/resource_provider.h" |
| 8 #include "cc/resources/scoped_resource.h" | 8 #include "cc/resources/scoped_resource.h" |
| 9 #include "cc/test/fake_output_surface.h" | 9 #include "cc/test/fake_output_surface.h" |
| 10 #include "cc/test/fake_output_surface_client.h" | 10 #include "cc/test/fake_output_surface_client.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 resource_provider_ = ResourceProvider::Create(output_surface_.get(), | 37 resource_provider_ = ResourceProvider::Create(output_surface_.get(), |
| 38 shared_bitmap_manager_.get(), | 38 shared_bitmap_manager_.get(), |
| 39 NULL, | 39 NULL, |
| 40 NULL, | 40 NULL, |
| 41 0, | 41 0, |
| 42 false, | 42 false, |
| 43 1).Pass(); | 43 1).Pass(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void SetUp() override { | 46 void SetUp() override { |
| 47 LayerTreeSettings defaults; |
| 47 picture_layer_tiling_client_.SetTileSize(gfx::Size(256, 256)); | 48 picture_layer_tiling_client_.SetTileSize(gfx::Size(256, 256)); |
| 48 picture_layer_tiling_client_.set_max_tiles_for_interest_area(250); | |
| 49 picture_layer_tiling_client_.set_tree(PENDING_TREE); | 49 picture_layer_tiling_client_.set_tree(PENDING_TREE); |
| 50 picture_layer_tiling_ = PictureLayerTiling::Create( | 50 picture_layer_tiling_ = PictureLayerTiling::Create( |
| 51 1, gfx::Size(256 * 50, 256 * 50), &picture_layer_tiling_client_); | 51 1, gfx::Size(256 * 50, 256 * 50), &picture_layer_tiling_client_, |
| 52 defaults.max_tiles_for_interest_area, |
| 53 defaults.skewport_target_time_in_seconds, |
| 54 defaults.skewport_extrapolation_limit_in_content_pixels); |
| 52 picture_layer_tiling_->CreateAllTilesForTesting(); | 55 picture_layer_tiling_->CreateAllTilesForTesting(); |
| 53 } | 56 } |
| 54 | 57 |
| 55 void TearDown() override { picture_layer_tiling_.reset(NULL); } | 58 void TearDown() override { picture_layer_tiling_.reset(NULL); } |
| 56 | 59 |
| 57 void RunInvalidateTest(const std::string& test_name, const Region& region) { | 60 void RunInvalidateTest(const std::string& test_name, const Region& region) { |
| 58 timer_.Reset(); | 61 timer_.Reset(); |
| 59 do { | 62 do { |
| 60 picture_layer_tiling_->UpdateTilesToCurrentRasterSource( | 63 picture_layer_tiling_->UpdateTilesToCurrentRasterSource( |
| 61 picture_layer_tiling_client_.raster_source(), region, | 64 picture_layer_tiling_client_.raster_source(), region, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 "", | 122 "", |
| 120 test_name, | 123 test_name, |
| 121 timer_.LapsPerSecond(), | 124 timer_.LapsPerSecond(), |
| 122 "runs/s", | 125 "runs/s", |
| 123 true); | 126 true); |
| 124 } | 127 } |
| 125 | 128 |
| 126 void RunRasterIteratorConstructTest(const std::string& test_name, | 129 void RunRasterIteratorConstructTest(const std::string& test_name, |
| 127 const gfx::Rect& viewport) { | 130 const gfx::Rect& viewport) { |
| 128 gfx::Size bounds(viewport.size()); | 131 gfx::Size bounds(viewport.size()); |
| 129 picture_layer_tiling_ = | 132 LayerTreeSettings defaults; |
| 130 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); | 133 picture_layer_tiling_ = PictureLayerTiling::Create( |
| 134 1, bounds, &picture_layer_tiling_client_, |
| 135 defaults.max_tiles_for_interest_area, |
| 136 defaults.skewport_target_time_in_seconds, |
| 137 defaults.skewport_extrapolation_limit_in_content_pixels); |
| 131 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); | 138 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); |
| 132 picture_layer_tiling_->ComputeTilePriorityRects(viewport, 1.0f, 1.0, | 139 picture_layer_tiling_->ComputeTilePriorityRects(viewport, 1.0f, 1.0, |
| 133 Occlusion()); | 140 Occlusion()); |
| 134 | 141 |
| 135 timer_.Reset(); | 142 timer_.Reset(); |
| 136 do { | 143 do { |
| 137 PictureLayerTiling::TilingRasterTileIterator it( | 144 PictureLayerTiling::TilingRasterTileIterator it( |
| 138 picture_layer_tiling_.get()); | 145 picture_layer_tiling_.get()); |
| 139 timer_.NextLap(); | 146 timer_.NextLap(); |
| 140 } while (!timer_.HasTimeLimitExpired()); | 147 } while (!timer_.HasTimeLimitExpired()); |
| 141 | 148 |
| 142 perf_test::PrintResult("tiling_raster_tile_iterator_construct", | 149 perf_test::PrintResult("tiling_raster_tile_iterator_construct", |
| 143 "", | 150 "", |
| 144 test_name, | 151 test_name, |
| 145 timer_.LapsPerSecond(), | 152 timer_.LapsPerSecond(), |
| 146 "runs/s", | 153 "runs/s", |
| 147 true); | 154 true); |
| 148 } | 155 } |
| 149 | 156 |
| 150 void RunRasterIteratorConstructAndIterateTest(const std::string& test_name, | 157 void RunRasterIteratorConstructAndIterateTest(const std::string& test_name, |
| 151 int num_tiles, | 158 int num_tiles, |
| 152 const gfx::Rect& viewport) { | 159 const gfx::Rect& viewport) { |
| 153 gfx::Size bounds(10000, 10000); | 160 gfx::Size bounds(10000, 10000); |
| 154 picture_layer_tiling_ = | 161 LayerTreeSettings defaults; |
| 155 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); | 162 picture_layer_tiling_ = PictureLayerTiling::Create( |
| 163 1, bounds, &picture_layer_tiling_client_, |
| 164 defaults.max_tiles_for_interest_area, |
| 165 defaults.skewport_target_time_in_seconds, |
| 166 defaults.skewport_extrapolation_limit_in_content_pixels); |
| 156 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); | 167 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); |
| 157 picture_layer_tiling_->ComputeTilePriorityRects(viewport, 1.0f, 1.0, | 168 picture_layer_tiling_->ComputeTilePriorityRects(viewport, 1.0f, 1.0, |
| 158 Occlusion()); | 169 Occlusion()); |
| 159 | 170 |
| 160 timer_.Reset(); | 171 timer_.Reset(); |
| 161 do { | 172 do { |
| 162 int count = num_tiles; | 173 int count = num_tiles; |
| 163 PictureLayerTiling::TilingRasterTileIterator it( | 174 PictureLayerTiling::TilingRasterTileIterator it( |
| 164 picture_layer_tiling_.get()); | 175 picture_layer_tiling_.get()); |
| 165 while (count--) { | 176 while (count--) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 "32_500x500", 32, gfx::Rect(0, 0, 500, 500)); | 248 "32_500x500", 32, gfx::Rect(0, 0, 500, 500)); |
| 238 RunRasterIteratorConstructAndIterateTest( | 249 RunRasterIteratorConstructAndIterateTest( |
| 239 "64_100x100", 64, gfx::Rect(0, 0, 100, 100)); | 250 "64_100x100", 64, gfx::Rect(0, 0, 100, 100)); |
| 240 RunRasterIteratorConstructAndIterateTest( | 251 RunRasterIteratorConstructAndIterateTest( |
| 241 "64_500x500", 64, gfx::Rect(0, 0, 500, 500)); | 252 "64_500x500", 64, gfx::Rect(0, 0, 500, 500)); |
| 242 } | 253 } |
| 243 | 254 |
| 244 } // namespace | 255 } // namespace |
| 245 | 256 |
| 246 } // namespace cc | 257 } // namespace cc |
| OLD | NEW |