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" |
11 #include "cc/test/fake_picture_layer_tiling_client.h" | 11 #include "cc/test/fake_picture_layer_tiling_client.h" |
| 12 #include "cc/test/fake_picture_pile_impl.h" |
12 #include "cc/test/test_context_provider.h" | 13 #include "cc/test/test_context_provider.h" |
13 #include "cc/test/test_shared_bitmap_manager.h" | 14 #include "cc/test/test_shared_bitmap_manager.h" |
14 | 15 |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "testing/perf/perf_test.h" | 17 #include "testing/perf/perf_test.h" |
17 | 18 |
18 namespace cc { | 19 namespace cc { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
(...skipping 18 matching lines...) Expand all Loading... |
40 NULL, | 41 NULL, |
41 0, | 42 0, |
42 false, | 43 false, |
43 1).Pass(); | 44 1).Pass(); |
44 } | 45 } |
45 | 46 |
46 void SetUp() override { | 47 void SetUp() override { |
47 LayerTreeSettings defaults; | 48 LayerTreeSettings defaults; |
48 picture_layer_tiling_client_.SetTileSize(gfx::Size(256, 256)); | 49 picture_layer_tiling_client_.SetTileSize(gfx::Size(256, 256)); |
49 picture_layer_tiling_client_.set_tree(PENDING_TREE); | 50 picture_layer_tiling_client_.set_tree(PENDING_TREE); |
| 51 scoped_refptr<FakePicturePileImpl> pile = |
| 52 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize( |
| 53 gfx::Size(256 * 50, 256 * 50)); |
50 picture_layer_tiling_ = PictureLayerTiling::Create( | 54 picture_layer_tiling_ = PictureLayerTiling::Create( |
51 1, gfx::Size(256 * 50, 256 * 50), &picture_layer_tiling_client_, | 55 1, pile, &picture_layer_tiling_client_, |
52 defaults.max_tiles_for_interest_area, | 56 defaults.max_tiles_for_interest_area, |
53 defaults.skewport_target_time_in_seconds, | 57 defaults.skewport_target_time_in_seconds, |
54 defaults.skewport_extrapolation_limit_in_content_pixels); | 58 defaults.skewport_extrapolation_limit_in_content_pixels); |
55 picture_layer_tiling_->CreateAllTilesForTesting(); | 59 picture_layer_tiling_->CreateAllTilesForTesting(); |
56 } | 60 } |
57 | 61 |
58 void TearDown() override { picture_layer_tiling_.reset(NULL); } | 62 void TearDown() override { picture_layer_tiling_.reset(NULL); } |
59 | 63 |
60 void RunInvalidateTest(const std::string& test_name, const Region& region) { | 64 void RunInvalidateTest(const std::string& test_name, const Region& region) { |
61 timer_.Reset(); | 65 timer_.Reset(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 perf_test::PrintResult("compute_tile_priority_rects_scrolling", | 123 perf_test::PrintResult("compute_tile_priority_rects_scrolling", |
120 "", | 124 "", |
121 test_name, | 125 test_name, |
122 timer_.LapsPerSecond(), | 126 timer_.LapsPerSecond(), |
123 "runs/s", | 127 "runs/s", |
124 true); | 128 true); |
125 } | 129 } |
126 | 130 |
127 void RunRasterIteratorConstructTest(const std::string& test_name, | 131 void RunRasterIteratorConstructTest(const std::string& test_name, |
128 const gfx::Rect& viewport) { | 132 const gfx::Rect& viewport) { |
129 gfx::Size bounds(viewport.size()); | |
130 LayerTreeSettings defaults; | 133 LayerTreeSettings defaults; |
| 134 scoped_refptr<FakePicturePileImpl> pile = |
| 135 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize( |
| 136 viewport.size()); |
131 picture_layer_tiling_ = PictureLayerTiling::Create( | 137 picture_layer_tiling_ = PictureLayerTiling::Create( |
132 1, bounds, &picture_layer_tiling_client_, | 138 1, pile, &picture_layer_tiling_client_, |
133 defaults.max_tiles_for_interest_area, | 139 defaults.max_tiles_for_interest_area, |
134 defaults.skewport_target_time_in_seconds, | 140 defaults.skewport_target_time_in_seconds, |
135 defaults.skewport_extrapolation_limit_in_content_pixels); | 141 defaults.skewport_extrapolation_limit_in_content_pixels); |
136 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); | 142 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); |
137 picture_layer_tiling_->ComputeTilePriorityRects(viewport, 1.0f, 1.0, | 143 picture_layer_tiling_->ComputeTilePriorityRects(viewport, 1.0f, 1.0, |
138 Occlusion()); | 144 Occlusion()); |
139 | 145 |
140 timer_.Reset(); | 146 timer_.Reset(); |
141 do { | 147 do { |
142 PictureLayerTiling::TilingRasterTileIterator it( | 148 PictureLayerTiling::TilingRasterTileIterator it( |
143 picture_layer_tiling_.get()); | 149 picture_layer_tiling_.get()); |
144 timer_.NextLap(); | 150 timer_.NextLap(); |
145 } while (!timer_.HasTimeLimitExpired()); | 151 } while (!timer_.HasTimeLimitExpired()); |
146 | 152 |
147 perf_test::PrintResult("tiling_raster_tile_iterator_construct", | 153 perf_test::PrintResult("tiling_raster_tile_iterator_construct", |
148 "", | 154 "", |
149 test_name, | 155 test_name, |
150 timer_.LapsPerSecond(), | 156 timer_.LapsPerSecond(), |
151 "runs/s", | 157 "runs/s", |
152 true); | 158 true); |
153 } | 159 } |
154 | 160 |
155 void RunRasterIteratorConstructAndIterateTest(const std::string& test_name, | 161 void RunRasterIteratorConstructAndIterateTest(const std::string& test_name, |
156 int num_tiles, | 162 int num_tiles, |
157 const gfx::Rect& viewport) { | 163 const gfx::Rect& viewport) { |
158 gfx::Size bounds(10000, 10000); | 164 gfx::Size bounds(10000, 10000); |
159 LayerTreeSettings defaults; | 165 LayerTreeSettings defaults; |
| 166 scoped_refptr<FakePicturePileImpl> pile = |
| 167 FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(bounds); |
160 picture_layer_tiling_ = PictureLayerTiling::Create( | 168 picture_layer_tiling_ = PictureLayerTiling::Create( |
161 1, bounds, &picture_layer_tiling_client_, | 169 1, pile, &picture_layer_tiling_client_, |
162 defaults.max_tiles_for_interest_area, | 170 defaults.max_tiles_for_interest_area, |
163 defaults.skewport_target_time_in_seconds, | 171 defaults.skewport_target_time_in_seconds, |
164 defaults.skewport_extrapolation_limit_in_content_pixels); | 172 defaults.skewport_extrapolation_limit_in_content_pixels); |
165 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); | 173 picture_layer_tiling_client_.set_tree(ACTIVE_TREE); |
166 picture_layer_tiling_->ComputeTilePriorityRects(viewport, 1.0f, 1.0, | 174 picture_layer_tiling_->ComputeTilePriorityRects(viewport, 1.0f, 1.0, |
167 Occlusion()); | 175 Occlusion()); |
168 | 176 |
169 timer_.Reset(); | 177 timer_.Reset(); |
170 do { | 178 do { |
171 int count = num_tiles; | 179 int count = num_tiles; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 "32_500x500", 32, gfx::Rect(0, 0, 500, 500)); | 254 "32_500x500", 32, gfx::Rect(0, 0, 500, 500)); |
247 RunRasterIteratorConstructAndIterateTest( | 255 RunRasterIteratorConstructAndIterateTest( |
248 "64_100x100", 64, gfx::Rect(0, 0, 100, 100)); | 256 "64_100x100", 64, gfx::Rect(0, 0, 100, 100)); |
249 RunRasterIteratorConstructAndIterateTest( | 257 RunRasterIteratorConstructAndIterateTest( |
250 "64_500x500", 64, gfx::Rect(0, 0, 500, 500)); | 258 "64_500x500", 64, gfx::Rect(0, 0, 500, 500)); |
251 } | 259 } |
252 | 260 |
253 } // namespace | 261 } // namespace |
254 | 262 |
255 } // namespace cc | 263 } // namespace cc |
OLD | NEW |