| 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 #ifndef CC_LAYERS_LAYER_LIST_ITERATOR_H_ | 5 #ifndef CC_LAYERS_LAYER_LIST_ITERATOR_H_ |
| 6 #define CC_LAYERS_LAYER_LIST_ITERATOR_H_ | 6 #define CC_LAYERS_LAYER_LIST_ITERATOR_H_ |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "cc/cc_export.h" | 11 #include "cc/cc_export.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 class LayerImpl; | 15 // This visits a tree of layers in drawing order. For LayerImpls, this is only |
| 16 | 16 // useful for tests, since there's no LayerImpl tree outside unit tests. |
| 17 // Unlike LayerIterator and friends, these iterators are not intended to permit | |
| 18 // traversing the RSLL. Rather, they visit a collection of LayerImpls in | |
| 19 // stacking order. All recursive walks over the LayerImpl tree should be | |
| 20 // switched to use these classes instead as the concept of a LayerImpl tree is | |
| 21 // deprecated. | |
| 22 template <typename LayerType> | 17 template <typename LayerType> |
| 23 class CC_EXPORT LayerListIterator { | 18 class CC_EXPORT LayerListIterator { |
| 24 public: | 19 public: |
| 25 explicit LayerListIterator(LayerType* root_layer); | 20 explicit LayerListIterator(LayerType* root_layer); |
| 26 LayerListIterator(const LayerListIterator<LayerType>& other); | 21 LayerListIterator(const LayerListIterator<LayerType>& other); |
| 27 virtual ~LayerListIterator(); | 22 virtual ~LayerListIterator(); |
| 28 | 23 |
| 29 bool operator==(const LayerListIterator<LayerType>& other) const { | 24 bool operator==(const LayerListIterator<LayerType>& other) const { |
| 30 return current_layer_ == other.current_layer_; | 25 return current_layer_ == other.current_layer_; |
| 31 } | 26 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 58 | 53 |
| 59 private: | 54 private: |
| 60 void DescendToRightmostInSubtree(); | 55 void DescendToRightmostInSubtree(); |
| 61 LayerType* current_layer() { return this->current_layer_; } | 56 LayerType* current_layer() { return this->current_layer_; } |
| 62 std::vector<size_t>& list_indices() { return this->list_indices_; } | 57 std::vector<size_t>& list_indices() { return this->list_indices_; } |
| 63 }; | 58 }; |
| 64 | 59 |
| 65 } // namespace cc | 60 } // namespace cc |
| 66 | 61 |
| 67 #endif // CC_LAYERS_LAYER_LIST_ITERATOR_H_ | 62 #endif // CC_LAYERS_LAYER_LIST_ITERATOR_H_ |
| OLD | NEW |