| 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_->Invalidate(region); |
| 61 picture_layer_tiling_client_.raster_source(), region, | |
| 62 picture_layer_tiling_->tiling_size()); | |
| 63 timer_.NextLap(); | 64 timer_.NextLap(); |
| 64 } while (!timer_.HasTimeLimitExpired()); | 65 } while (!timer_.HasTimeLimitExpired()); |
| 65 | 66 |
| 66 perf_test::PrintResult( | 67 perf_test::PrintResult( |
| 67 "invalidation", "", test_name, timer_.LapsPerSecond(), "runs/s", true); | 68 "invalidation", "", test_name, timer_.LapsPerSecond(), "runs/s", true); |
| 68 } | 69 } |
| 69 | 70 |
| 70 void RunComputeTilePriorityRectsStationaryTest( | 71 void RunComputeTilePriorityRectsStationaryTest( |
| 71 const std::string& test_name, | 72 const std::string& test_name, |
| 72 const gfx::Transform& transform) { | 73 const gfx::Transform& transform) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 "", | 120 "", |
| 120 test_name, | 121 test_name, |
| 121 timer_.LapsPerSecond(), | 122 timer_.LapsPerSecond(), |
| 122 "runs/s", | 123 "runs/s", |
| 123 true); | 124 true); |
| 124 } | 125 } |
| 125 | 126 |
| 126 void RunRasterIteratorConstructTest(const std::string& test_name, | 127 void RunRasterIteratorConstructTest(const std::string& test_name, |
| 127 const gfx::Rect& viewport) { | 128 const gfx::Rect& viewport) { |
| 128 gfx::Size bounds(viewport.size()); | 129 gfx::Size bounds(viewport.size()); |
| 129 picture_layer_tiling_ = | 130 LayerTreeSettings defaults; |
| 130 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); | 131 picture_layer_tiling_ = PictureLayerTiling::Create( |
| 132 1, bounds, &picture_layer_tiling_client_, |
| 133 defaults.max_tiles_for_interest_area, |
| 134 defaults.skewport_target_time_in_seconds, |
| 135 defaults.skewport_extrapolation_limit_in_content_pixels); |
| 131 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); | 136 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); |
| 132 picture_layer_tiling_->ComputeTilePriorityRects(viewport, 1.0f, 1.0, | 137 picture_layer_tiling_->ComputeTilePriorityRects(viewport, 1.0f, 1.0, |
| 133 Occlusion()); | 138 Occlusion()); |
| 134 | 139 |
| 135 timer_.Reset(); | 140 timer_.Reset(); |
| 136 do { | 141 do { |
| 137 PictureLayerTiling::TilingRasterTileIterator it( | 142 PictureLayerTiling::TilingRasterTileIterator it( |
| 138 picture_layer_tiling_.get()); | 143 picture_layer_tiling_.get()); |
| 139 timer_.NextLap(); | 144 timer_.NextLap(); |
| 140 } while (!timer_.HasTimeLimitExpired()); | 145 } while (!timer_.HasTimeLimitExpired()); |
| 141 | 146 |
| 142 perf_test::PrintResult("tiling_raster_tile_iterator_construct", | 147 perf_test::PrintResult("tiling_raster_tile_iterator_construct", |
| 143 "", | 148 "", |
| 144 test_name, | 149 test_name, |
| 145 timer_.LapsPerSecond(), | 150 timer_.LapsPerSecond(), |
| 146 "runs/s", | 151 "runs/s", |
| 147 true); | 152 true); |
| 148 } | 153 } |
| 149 | 154 |
| 150 void RunRasterIteratorConstructAndIterateTest(const std::string& test_name, | 155 void RunRasterIteratorConstructAndIterateTest(const std::string& test_name, |
| 151 int num_tiles, | 156 int num_tiles, |
| 152 const gfx::Rect& viewport) { | 157 const gfx::Rect& viewport) { |
| 153 gfx::Size bounds(10000, 10000); | 158 gfx::Size bounds(10000, 10000); |
| 154 picture_layer_tiling_ = | 159 LayerTreeSettings defaults; |
| 155 PictureLayerTiling::Create(1, bounds, &picture_layer_tiling_client_); | 160 picture_layer_tiling_ = PictureLayerTiling::Create( |
| 161 1, bounds, &picture_layer_tiling_client_, |
| 162 defaults.max_tiles_for_interest_area, |
| 163 defaults.skewport_target_time_in_seconds, |
| 164 defaults.skewport_extrapolation_limit_in_content_pixels); |
| 156 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); | 165 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); |
| 157 picture_layer_tiling_->ComputeTilePriorityRects(viewport, 1.0f, 1.0, | 166 picture_layer_tiling_->ComputeTilePriorityRects(viewport, 1.0f, 1.0, |
| 158 Occlusion()); | 167 Occlusion()); |
| 159 | 168 |
| 160 timer_.Reset(); | 169 timer_.Reset(); |
| 161 do { | 170 do { |
| 162 int count = num_tiles; | 171 int count = num_tiles; |
| 163 PictureLayerTiling::TilingRasterTileIterator it( | 172 PictureLayerTiling::TilingRasterTileIterator it( |
| 164 picture_layer_tiling_.get()); | 173 picture_layer_tiling_.get()); |
| 165 while (count--) { | 174 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)); | 246 "32_500x500", 32, gfx::Rect(0, 0, 500, 500)); |
| 238 RunRasterIteratorConstructAndIterateTest( | 247 RunRasterIteratorConstructAndIterateTest( |
| 239 "64_100x100", 64, gfx::Rect(0, 0, 100, 100)); | 248 "64_100x100", 64, gfx::Rect(0, 0, 100, 100)); |
| 240 RunRasterIteratorConstructAndIterateTest( | 249 RunRasterIteratorConstructAndIterateTest( |
| 241 "64_500x500", 64, gfx::Rect(0, 0, 500, 500)); | 250 "64_500x500", 64, gfx::Rect(0, 0, 500, 500)); |
| 242 } | 251 } |
| 243 | 252 |
| 244 } // namespace | 253 } // namespace |
| 245 | 254 |
| 246 } // namespace cc | 255 } // namespace cc |
| OLD | NEW |