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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } while (!timer_.HasTimeLimitExpired()); | 121 } while (!timer_.HasTimeLimitExpired()); |
122 | 122 |
123 perf_test::PrintResult("compute_tile_priority_rects_scrolling", | 123 perf_test::PrintResult("compute_tile_priority_rects_scrolling", |
124 "", | 124 "", |
125 test_name, | 125 test_name, |
126 timer_.LapsPerSecond(), | 126 timer_.LapsPerSecond(), |
127 "runs/s", | 127 "runs/s", |
128 true); | 128 true); |
129 } | 129 } |
130 | 130 |
131 void RunRasterIteratorConstructTest(const std::string& test_name, | |
132 const gfx::Rect& viewport) { | |
133 LayerTreeSettings defaults; | |
134 scoped_refptr<FakePicturePileImpl> pile = | |
135 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize( | |
136 viewport.size()); | |
137 picture_layer_tiling_ = PictureLayerTiling::Create( | |
138 1, pile, &picture_layer_tiling_client_, | |
139 defaults.max_tiles_for_interest_area, | |
140 defaults.skewport_target_time_in_seconds, | |
141 defaults.skewport_extrapolation_limit_in_content_pixels); | |
142 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); | |
143 picture_layer_tiling_->ComputeTilePriorityRects(viewport, 1.0f, 1.0, | |
144 Occlusion()); | |
145 | |
146 timer_.Reset(); | |
147 do { | |
148 PictureLayerTiling::TilingRasterTileIterator it( | |
149 picture_layer_tiling_.get()); | |
150 timer_.NextLap(); | |
151 } while (!timer_.HasTimeLimitExpired()); | |
152 | |
153 perf_test::PrintResult("tiling_raster_tile_iterator_construct", | |
154 "", | |
155 test_name, | |
156 timer_.LapsPerSecond(), | |
157 "runs/s", | |
158 true); | |
159 } | |
160 | |
161 void RunRasterIteratorConstructAndIterateTest(const std::string& test_name, | |
162 int num_tiles, | |
163 const gfx::Rect& viewport) { | |
164 gfx::Size bounds(10000, 10000); | |
165 LayerTreeSettings defaults; | |
166 scoped_refptr<FakePicturePileImpl> pile = | |
167 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(bounds); | |
168 picture_layer_tiling_ = PictureLayerTiling::Create( | |
169 1, pile, &picture_layer_tiling_client_, | |
170 defaults.max_tiles_for_interest_area, | |
171 defaults.skewport_target_time_in_seconds, | |
172 defaults.skewport_extrapolation_limit_in_content_pixels); | |
173 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); | |
174 picture_layer_tiling_->ComputeTilePriorityRects(viewport, 1.0f, 1.0, | |
175 Occlusion()); | |
176 | |
177 timer_.Reset(); | |
178 do { | |
179 int count = num_tiles; | |
180 PictureLayerTiling::TilingRasterTileIterator it( | |
181 picture_layer_tiling_.get()); | |
182 while (count--) { | |
183 ASSERT_TRUE(it) << "count: " << count; | |
184 ASSERT_TRUE(*it != NULL) << "count: " << count; | |
185 ++it; | |
186 } | |
187 timer_.NextLap(); | |
188 } while (!timer_.HasTimeLimitExpired()); | |
189 | |
190 perf_test::PrintResult("tiling_raster_tile_iterator_construct_and_iterate", | |
191 "", | |
192 test_name, | |
193 timer_.LapsPerSecond(), | |
194 "runs/s", | |
195 true); | |
196 } | |
197 | |
198 private: | 131 private: |
199 FakePictureLayerTilingClient picture_layer_tiling_client_; | 132 FakePictureLayerTilingClient picture_layer_tiling_client_; |
200 scoped_ptr<PictureLayerTiling> picture_layer_tiling_; | 133 scoped_ptr<PictureLayerTiling> picture_layer_tiling_; |
201 | 134 |
202 LapTimer timer_; | 135 LapTimer timer_; |
203 | 136 |
204 scoped_refptr<ContextProvider> context_provider_; | 137 scoped_refptr<ContextProvider> context_provider_; |
205 FakeOutputSurfaceClient output_surface_client_; | 138 FakeOutputSurfaceClient output_surface_client_; |
206 scoped_ptr<FakeOutputSurface> output_surface_; | 139 scoped_ptr<FakeOutputSurface> output_surface_; |
207 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; | 140 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; |
(...skipping 24 matching lines...) Expand all Loading... |
232 | 165 |
233 transform.Rotate(10); | 166 transform.Rotate(10); |
234 RunComputeTilePriorityRectsStationaryTest("rotation", transform); | 167 RunComputeTilePriorityRectsStationaryTest("rotation", transform); |
235 RunComputeTilePriorityRectsScrollingTest("rotation", transform); | 168 RunComputeTilePriorityRectsScrollingTest("rotation", transform); |
236 | 169 |
237 transform.ApplyPerspectiveDepth(10); | 170 transform.ApplyPerspectiveDepth(10); |
238 RunComputeTilePriorityRectsStationaryTest("perspective", transform); | 171 RunComputeTilePriorityRectsStationaryTest("perspective", transform); |
239 RunComputeTilePriorityRectsScrollingTest("perspective", transform); | 172 RunComputeTilePriorityRectsScrollingTest("perspective", transform); |
240 } | 173 } |
241 | 174 |
242 TEST_F(PictureLayerTilingPerfTest, TilingRasterTileIteratorConstruct) { | |
243 RunRasterIteratorConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); | |
244 RunRasterIteratorConstructTest("50_0_100x100", gfx::Rect(50, 0, 100, 100)); | |
245 RunRasterIteratorConstructTest("100_0_100x100", gfx::Rect(100, 0, 100, 100)); | |
246 RunRasterIteratorConstructTest("150_0_100x100", gfx::Rect(150, 0, 100, 100)); | |
247 } | |
248 | |
249 TEST_F(PictureLayerTilingPerfTest, | |
250 TilingRasterTileIteratorConstructAndIterate) { | |
251 RunRasterIteratorConstructAndIterateTest( | |
252 "32_100x100", 32, gfx::Rect(0, 0, 100, 100)); | |
253 RunRasterIteratorConstructAndIterateTest( | |
254 "32_500x500", 32, gfx::Rect(0, 0, 500, 500)); | |
255 RunRasterIteratorConstructAndIterateTest( | |
256 "64_100x100", 64, gfx::Rect(0, 0, 100, 100)); | |
257 RunRasterIteratorConstructAndIterateTest( | |
258 "64_500x500", 64, gfx::Rect(0, 0, 500, 500)); | |
259 } | |
260 | |
261 } // namespace | 175 } // namespace |
262 | |
263 } // namespace cc | 176 } // namespace cc |
OLD | NEW |