Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4868)

Unified Diff: cc/layers/layer_list_iterator.h

Issue 1887703002: cc: Add a main thread LayerListIterator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: For testing only Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/layers/layer_list_iterator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | cc/layers/layer_list_iterator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698