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

Unified Diff: cc/layers/layer_list_iterator.cc

Issue 2053983003: cc : Move LayerImpl::parent to test properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 6 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 | « cc/layers/layer_impl_test_properties.cc ('k') | cc/trees/damage_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_list_iterator.cc
diff --git a/cc/layers/layer_list_iterator.cc b/cc/layers/layer_list_iterator.cc
index e2e0310d3212e295a9337008e08dbefdb3afbd85..1713be6f57406bdd0c27cf7490ce33711b831d88 100644
--- a/cc/layers/layer_list_iterator.cc
+++ b/cc/layers/layer_list_iterator.cc
@@ -9,10 +9,17 @@
namespace cc {
+static Layer* Parent(Layer* layer) {
+ return layer->parent();
+}
+
+static LayerImpl* Parent(LayerImpl* layer) {
+ return layer->test_properties()->parent;
+}
template <typename LayerType>
LayerListIterator<LayerType>::LayerListIterator(LayerType* root_layer)
: current_layer_(root_layer) {
- DCHECK(!root_layer || !root_layer->parent());
+ DCHECK(!root_layer || !Parent(root_layer));
list_indices_.push_back(0);
}
@@ -52,8 +59,8 @@ LayerListIterator<LayerType>& LayerListIterator<LayerType>::operator++() {
return *this;
}
- for (LayerType* parent = current_layer_->parent(); parent;
- parent = parent->parent()) {
+ for (LayerType* parent = Parent(current_layer_); parent;
+ parent = Parent(parent)) {
// We now try and advance in some list of siblings.
// case 2: Advance to a sibling.
if (list_indices_.back() + 1 < Children(parent).size()) {
@@ -91,16 +98,16 @@ operator++() {
// case 1: we're the leftmost sibling.
if (!list_indices().back()) {
list_indices().pop_back();
- this->current_layer_ = current_layer()->parent();
+ this->current_layer_ = Parent(current_layer());
return *this;
}
// case 2: we're not the leftmost sibling. In this case, we want to move one
// sibling over, and then descend to the rightmost descendant in that subtree.
- CHECK(current_layer()->parent());
+ CHECK(Parent(current_layer()));
--list_indices().back();
this->current_layer_ =
- ChildAt(current_layer()->parent(), list_indices().back());
+ ChildAt(Parent(current_layer()), list_indices().back());
DescendToRightmostInSubtree();
return *this;
}
« no previous file with comments | « cc/layers/layer_impl_test_properties.cc ('k') | cc/trees/damage_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698