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 "cc/debug/lap_timer.h" | 7 #include "cc/debug/lap_timer.h" |
8 #include "cc/test/fake_impl_proxy.h" | 8 #include "cc/test/fake_impl_proxy.h" |
9 #include "cc/test/fake_layer_tree_host_impl.h" | 9 #include "cc/test/fake_layer_tree_host_impl.h" |
10 #include "cc/test/fake_output_surface.h" | 10 #include "cc/test/fake_output_surface.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 true); | 115 true); |
116 } | 116 } |
117 | 117 |
118 void RunEvictionIteratorConstructAndIterateTest( | 118 void RunEvictionIteratorConstructAndIterateTest( |
119 const std::string& test_name, | 119 const std::string& test_name, |
120 int num_tiles, | 120 int num_tiles, |
121 const gfx::Size& viewport_size) { | 121 const gfx::Size& viewport_size) { |
122 host_impl_.SetViewportSize(viewport_size); | 122 host_impl_.SetViewportSize(viewport_size); |
123 host_impl_.pending_tree()->UpdateDrawProperties(); | 123 host_impl_.pending_tree()->UpdateDrawProperties(); |
124 | 124 |
125 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | |
126 SMOOTHNESS_TAKES_PRIORITY, | |
127 NEW_CONTENT_TAKES_PRIORITY}; | |
128 int priority_count = 0; | |
129 timer_.Reset(); | 125 timer_.Reset(); |
130 do { | 126 do { |
131 int count = num_tiles; | 127 int count = num_tiles; |
132 PictureLayerImpl::LayerEvictionTileIterator it( | 128 PictureLayerImpl::LayerEvictionTileIterator it(pending_layer_); |
133 pending_layer_, priorities[priority_count]); | |
134 while (count--) { | 129 while (count--) { |
135 ASSERT_TRUE(it) << "count: " << count; | 130 ASSERT_TRUE(it) << "count: " << count; |
136 ASSERT_TRUE(*it != nullptr) << "count: " << count; | 131 ASSERT_TRUE(*it != nullptr) << "count: " << count; |
137 ++it; | 132 ++it; |
138 } | 133 } |
139 priority_count = (priority_count + 1) % arraysize(priorities); | |
140 timer_.NextLap(); | 134 timer_.NextLap(); |
141 } while (!timer_.HasTimeLimitExpired()); | 135 } while (!timer_.HasTimeLimitExpired()); |
142 | 136 |
143 perf_test::PrintResult("layer_eviction_tile_iterator_construct_and_iterate", | 137 perf_test::PrintResult("layer_eviction_tile_iterator_construct_and_iterate", |
144 "", | 138 "", |
145 test_name, | 139 test_name, |
146 timer_.LapsPerSecond(), | 140 timer_.LapsPerSecond(), |
147 "runs/s", | 141 "runs/s", |
148 true); | 142 true); |
149 } | 143 } |
150 | 144 |
151 void RunEvictionIteratorConstructTest(const std::string& test_name, | 145 void RunEvictionIteratorConstructTest(const std::string& test_name, |
152 const gfx::Rect& viewport) { | 146 const gfx::Rect& viewport) { |
153 host_impl_.SetViewportSize(viewport.size()); | 147 host_impl_.SetViewportSize(viewport.size()); |
154 pending_layer_->SetScrollOffset( | 148 pending_layer_->SetScrollOffset( |
155 gfx::ScrollOffset(viewport.x(), viewport.y())); | 149 gfx::ScrollOffset(viewport.x(), viewport.y())); |
156 host_impl_.pending_tree()->UpdateDrawProperties(); | 150 host_impl_.pending_tree()->UpdateDrawProperties(); |
157 | 151 |
158 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | |
159 SMOOTHNESS_TAKES_PRIORITY, | |
160 NEW_CONTENT_TAKES_PRIORITY}; | |
161 int priority_count = 0; | |
162 timer_.Reset(); | 152 timer_.Reset(); |
163 do { | 153 do { |
164 PictureLayerImpl::LayerEvictionTileIterator it( | 154 PictureLayerImpl::LayerEvictionTileIterator it(pending_layer_); |
165 pending_layer_, priorities[priority_count]); | |
166 priority_count = (priority_count + 1) % arraysize(priorities); | |
167 timer_.NextLap(); | 155 timer_.NextLap(); |
168 } while (!timer_.HasTimeLimitExpired()); | 156 } while (!timer_.HasTimeLimitExpired()); |
169 | 157 |
170 perf_test::PrintResult("layer_eviction_tile_iterator_construct", | 158 perf_test::PrintResult("layer_eviction_tile_iterator_construct", |
171 "", | 159 "", |
172 test_name, | 160 test_name, |
173 timer_.LapsPerSecond(), | 161 timer_.LapsPerSecond(), |
174 "runs/s", | 162 "runs/s", |
175 true); | 163 true); |
176 } | 164 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 255 |
268 RunEvictionIteratorConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); | 256 RunEvictionIteratorConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); |
269 RunEvictionIteratorConstructTest("5000_0_100x100", | 257 RunEvictionIteratorConstructTest("5000_0_100x100", |
270 gfx::Rect(5000, 0, 100, 100)); | 258 gfx::Rect(5000, 0, 100, 100)); |
271 RunEvictionIteratorConstructTest("9999_0_100x100", | 259 RunEvictionIteratorConstructTest("9999_0_100x100", |
272 gfx::Rect(9999, 0, 100, 100)); | 260 gfx::Rect(9999, 0, 100, 100)); |
273 } | 261 } |
274 | 262 |
275 } // namespace | 263 } // namespace |
276 } // namespace cc | 264 } // namespace cc |
OLD | NEW |