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