OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layer_iterator.h" | 5 #include "cc/layers/layer_iterator.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/test/fake_layer_tree_host.h" | 10 #include "cc/test/fake_layer_tree_host.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 scoped_ptr<TestLayerImpl> second = CreateLayer(); | 123 scoped_ptr<TestLayerImpl> second = CreateLayer(); |
124 scoped_ptr<TestLayerImpl> third = CreateLayer(); | 124 scoped_ptr<TestLayerImpl> third = CreateLayer(); |
125 scoped_ptr<TestLayerImpl> fourth = CreateLayer(); | 125 scoped_ptr<TestLayerImpl> fourth = CreateLayer(); |
126 | 126 |
127 TestLayerImpl* root_ptr = root_layer.get(); | 127 TestLayerImpl* root_ptr = root_layer.get(); |
128 TestLayerImpl* first_ptr = first.get(); | 128 TestLayerImpl* first_ptr = first.get(); |
129 TestLayerImpl* second_ptr = second.get(); | 129 TestLayerImpl* second_ptr = second.get(); |
130 TestLayerImpl* third_ptr = third.get(); | 130 TestLayerImpl* third_ptr = third.get(); |
131 TestLayerImpl* fourth_ptr = fourth.get(); | 131 TestLayerImpl* fourth_ptr = fourth.get(); |
132 | 132 |
133 root_layer->AddChild(first.Pass()); | 133 root_layer->AddChild(std::move(first)); |
134 root_layer->AddChild(second.Pass()); | 134 root_layer->AddChild(std::move(second)); |
135 root_layer->AddChild(third.Pass()); | 135 root_layer->AddChild(std::move(third)); |
136 root_layer->AddChild(fourth.Pass()); | 136 root_layer->AddChild(std::move(fourth)); |
137 | 137 |
138 root_layer->SetHasRenderSurface(true); | 138 root_layer->SetHasRenderSurface(true); |
139 host_impl_.active_tree()->SetRootLayer(root_layer.Pass()); | 139 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); |
140 | 140 |
141 LayerImplList render_surface_layer_list; | 141 LayerImplList render_surface_layer_list; |
142 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 142 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
143 root_ptr, root_ptr->bounds(), &render_surface_layer_list); | 143 root_ptr, root_ptr->bounds(), &render_surface_layer_list); |
144 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 144 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
145 | 145 |
146 IterateFrontToBack(&render_surface_layer_list); | 146 IterateFrontToBack(&render_surface_layer_list); |
147 EXPECT_COUNT(root_ptr, 5, -1, 4); | 147 EXPECT_COUNT(root_ptr, 5, -1, 4); |
148 EXPECT_COUNT(first_ptr, -1, -1, 3); | 148 EXPECT_COUNT(first_ptr, -1, -1, 3); |
149 EXPECT_COUNT(second_ptr, -1, -1, 2); | 149 EXPECT_COUNT(second_ptr, -1, -1, 2); |
(...skipping 15 matching lines...) Expand all Loading... |
165 TestLayerImpl* root_ptr = root_layer.get(); | 165 TestLayerImpl* root_ptr = root_layer.get(); |
166 TestLayerImpl* root1_ptr = root1.get(); | 166 TestLayerImpl* root1_ptr = root1.get(); |
167 TestLayerImpl* root2_ptr = root2.get(); | 167 TestLayerImpl* root2_ptr = root2.get(); |
168 TestLayerImpl* root3_ptr = root3.get(); | 168 TestLayerImpl* root3_ptr = root3.get(); |
169 TestLayerImpl* root21_ptr = root21.get(); | 169 TestLayerImpl* root21_ptr = root21.get(); |
170 TestLayerImpl* root22_ptr = root22.get(); | 170 TestLayerImpl* root22_ptr = root22.get(); |
171 TestLayerImpl* root23_ptr = root23.get(); | 171 TestLayerImpl* root23_ptr = root23.get(); |
172 TestLayerImpl* root221_ptr = root221.get(); | 172 TestLayerImpl* root221_ptr = root221.get(); |
173 TestLayerImpl* root231_ptr = root231.get(); | 173 TestLayerImpl* root231_ptr = root231.get(); |
174 | 174 |
175 root22->AddChild(root221.Pass()); | 175 root22->AddChild(std::move(root221)); |
176 root23->AddChild(root231.Pass()); | 176 root23->AddChild(std::move(root231)); |
177 root2->AddChild(root21.Pass()); | 177 root2->AddChild(std::move(root21)); |
178 root2->AddChild(root22.Pass()); | 178 root2->AddChild(std::move(root22)); |
179 root2->AddChild(root23.Pass()); | 179 root2->AddChild(std::move(root23)); |
180 root_layer->AddChild(root1.Pass()); | 180 root_layer->AddChild(std::move(root1)); |
181 root_layer->AddChild(root2.Pass()); | 181 root_layer->AddChild(std::move(root2)); |
182 root_layer->AddChild(root3.Pass()); | 182 root_layer->AddChild(std::move(root3)); |
183 | 183 |
184 root_layer->SetHasRenderSurface(true); | 184 root_layer->SetHasRenderSurface(true); |
185 host_impl_.active_tree()->SetRootLayer(root_layer.Pass()); | 185 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); |
186 | 186 |
187 LayerImplList render_surface_layer_list; | 187 LayerImplList render_surface_layer_list; |
188 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 188 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
189 root_ptr, root_ptr->bounds(), &render_surface_layer_list); | 189 root_ptr, root_ptr->bounds(), &render_surface_layer_list); |
190 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 190 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
191 | 191 |
192 IterateFrontToBack(&render_surface_layer_list); | 192 IterateFrontToBack(&render_surface_layer_list); |
193 EXPECT_COUNT(root_ptr, 9, -1, 8); | 193 EXPECT_COUNT(root_ptr, 9, -1, 8); |
194 EXPECT_COUNT(root1_ptr, -1, -1, 7); | 194 EXPECT_COUNT(root1_ptr, -1, -1, 7); |
195 EXPECT_COUNT(root2_ptr, -1, -1, 6); | 195 EXPECT_COUNT(root2_ptr, -1, -1, 6); |
(...skipping 20 matching lines...) Expand all Loading... |
216 TestLayerImpl* root1_ptr = root1.get(); | 216 TestLayerImpl* root1_ptr = root1.get(); |
217 TestLayerImpl* root2_ptr = root2.get(); | 217 TestLayerImpl* root2_ptr = root2.get(); |
218 TestLayerImpl* root3_ptr = root3.get(); | 218 TestLayerImpl* root3_ptr = root3.get(); |
219 TestLayerImpl* root21_ptr = root21.get(); | 219 TestLayerImpl* root21_ptr = root21.get(); |
220 TestLayerImpl* root22_ptr = root22.get(); | 220 TestLayerImpl* root22_ptr = root22.get(); |
221 TestLayerImpl* root23_ptr = root23.get(); | 221 TestLayerImpl* root23_ptr = root23.get(); |
222 TestLayerImpl* root221_ptr = root221.get(); | 222 TestLayerImpl* root221_ptr = root221.get(); |
223 TestLayerImpl* root231_ptr = root231.get(); | 223 TestLayerImpl* root231_ptr = root231.get(); |
224 | 224 |
225 root22->SetHasRenderSurface(true); | 225 root22->SetHasRenderSurface(true); |
226 root22->AddChild(root221.Pass()); | 226 root22->AddChild(std::move(root221)); |
227 root23->SetHasRenderSurface(true); | 227 root23->SetHasRenderSurface(true); |
228 root23->AddChild(root231.Pass()); | 228 root23->AddChild(std::move(root231)); |
229 root2->SetDrawsContent(false); | 229 root2->SetDrawsContent(false); |
230 root2->SetHasRenderSurface(true); | 230 root2->SetHasRenderSurface(true); |
231 root2->AddChild(root21.Pass()); | 231 root2->AddChild(std::move(root21)); |
232 root2->AddChild(root22.Pass()); | 232 root2->AddChild(std::move(root22)); |
233 root2->AddChild(root23.Pass()); | 233 root2->AddChild(std::move(root23)); |
234 root_layer->AddChild(root1.Pass()); | 234 root_layer->AddChild(std::move(root1)); |
235 root_layer->AddChild(root2.Pass()); | 235 root_layer->AddChild(std::move(root2)); |
236 root_layer->AddChild(root3.Pass()); | 236 root_layer->AddChild(std::move(root3)); |
237 | 237 |
238 root_layer->SetHasRenderSurface(true); | 238 root_layer->SetHasRenderSurface(true); |
239 host_impl_.active_tree()->SetRootLayer(root_layer.Pass()); | 239 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); |
240 | 240 |
241 LayerImplList render_surface_layer_list; | 241 LayerImplList render_surface_layer_list; |
242 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 242 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
243 root_ptr, root_ptr->bounds(), &render_surface_layer_list); | 243 root_ptr, root_ptr->bounds(), &render_surface_layer_list); |
244 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 244 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
245 | 245 |
246 IterateFrontToBack(&render_surface_layer_list); | 246 IterateFrontToBack(&render_surface_layer_list); |
247 EXPECT_COUNT(root_ptr, 14, -1, 13); | 247 EXPECT_COUNT(root_ptr, 14, -1, 13); |
248 EXPECT_COUNT(root1_ptr, -1, -1, 12); | 248 EXPECT_COUNT(root1_ptr, -1, -1, 12); |
249 EXPECT_COUNT(root2_ptr, 10, 11, -1); | 249 EXPECT_COUNT(root2_ptr, 10, 11, -1); |
250 EXPECT_COUNT(root21_ptr, -1, -1, 9); | 250 EXPECT_COUNT(root21_ptr, -1, -1, 9); |
251 EXPECT_COUNT(root22_ptr, 7, 8, 6); | 251 EXPECT_COUNT(root22_ptr, 7, 8, 6); |
252 EXPECT_COUNT(root221_ptr, -1, -1, 5); | 252 EXPECT_COUNT(root221_ptr, -1, -1, 5); |
253 EXPECT_COUNT(root23_ptr, 3, 4, 2); | 253 EXPECT_COUNT(root23_ptr, 3, 4, 2); |
254 EXPECT_COUNT(root231_ptr, -1, -1, 1); | 254 EXPECT_COUNT(root231_ptr, -1, -1, 1); |
255 EXPECT_COUNT(root3_ptr, -1, -1, 0); | 255 EXPECT_COUNT(root3_ptr, -1, -1, 0); |
256 } | 256 } |
257 | 257 |
258 } // namespace | 258 } // namespace |
259 } // namespace cc | 259 } // namespace cc |
OLD | NEW |