| Index: cc/layers/layer_list_iterator.h
|
| diff --git a/cc/layers/layer_list_iterator.h b/cc/layers/layer_list_iterator.h
|
| index bdc4a4a438ac88edca68d7ef08f7cd87fcc57fa8..948ec25ea6412cfee9cf3ce0b06d01d13c4cff70 100644
|
| --- a/cc/layers/layer_list_iterator.h
|
| +++ b/cc/layers/layer_list_iterator.h
|
| @@ -12,6 +12,7 @@
|
|
|
| namespace cc {
|
|
|
| +class Layer;
|
| class LayerImpl;
|
|
|
| // Unlike LayerIterator and friends, these iterators are not intended to permit
|
| @@ -19,43 +20,47 @@ class LayerImpl;
|
| // stacking order. All recursive walks over the LayerImpl tree should be
|
| // switched to use these classes instead as the concept of a LayerImpl tree is
|
| // deprecated.
|
| +template <typename LayerType>
|
| class CC_EXPORT LayerListIterator {
|
| public:
|
| - explicit LayerListIterator(LayerImpl* root_layer);
|
| - LayerListIterator(const LayerListIterator& other);
|
| + explicit LayerListIterator(LayerType* root_layer);
|
| + LayerListIterator(const LayerListIterator<LayerType>& other);
|
| virtual ~LayerListIterator();
|
|
|
| - bool operator==(const LayerListIterator& other) const {
|
| + bool operator==(const LayerListIterator<LayerType>& other) const {
|
| return current_layer_ == other.current_layer_;
|
| }
|
|
|
| - bool operator!=(const LayerListIterator& other) const {
|
| + bool operator!=(const LayerListIterator<LayerType>& other) const {
|
| return !(*this == other);
|
| }
|
|
|
| // We will only support prefix increment.
|
| virtual LayerListIterator& operator++();
|
| - LayerImpl* operator->() const { return current_layer_; }
|
| - LayerImpl* operator*() const { return current_layer_; }
|
| + LayerType* operator->() const { return current_layer_; }
|
| + LayerType* operator*() const { return current_layer_; }
|
|
|
| protected:
|
| // The implementation of this iterator is currently tied tightly to the layer
|
| // tree, but it should be straightforward to reimplement in terms of a list
|
| // when it's ready.
|
| - LayerImpl* current_layer_;
|
| + LayerType* current_layer_;
|
| std::vector<size_t> list_indices_;
|
| };
|
|
|
| -class CC_EXPORT LayerListReverseIterator : public LayerListIterator {
|
| +template <typename LayerType>
|
| +class CC_EXPORT LayerListReverseIterator : public LayerListIterator<LayerType> {
|
| public:
|
| - explicit LayerListReverseIterator(LayerImpl* root_layer);
|
| + explicit LayerListReverseIterator(LayerType* root_layer);
|
| ~LayerListReverseIterator() override;
|
|
|
| // We will only support prefix increment.
|
| - LayerListIterator& operator++() override;
|
| + LayerListIterator<LayerType>& operator++() override;
|
|
|
| private:
|
| void DescendToRightmostInSubtree();
|
| + LayerType* current_layer() { return this->current_layer_; }
|
| + std::vector<size_t>& list_indices() { return this->list_indices_; }
|
| };
|
|
|
| } // namespace cc
|
|
|