OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_list_iterator.h" | 5 #include "cc/layers/layer_list_iterator.h" |
6 | 6 |
7 #include "cc/layers/layer_impl.h" | 7 #include "cc/layers/layer_impl.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
11 LayerListIterator::LayerListIterator(LayerImpl* root_layer) | 11 LayerListIterator::LayerListIterator(LayerImpl* root_layer) |
12 : current_layer_(root_layer) { | 12 : current_layer_(root_layer) { |
13 DCHECK(!root_layer || !root_layer->parent()); | 13 DCHECK(!root_layer || !root_layer->parent()); |
14 list_indices_.push_back(0); | 14 list_indices_.push_back(0); |
15 } | 15 } |
16 | 16 |
| 17 LayerListIterator::LayerListIterator(const LayerListIterator& other) = default; |
| 18 |
17 LayerListIterator::~LayerListIterator() {} | 19 LayerListIterator::~LayerListIterator() {} |
18 | 20 |
19 LayerListIterator& LayerListIterator::operator++() { | 21 LayerListIterator& LayerListIterator::operator++() { |
20 // case 0: done | 22 // case 0: done |
21 if (!current_layer_) | 23 if (!current_layer_) |
22 return *this; | 24 return *this; |
23 | 25 |
24 // case 1: descend. | 26 // case 1: descend. |
25 const LayerImplList& current_list = current_layer_->children(); | 27 const LayerImplList& current_list = current_layer_->children(); |
26 if (!current_list.empty()) { | 28 if (!current_list.empty()) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 if (current_list.empty()) | 89 if (current_list.empty()) |
88 return; | 90 return; |
89 | 91 |
90 size_t last_index = current_list.size() - 1; | 92 size_t last_index = current_list.size() - 1; |
91 current_layer_ = current_list[last_index]; | 93 current_layer_ = current_list[last_index]; |
92 list_indices_.push_back(last_index); | 94 list_indices_.push_back(last_index); |
93 DescendToRightmostInSubtree(); | 95 DescendToRightmostInSubtree(); |
94 } | 96 } |
95 | 97 |
96 } // namespace cc | 98 } // namespace cc |
OLD | NEW |