| 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 "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 root_layer->AddChild(std::move(first)); | 134 root_layer->AddChild(std::move(first)); |
| 135 root_layer->AddChild(std::move(second)); | 135 root_layer->AddChild(std::move(second)); |
| 136 root_layer->AddChild(std::move(third)); | 136 root_layer->AddChild(std::move(third)); |
| 137 root_layer->AddChild(std::move(fourth)); | 137 root_layer->AddChild(std::move(fourth)); |
| 138 | 138 |
| 139 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); | 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::CalculateDrawPropertiesForTesting(&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); |
| 150 EXPECT_COUNT(third_ptr, -1, -1, 1); | 150 EXPECT_COUNT(third_ptr, -1, -1, 1); |
| 151 EXPECT_COUNT(fourth_ptr, -1, -1, 0); | 151 EXPECT_COUNT(fourth_ptr, -1, -1, 0); |
| 152 } | 152 } |
| 153 | 153 |
| 154 TEST_F(LayerIteratorTest, ComplexTree) { | 154 TEST_F(LayerIteratorTest, ComplexTree) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 179 root2->AddChild(std::move(root23)); | 179 root2->AddChild(std::move(root23)); |
| 180 root_layer->AddChild(std::move(root1)); | 180 root_layer->AddChild(std::move(root1)); |
| 181 root_layer->AddChild(std::move(root2)); | 181 root_layer->AddChild(std::move(root2)); |
| 182 root_layer->AddChild(std::move(root3)); | 182 root_layer->AddChild(std::move(root3)); |
| 183 | 183 |
| 184 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); | 184 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); |
| 185 | 185 |
| 186 LayerImplList render_surface_layer_list; | 186 LayerImplList render_surface_layer_list; |
| 187 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 187 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 188 root_ptr, root_ptr->bounds(), &render_surface_layer_list); | 188 root_ptr, root_ptr->bounds(), &render_surface_layer_list); |
| 189 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 189 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
| 190 | 190 |
| 191 IterateFrontToBack(&render_surface_layer_list); | 191 IterateFrontToBack(&render_surface_layer_list); |
| 192 EXPECT_COUNT(root_ptr, 9, -1, 8); | 192 EXPECT_COUNT(root_ptr, 9, -1, 8); |
| 193 EXPECT_COUNT(root1_ptr, -1, -1, 7); | 193 EXPECT_COUNT(root1_ptr, -1, -1, 7); |
| 194 EXPECT_COUNT(root2_ptr, -1, -1, 6); | 194 EXPECT_COUNT(root2_ptr, -1, -1, 6); |
| 195 EXPECT_COUNT(root21_ptr, -1, -1, 5); | 195 EXPECT_COUNT(root21_ptr, -1, -1, 5); |
| 196 EXPECT_COUNT(root22_ptr, -1, -1, 4); | 196 EXPECT_COUNT(root22_ptr, -1, -1, 4); |
| 197 EXPECT_COUNT(root221_ptr, -1, -1, 3); | 197 EXPECT_COUNT(root221_ptr, -1, -1, 3); |
| 198 EXPECT_COUNT(root23_ptr, -1, -1, 2); | 198 EXPECT_COUNT(root23_ptr, -1, -1, 2); |
| 199 EXPECT_COUNT(root231_ptr, -1, -1, 1); | 199 EXPECT_COUNT(root231_ptr, -1, -1, 1); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 root2->AddChild(std::move(root23)); | 232 root2->AddChild(std::move(root23)); |
| 233 root_layer->AddChild(std::move(root1)); | 233 root_layer->AddChild(std::move(root1)); |
| 234 root_layer->AddChild(std::move(root2)); | 234 root_layer->AddChild(std::move(root2)); |
| 235 root_layer->AddChild(std::move(root3)); | 235 root_layer->AddChild(std::move(root3)); |
| 236 | 236 |
| 237 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); | 237 host_impl_.active_tree()->SetRootLayer(std::move(root_layer)); |
| 238 | 238 |
| 239 LayerImplList render_surface_layer_list; | 239 LayerImplList render_surface_layer_list; |
| 240 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 240 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 241 root_ptr, root_ptr->bounds(), &render_surface_layer_list); | 241 root_ptr, root_ptr->bounds(), &render_surface_layer_list); |
| 242 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 242 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
| 243 | 243 |
| 244 IterateFrontToBack(&render_surface_layer_list); | 244 IterateFrontToBack(&render_surface_layer_list); |
| 245 EXPECT_COUNT(root_ptr, 14, -1, 13); | 245 EXPECT_COUNT(root_ptr, 14, -1, 13); |
| 246 EXPECT_COUNT(root1_ptr, -1, -1, 12); | 246 EXPECT_COUNT(root1_ptr, -1, -1, 12); |
| 247 EXPECT_COUNT(root2_ptr, 10, 11, -1); | 247 EXPECT_COUNT(root2_ptr, 10, 11, -1); |
| 248 EXPECT_COUNT(root21_ptr, -1, -1, 9); | 248 EXPECT_COUNT(root21_ptr, -1, -1, 9); |
| 249 EXPECT_COUNT(root22_ptr, 7, 8, 6); | 249 EXPECT_COUNT(root22_ptr, 7, 8, 6); |
| 250 EXPECT_COUNT(root221_ptr, -1, -1, 5); | 250 EXPECT_COUNT(root221_ptr, -1, -1, 5); |
| 251 EXPECT_COUNT(root23_ptr, 3, 4, 2); | 251 EXPECT_COUNT(root23_ptr, 3, 4, 2); |
| 252 EXPECT_COUNT(root231_ptr, -1, -1, 1); | 252 EXPECT_COUNT(root231_ptr, -1, -1, 1); |
| 253 EXPECT_COUNT(root3_ptr, -1, -1, 0); | 253 EXPECT_COUNT(root3_ptr, -1, -1, 0); |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace | 256 } // namespace |
| 257 } // namespace cc | 257 } // namespace cc |
| OLD | NEW |