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 "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
9 #include "cc/base/lap_timer.h" | 9 #include "cc/base/lap_timer.h" |
10 #include "cc/test/fake_compositor_frame_sink.h" | 10 #include "cc/test/fake_compositor_frame_sink.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace cc { | 21 namespace cc { |
22 namespace { | 22 namespace { |
23 | 23 |
24 static const int kTimeLimitMillis = 2000; | 24 static const int kTimeLimitMillis = 2000; |
25 static const int kWarmupRuns = 5; | 25 static const int kWarmupRuns = 5; |
26 static const int kTimeCheckInterval = 10; | 26 static const int kTimeCheckInterval = 10; |
27 | 27 |
28 void AddTiling(float scale, | 28 void AddTiling(float scale, |
29 FakePictureLayerImpl* layer, | 29 FakePictureLayerImpl* layer, |
30 std::vector<Tile*>* all_tiles) { | 30 std::vector<Tile*>* all_tiles) { |
31 PictureLayerTiling* tiling = layer->AddTiling(scale); | 31 PictureLayerTiling* tiling = |
| 32 layer->AddTiling(gfx::AxisTransform2d(scale, gfx::Vector2dF())); |
32 | 33 |
33 tiling->set_resolution(HIGH_RESOLUTION); | 34 tiling->set_resolution(HIGH_RESOLUTION); |
34 tiling->CreateAllTilesForTesting(); | 35 tiling->CreateAllTilesForTesting(); |
35 std::vector<Tile*> tiling_tiles = tiling->AllTilesForTesting(); | 36 std::vector<Tile*> tiling_tiles = tiling->AllTilesForTesting(); |
36 std::copy( | 37 std::copy( |
37 tiling_tiles.begin(), tiling_tiles.end(), std::back_inserter(*all_tiles)); | 38 tiling_tiles.begin(), tiling_tiles.end(), std::back_inserter(*all_tiles)); |
38 } | 39 } |
39 | 40 |
40 class PictureLayerImplPerfTest : public testing::Test { | 41 class PictureLayerImplPerfTest : public testing::Test { |
41 public: | 42 public: |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 180 |
180 private: | 181 private: |
181 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); | 182 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); |
182 }; | 183 }; |
183 | 184 |
184 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstructAndIterate) { | 185 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstructAndIterate) { |
185 SetupPendingTree(gfx::Size(10000, 10000)); | 186 SetupPendingTree(gfx::Size(10000, 10000)); |
186 | 187 |
187 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | 188 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
188 | 189 |
189 pending_layer_->AddTiling(low_res_factor); | 190 pending_layer_->AddTiling( |
190 pending_layer_->AddTiling(0.3f); | 191 gfx::AxisTransform2d(low_res_factor, gfx::Vector2dF())); |
191 pending_layer_->AddTiling(0.7f); | 192 pending_layer_->AddTiling(gfx::AxisTransform2d(0.3f, gfx::Vector2dF())); |
192 pending_layer_->AddTiling(1.0f); | 193 pending_layer_->AddTiling(gfx::AxisTransform2d(0.7f, gfx::Vector2dF())); |
193 pending_layer_->AddTiling(2.0f); | 194 pending_layer_->AddTiling(gfx::AxisTransform2d(1.0f, gfx::Vector2dF())); |
| 195 pending_layer_->AddTiling(gfx::AxisTransform2d(2.0f, gfx::Vector2dF())); |
194 | 196 |
195 RunRasterQueueConstructAndIterateTest("32_100x100", 32, gfx::Size(100, 100)); | 197 RunRasterQueueConstructAndIterateTest("32_100x100", 32, gfx::Size(100, 100)); |
196 RunRasterQueueConstructAndIterateTest("32_500x500", 32, gfx::Size(500, 500)); | 198 RunRasterQueueConstructAndIterateTest("32_500x500", 32, gfx::Size(500, 500)); |
197 RunRasterQueueConstructAndIterateTest("64_100x100", 64, gfx::Size(100, 100)); | 199 RunRasterQueueConstructAndIterateTest("64_100x100", 64, gfx::Size(100, 100)); |
198 RunRasterQueueConstructAndIterateTest("64_500x500", 64, gfx::Size(500, 500)); | 200 RunRasterQueueConstructAndIterateTest("64_500x500", 64, gfx::Size(500, 500)); |
199 } | 201 } |
200 | 202 |
201 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstruct) { | 203 TEST_F(PictureLayerImplPerfTest, TilingSetRasterQueueConstruct) { |
202 SetupPendingTree(gfx::Size(10000, 10000)); | 204 SetupPendingTree(gfx::Size(10000, 10000)); |
203 | 205 |
204 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | 206 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
205 | 207 |
206 pending_layer_->AddTiling(low_res_factor); | 208 pending_layer_->AddTiling( |
207 pending_layer_->AddTiling(0.3f); | 209 gfx::AxisTransform2d(low_res_factor, gfx::Vector2dF())); |
208 pending_layer_->AddTiling(0.7f); | 210 pending_layer_->AddTiling(gfx::AxisTransform2d(0.3f, gfx::Vector2dF())); |
209 pending_layer_->AddTiling(1.0f); | 211 pending_layer_->AddTiling(gfx::AxisTransform2d(0.7f, gfx::Vector2dF())); |
210 pending_layer_->AddTiling(2.0f); | 212 pending_layer_->AddTiling(gfx::AxisTransform2d(1.0f, gfx::Vector2dF())); |
| 213 pending_layer_->AddTiling(gfx::AxisTransform2d(2.0f, gfx::Vector2dF())); |
211 | 214 |
212 RunRasterQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); | 215 RunRasterQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); |
213 RunRasterQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); | 216 RunRasterQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); |
214 RunRasterQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); | 217 RunRasterQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); |
215 } | 218 } |
216 | 219 |
217 TEST_F(PictureLayerImplPerfTest, TilingSetEvictionQueueConstructAndIterate) { | 220 TEST_F(PictureLayerImplPerfTest, TilingSetEvictionQueueConstructAndIterate) { |
218 SetupPendingTree(gfx::Size(10000, 10000)); | 221 SetupPendingTree(gfx::Size(10000, 10000)); |
219 | 222 |
220 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | 223 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); | 257 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); |
255 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); | 258 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); |
256 | 259 |
257 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); | 260 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); |
258 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); | 261 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); |
259 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); | 262 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); |
260 } | 263 } |
261 | 264 |
262 } // namespace | 265 } // namespace |
263 } // namespace cc | 266 } // namespace cc |
OLD | NEW |