summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authoralexst@chromium.org <alexst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-20 21:30:09 +0000
committeralexst@chromium.org <alexst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-20 21:30:09 +0000
commit71dfcc7a69bffa9ad2fbc853406bd6117e93895f (patch)
tree3e0db4eef413d33cac5b00619054275c0656f44b /cc
parentb1c602bfa89f06d411fbd13961451c913b31d9f4 (diff)
downloadchromium_src-71dfcc7a69bffa9ad2fbc853406bd6117e93895f.zip
chromium_src-71dfcc7a69bffa9ad2fbc853406bd6117e93895f.tar.gz
chromium_src-71dfcc7a69bffa9ad2fbc853406bd6117e93895f.tar.bz2
Chromify layer_iterator.
BUG= Review URL: https://chromiumcodereview.appspot.com/12737008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189414 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/layers/layer_iterator.cc296
-rw-r--r--cc/layers/layer_iterator.h430
-rw-r--r--cc/layers/layer_iterator_unittest.cc449
-rw-r--r--cc/trees/layer_tree_host.cc16
-rw-r--r--cc/trees/layer_tree_host_common.cc44
-rw-r--r--cc/trees/layer_tree_host_impl.cc10
-rw-r--r--cc/trees/layer_tree_impl.cc12
-rw-r--r--cc/trees/occlusion_tracker.cc14
-rw-r--r--cc/trees/occlusion_tracker_unittest.cc14
-rw-r--r--cc/trees/quad_culler_unittest.cc36
10 files changed, 761 insertions, 560 deletions
diff --git a/cc/layers/layer_iterator.cc b/cc/layers/layer_iterator.cc
index 58a9175..02634bd 100644
--- a/cc/layers/layer_iterator.cc
+++ b/cc/layers/layer_iterator.cc
@@ -11,137 +11,209 @@
namespace cc {
-template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
-void LayerIteratorActions::BackToFront::begin(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it)
-{
- it.m_targetRenderSurfaceLayerIndex = 0;
- it.m_currentLayerIndex = LayerIteratorValue::LayerIndexRepresentingTargetRenderSurface;
-
- m_highestTargetRenderSurfaceLayer = 0;
+template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename ActionType>
+void LayerIteratorActions::BackToFront::Begin(
+ LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>* it) {
+ it->target_render_surface_layer_index_ = 0;
+ it->current_layer_index_ =
+ LayerIteratorValue::kLayerIndexRepresentingTargetRenderSurface;
+
+ highest_target_render_surface_layer_ = 0;
}
-template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
-void LayerIteratorActions::BackToFront::end(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it)
-{
- it.m_targetRenderSurfaceLayerIndex = LayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex;
- it.m_currentLayerIndex = 0;
+template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename ActionType>
+void LayerIteratorActions::BackToFront::End(
+ LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>* it) {
+ it->target_render_surface_layer_index_ =
+ LayerIteratorValue::kInvalidTargetRenderSurfaceLayerIndex;
+ it->current_layer_index_ = 0;
}
-template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
-void LayerIteratorActions::BackToFront::next(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it)
-{
- // If the current layer has a RS, move to its layer list. Otherwise, visit the next layer in the current RS layer list.
- if (it.currentLayerRepresentsContributingRenderSurface()) {
- // Save our position in the childLayer list for the RenderSurfaceImpl, then jump to the next RenderSurfaceImpl. Save where we
- // came from in the next RenderSurfaceImpl so we can get back to it.
- it.targetRenderSurface()->current_layer_index_history_ = it.m_currentLayerIndex;
- int previousTargetRenderSurfaceLayer = it.m_targetRenderSurfaceLayerIndex;
-
- it.m_targetRenderSurfaceLayerIndex = ++m_highestTargetRenderSurfaceLayer;
- it.m_currentLayerIndex = LayerIteratorValue::LayerIndexRepresentingTargetRenderSurface;
-
- it.targetRenderSurface()->target_render_surface_layer_index_history_ = previousTargetRenderSurfaceLayer;
- } else {
- ++it.m_currentLayerIndex;
-
- int targetRenderSurfaceNumChildren = it.targetRenderSurfaceChildren().size();
- while (it.m_currentLayerIndex == targetRenderSurfaceNumChildren) {
- // Jump back to the previous RenderSurfaceImpl, and get back the position where we were in that list, and move to the next position there.
- if (!it.m_targetRenderSurfaceLayerIndex) {
- // End of the list
- it.m_targetRenderSurfaceLayerIndex = LayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex;
- it.m_currentLayerIndex = 0;
- return;
- }
- it.m_targetRenderSurfaceLayerIndex = it.targetRenderSurface()->target_render_surface_layer_index_history_;
- it.m_currentLayerIndex = it.targetRenderSurface()->current_layer_index_history_ + 1;
-
- targetRenderSurfaceNumChildren = it.targetRenderSurfaceChildren().size();
- }
+template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename ActionType>
+void LayerIteratorActions::BackToFront::Next(
+ LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>* it) {
+ // If the current layer has a RS, move to its layer list. Otherwise,
+ // visit the next layer in the current RS layer list.
+ if (it->current_layer_represents_contributing_render_surface()) {
+ // Save our position in the childLayer list for the RenderSurface,
+ // then jump to the next RenderSurface. Save where we
+ // came from in the next RenderSurface so we can get back to it.
+ it->target_render_surface()->current_layer_index_history_ =
+ it->current_layer_index_;
+ int previous_target_render_surface_layer =
+ it->target_render_surface_layer_index_;
+
+ it->target_render_surface_layer_index_ =
+ ++highest_target_render_surface_layer_;
+ it->current_layer_index_ =
+ LayerIteratorValue::kLayerIndexRepresentingTargetRenderSurface;
+
+ it->target_render_surface()->target_render_surface_layer_index_history_ =
+ previous_target_render_surface_layer;
+ } else {
+ ++it->current_layer_index_;
+
+ int target_render_surface_num_children =
+ it->target_render_surface_children().size();
+ while (it->current_layer_index_ == target_render_surface_num_children) {
+ // Jump back to the previous RenderSurface,
+ // and get back the position where we were in that list,
+ // and move to the next position there.
+ if (!it->target_render_surface_layer_index_) {
+ // End of the list
+ it->target_render_surface_layer_index_ =
+ LayerIteratorValue::kInvalidTargetRenderSurfaceLayerIndex;
+ it->current_layer_index_ = 0;
+ return;
+ }
+ it->target_render_surface_layer_index_ = it->target_render_surface()
+ ->target_render_surface_layer_index_history_;
+ it->current_layer_index_ =
+ it->target_render_surface()->current_layer_index_history_ + 1;
+
+ target_render_surface_num_children =
+ it->target_render_surface_children().size();
}
+ }
}
-template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
-void LayerIteratorActions::FrontToBack::begin(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it)
-{
- it.m_targetRenderSurfaceLayerIndex = 0;
- it.m_currentLayerIndex = it.targetRenderSurfaceChildren().size() - 1;
- goToHighestInSubtree(it);
+template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename ActionType>
+void LayerIteratorActions::FrontToBack::Begin(
+ LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>* it) {
+ it->target_render_surface_layer_index_ = 0;
+ it->current_layer_index_ = it->target_render_surface_children().size() - 1;
+ GoToHighestInSubtree(it);
}
-template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
-void LayerIteratorActions::FrontToBack::end(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it)
-{
- it.m_targetRenderSurfaceLayerIndex = LayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex;
- it.m_currentLayerIndex = 0;
+template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename ActionType>
+void LayerIteratorActions::FrontToBack::End(
+ LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>* it) {
+ it->target_render_surface_layer_index_ =
+ LayerIteratorValue::kInvalidTargetRenderSurfaceLayerIndex;
+ it->current_layer_index_ = 0;
}
-template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
-void LayerIteratorActions::FrontToBack::next(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it)
-{
- // Moves to the previous layer in the current RS layer list. Then we check if the
- // new current layer has its own RS, in which case there are things in that RS layer list that are higher, so
- // we find the highest layer in that subtree.
- // If we move back past the front of the list, we jump up to the previous RS layer list, picking up again where we
- // had previously recursed into the current RS layer list.
-
- if (!it.currentLayerRepresentsTargetRenderSurface()) {
- // Subtracting one here will eventually cause the current layer to become that layer
- // representing the target render surface.
- --it.m_currentLayerIndex;
- goToHighestInSubtree(it);
- } else {
- while (it.currentLayerRepresentsTargetRenderSurface()) {
- if (!it.m_targetRenderSurfaceLayerIndex) {
- // End of the list
- it.m_targetRenderSurfaceLayerIndex = LayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex;
- it.m_currentLayerIndex = 0;
- return;
- }
- it.m_targetRenderSurfaceLayerIndex = it.targetRenderSurface()->target_render_surface_layer_index_history_;
- it.m_currentLayerIndex = it.targetRenderSurface()->current_layer_index_history_;
- }
+template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename ActionType>
+void LayerIteratorActions::FrontToBack::Next(
+ LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>* it) {
+ // Moves to the previous layer in the current RS layer list.
+ // Then we check if the new current layer has its own RS,
+ // in which case there are things in that RS layer list that are higher,
+ // so we find the highest layer in that subtree.
+ // If we move back past the front of the list,
+ // we jump up to the previous RS layer list, picking up again where we
+ // had previously recursed into the current RS layer list.
+
+ if (!it->current_layer_represents_target_render_surface()) {
+ // Subtracting one here will eventually cause the current layer
+ // to become that layer representing the target render surface.
+ --it->current_layer_index_;
+ GoToHighestInSubtree(it);
+ } else {
+ while (it->current_layer_represents_target_render_surface()) {
+ if (!it->target_render_surface_layer_index_) {
+ // End of the list
+ it->target_render_surface_layer_index_ =
+ LayerIteratorValue::kInvalidTargetRenderSurfaceLayerIndex;
+ it->current_layer_index_ = 0;
+ return;
+ }
+ it->target_render_surface_layer_index_ = it->target_render_surface()
+ ->target_render_surface_layer_index_history_;
+ it->current_layer_index_ =
+ it->target_render_surface()->current_layer_index_history_;
}
+ }
}
-template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
-void LayerIteratorActions::FrontToBack::goToHighestInSubtree(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>& it)
-{
- if (it.currentLayerRepresentsTargetRenderSurface())
- return;
- while (it.currentLayerRepresentsContributingRenderSurface()) {
- // Save where we were in the current target surface, move to the next one, and save the target surface that we
- // came from there so we can go back to it.
- it.targetRenderSurface()->current_layer_index_history_ = it.m_currentLayerIndex;
- int previousTargetRenderSurfaceLayer = it.m_targetRenderSurfaceLayerIndex;
-
- for (LayerType* layer = it.currentLayer(); it.targetRenderSurfaceLayer() != layer; ++it.m_targetRenderSurfaceLayerIndex) { }
- it.m_currentLayerIndex = it.targetRenderSurfaceChildren().size() - 1;
-
- it.targetRenderSurface()->target_render_surface_layer_index_history_ = previousTargetRenderSurfaceLayer;
+template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename ActionType>
+void LayerIteratorActions::FrontToBack::GoToHighestInSubtree(
+ LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>* it) {
+ if (it->current_layer_represents_target_render_surface())
+ return;
+ while (it->current_layer_represents_contributing_render_surface()) {
+ // Save where we were in the current target surface, move to the next one,
+ // and save the target surface that we came from there
+ // so we can go back to it.
+ it->target_render_surface()->current_layer_index_history_ =
+ it->current_layer_index_;
+ int previous_target_render_surface_layer =
+ it->target_render_surface_layer_index_;
+
+ for (LayerType* layer = it->current_layer();
+ it->target_render_surface_layer() != layer;
+ ++it->target_render_surface_layer_index_) {
}
+ it->current_layer_index_ = it->target_render_surface_children().size() - 1;
+
+ it->target_render_surface()->target_render_surface_layer_index_history_ =
+ previous_target_render_surface_layer;
+ }
}
typedef std::vector<scoped_refptr<Layer> > LayerList;
typedef std::vector<LayerImpl*> LayerImplList;
-// Declare each of the above functions for Layer and LayerImpl classes so that they are linked.
-template CC_EXPORT void LayerIteratorActions::BackToFront::begin(LayerIterator<Layer, LayerList, RenderSurface, BackToFront> &);
-template CC_EXPORT void LayerIteratorActions::BackToFront::end(LayerIterator<Layer, LayerList, RenderSurface, BackToFront>&);
-template CC_EXPORT void LayerIteratorActions::BackToFront::next(LayerIterator<Layer, LayerList, RenderSurface, BackToFront>&);
-
-template CC_EXPORT void LayerIteratorActions::BackToFront::begin(LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, BackToFront>&);
-template CC_EXPORT void LayerIteratorActions::BackToFront::end(LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, BackToFront>&);
-template CC_EXPORT void LayerIteratorActions::BackToFront::next(LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, BackToFront>&);
-
-template CC_EXPORT void LayerIteratorActions::FrontToBack::next(LayerIterator<Layer, LayerList, RenderSurface, FrontToBack>&);
-template CC_EXPORT void LayerIteratorActions::FrontToBack::end(LayerIterator<Layer, LayerList, RenderSurface, FrontToBack>&);
-template CC_EXPORT void LayerIteratorActions::FrontToBack::begin(LayerIterator<Layer, LayerList, RenderSurface, FrontToBack>&);
-template CC_EXPORT void LayerIteratorActions::FrontToBack::goToHighestInSubtree(LayerIterator<Layer, LayerList, RenderSurface, FrontToBack>&);
-
-template CC_EXPORT void LayerIteratorActions::FrontToBack::next(LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, FrontToBack>&);
-template CC_EXPORT void LayerIteratorActions::FrontToBack::end(LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, FrontToBack>&);
-template CC_EXPORT void LayerIteratorActions::FrontToBack::begin(LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, FrontToBack>&);
-template CC_EXPORT void LayerIteratorActions::FrontToBack::goToHighestInSubtree(LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, FrontToBack>&);
+// Declare each of the above functions for Layer and LayerImpl classes
+// so that they are linked.
+template CC_EXPORT void LayerIteratorActions::BackToFront::Begin(
+ LayerIterator<Layer, LayerList, RenderSurface, BackToFront>* it);
+template CC_EXPORT void LayerIteratorActions::BackToFront::End(
+ LayerIterator<Layer, LayerList, RenderSurface, BackToFront>* it);
+template CC_EXPORT void LayerIteratorActions::BackToFront::Next(
+ LayerIterator<Layer, LayerList, RenderSurface, BackToFront>* it);
+
+template CC_EXPORT void LayerIteratorActions::BackToFront::Begin(
+ LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, BackToFront>*
+ it);
+template CC_EXPORT void LayerIteratorActions::BackToFront::End(
+ LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, BackToFront>*
+ it);
+template CC_EXPORT void LayerIteratorActions::BackToFront::Next(
+ LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, BackToFront>*
+ it);
+
+template CC_EXPORT void LayerIteratorActions::FrontToBack::Next(
+ LayerIterator<Layer, LayerList, RenderSurface, FrontToBack>* it);
+template CC_EXPORT void LayerIteratorActions::FrontToBack::End(
+ LayerIterator<Layer, LayerList, RenderSurface, FrontToBack>* it);
+template CC_EXPORT void LayerIteratorActions::FrontToBack::Begin(
+ LayerIterator<Layer, LayerList, RenderSurface, FrontToBack>* it);
+template CC_EXPORT void LayerIteratorActions::FrontToBack::GoToHighestInSubtree(
+ LayerIterator<Layer, LayerList, RenderSurface, FrontToBack>* it);
+
+template CC_EXPORT void LayerIteratorActions::FrontToBack::Next(
+ LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, FrontToBack>*
+ it);
+template CC_EXPORT void LayerIteratorActions::FrontToBack::End(
+ LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, FrontToBack>*
+ it);
+template CC_EXPORT void LayerIteratorActions::FrontToBack::Begin(
+ LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, FrontToBack>*
+ it);
+template CC_EXPORT void LayerIteratorActions::FrontToBack::GoToHighestInSubtree(
+ LayerIterator<LayerImpl, LayerImplList, RenderSurfaceImpl, FrontToBack>*
+ it);
} // namespace cc
diff --git a/cc/layers/layer_iterator.h b/cc/layers/layer_iterator.h
index 55b1d79..e13204b 100644
--- a/cc/layers/layer_iterator.h
+++ b/cc/layers/layer_iterator.h
@@ -11,198 +11,300 @@
namespace cc {
-// These classes provide means to iterate over the RenderSurfaceImpl-Layer tree.
+// These classes provide means to iterate over the
+// RenderSurface-Layer tree.
-// Example code follows, for a tree of Layer/RenderSurface objects. See below for details.
+// Example code follows, for a tree of Layer/RenderSurface objects.
+// See below for details.
//
-// void doStuffOnLayers(const std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList)
-// {
-// typedef LayerIterator<Layer, RenderSurface, LayerIteratorActions::FrontToBack> LayerIteratorType;
+// void DoStuffOnLayers(
+// const std::vector<scoped_refptr<Layer> >& render_surface_layer_list) {
+// typedef LayerIterator<Layer,
+// RenderSurface,
+// LayerIteratorActions::FrontToBack>
+// LayerIteratorType;
//
-// LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList);
-// for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) {
-// // Only one of these will be true
-// if (it.representsTargetRenderSurface())
-// foo(*it); // *it is a layer representing a target RenderSurfaceImpl
-// if (it.representsContributingRenderSurface())
-// bar(*it); // *it is a layer representing a RenderSurfaceImpl that contributes to the layer's target RenderSurfaceImpl
-// if (it.representsItself())
-// baz(*it); // *it is a layer representing itself, as it contributes to its own target RenderSurfaceImpl
-// }
+// LayerIteratorType end =
+// LayerIteratorType::End(&render_surface_layer_list);
+// for (LayerIteratorType
+// it = LayerIteratorType::Begin(&render_surface_layer_list);
+// it != end;
+// ++it) {
+// // Only one of these will be true
+// if (it.represents_target_render_surface())
+// foo(*it); // *it is a layer representing a target RenderSurface
+// if (it.represents_contributing_render_surface())
+// bar(*it); // *it is a layer representing a RenderSurface that
+// // contributes to the layer's target RenderSurface
+// if (it.represents_itself())
+// baz(*it); // *it is a layer representing itself,
+// // as it contributes to its own target RenderSurface
+// }
// }
-// A RenderSurfaceImpl R may be referred to in one of two different contexts. One RenderSurfaceImpl is "current" at any time, for
-// whatever operation is being performed. This current surface is referred to as a target surface. For example, when R is
-// being painted it would be the target surface. Once R has been painted, its contents may be included into another
-// surface S. While S is considered the target surface when it is being painted, R is called a contributing surface
-// in this context as it contributes to the content of the target surface S.
+// A RenderSurface R may be referred to in one of two different contexts.
+// One RenderSurface is "current" at any time, for whatever operation
+// is being performed. This current surface is referred to as a target surface.
+// For example, when R is being painted it would be the target surface.
+// Once R has been painted, its contents may be included into another
+// surface S. While S is considered the target surface when it is being
+// painted, R is called a contributing surface in this context as it
+// contributes to the content of the target surface S.
//
-// The iterator's current position in the tree always points to some layer. The state of the iterator indicates the role of the
-// layer, and will be one of the following three states. A single layer L will appear in the iteration process in at least one,
+// The iterator's current position in the tree always points to some layer.
+// The state of the iterator indicates the role of the layer,
+// and will be one of the following three states.
+// A single layer L will appear in the iteration process in at least one,
// and possibly all, of these states.
-// 1. Representing the target surface: The iterator in this state, pointing at layer L, indicates that the target RenderSurfaceImpl
-// is now the surface owned by L. This will occur exactly once for each RenderSurfaceImpl in the tree.
-// 2. Representing a contributing surface: The iterator in this state, pointing at layer L, refers to the RenderSurfaceImpl owned
-// by L as a contributing surface, without changing the current target RenderSurfaceImpl.
-// 3. Representing itself: The iterator in this state, pointing at layer L, refers to the layer itself, as a child of the
-// current target RenderSurfaceImpl.
+// 1. Representing the target surface: The iterator in this state,
+// pointing at layer L, indicates that the target RenderSurface
+// is now the surface owned by L. This will occur exactly once for each
+// RenderSurface in the tree.
+// 2. Representing a contributing surface: The iterator in this state,
+// pointing at layer L, refers to the RenderSurface owned
+// by L as a contributing surface, without changing the current
+// target RenderSurface.
+// 3. Representing itself: The iterator in this state, pointing at layer L,
+// refers to the layer itself, as a child of the
+// current target RenderSurface.
//
-// The BackToFront iterator will return a layer representing the target surface before returning layers representing themselves
-// as children of the current target surface. Whereas the FrontToBack ordering will iterate over children layers of a surface
-// before the layer representing the surface as a target surface.
+// The BackToFront iterator will return a layer representing the target surface
+// before returning layers representing themselves as children of the current
+// target surface. Whereas the FrontToBack ordering will iterate over children
+// layers of a surface before the layer representing the surface
+// as a target surface.
//
// To use the iterators:
//
-// Create a stepping iterator and end iterator by calling LayerIterator::begin() and LayerIterator::end() and passing in the
-// list of layers owning target RenderSurfaces. Step through the tree by incrementing the stepping iterator while it is != to
-// the end iterator. At each step the iterator knows what the layer is representing, and you can query the iterator to decide
+// Create a stepping iterator and end iterator by calling
+// LayerIterator::Begin() and LayerIterator::End() and passing in the
+// list of layers owning target RenderSurfaces. Step through the tree
+// by incrementing the stepping iterator while it is != to
+// the end iterator. At each step the iterator knows what the layer
+// is representing, and you can query the iterator to decide
// what actions to perform with the layer given what it represents.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Non-templated constants
struct LayerIteratorValue {
- static const int InvalidTargetRenderSurfaceLayerIndex = -1;
- // This must be -1 since the iterator action code assumes that this value can be
- // reached by subtracting one from the position of the first layer in the current
- // target surface's child layer list, which is 0.
- static const int LayerIndexRepresentingTargetRenderSurface = -1;
+ static const int kInvalidTargetRenderSurfaceLayerIndex = -1;
+ // This must be -1 since the iterator action code assumes that this value can
+ // be reached by subtracting one from the position of the first layer in the
+ // current target surface's child layer list, which is 0.
+ static const int kLayerIndexRepresentingTargetRenderSurface = -1;
};
-// The position of a layer iterator that is independent of its many template types.
-template <typename LayerType>
-struct LayerIteratorPosition {
- bool representsTargetRenderSurface;
- bool representsContributingRenderSurface;
- bool representsItself;
- LayerType* targetRenderSurfaceLayer;
- LayerType* currentLayer;
+// The position of a layer iterator that is independent
+// of its many template types.
+template <typename LayerType> struct LayerIteratorPosition {
+ bool represents_target_render_surface;
+ bool represents_contributing_render_surface;
+ bool represents_itself;
+ LayerType* target_render_surface_layer;
+ LayerType* current_layer;
};
-// An iterator class for walking over layers in the RenderSurfaceImpl-Layer tree.
-template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename IteratorActionType>
+// An iterator class for walking over layers in the
+// RenderSurface-Layer tree.
+template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename IteratorActionType>
class LayerIterator {
- typedef LayerIterator<LayerType, LayerList, RenderSurfaceType, IteratorActionType> LayerIteratorType;
-
-public:
- LayerIterator() : m_renderSurfaceLayerList(0) { }
-
- static LayerIteratorType begin(const LayerList* renderSurfaceLayerList) { return LayerIteratorType(renderSurfaceLayerList, true); }
- static LayerIteratorType end(const LayerList* renderSurfaceLayerList) { return LayerIteratorType(renderSurfaceLayerList, false); }
-
- LayerIteratorType& operator++() { m_actions.next(*this); return *this; }
- bool operator==(const LayerIterator& other) const
- {
- return m_targetRenderSurfaceLayerIndex == other.m_targetRenderSurfaceLayerIndex
- && m_currentLayerIndex == other.m_currentLayerIndex;
- }
- bool operator!=(const LayerIteratorType& other) const { return !(*this == other); }
-
- LayerType* operator->() const { return currentLayer(); }
- LayerType* operator*() const { return currentLayer(); }
-
- bool representsTargetRenderSurface() const { return currentLayerRepresentsTargetRenderSurface(); }
- bool representsContributingRenderSurface() const { return !representsTargetRenderSurface() && currentLayerRepresentsContributingRenderSurface(); }
- bool representsItself() const { return !representsTargetRenderSurface() && !representsContributingRenderSurface(); }
-
- LayerType* targetRenderSurfaceLayer() const { return getRawPtr((*m_renderSurfaceLayerList)[m_targetRenderSurfaceLayerIndex]); }
-
- operator const LayerIteratorPosition<LayerType>() const
- {
- LayerIteratorPosition<LayerType> position;
- position.representsTargetRenderSurface = representsTargetRenderSurface();
- position.representsContributingRenderSurface = representsContributingRenderSurface();
- position.representsItself = representsItself();
- position.targetRenderSurfaceLayer = targetRenderSurfaceLayer();
- position.currentLayer = currentLayer();
- return position;
+ typedef LayerIterator<LayerType,
+ LayerList,
+ RenderSurfaceType,
+ IteratorActionType> LayerIteratorType;
+
+ public:
+ LayerIterator() : render_surface_layer_list_(NULL) {}
+
+ static LayerIteratorType Begin(const LayerList* render_surface_layer_list) {
+ return LayerIteratorType(render_surface_layer_list, true);
+ }
+ static LayerIteratorType End(const LayerList* render_surface_layer_list) {
+ return LayerIteratorType(render_surface_layer_list, false);
+ }
+
+ LayerIteratorType& operator++() {
+ actions_.Next(this);
+ return *this;
+ }
+ bool operator==(const LayerIterator& other) const {
+ return target_render_surface_layer_index_ ==
+ other.target_render_surface_layer_index_ &&
+ current_layer_index_ == other.current_layer_index_;
+ }
+ bool operator!=(const LayerIteratorType& other) const {
+ return !(*this == other);
+ }
+
+ LayerType* operator->() const { return current_layer(); }
+ LayerType* operator*() const { return current_layer(); }
+
+ bool represents_target_render_surface() const {
+ return current_layer_represents_target_render_surface();
+ }
+ bool represents_contributing_render_surface() const {
+ return !represents_target_render_surface() &&
+ current_layer_represents_contributing_render_surface();
+ }
+ bool represents_itself() const {
+ return !represents_target_render_surface() &&
+ !represents_contributing_render_surface();
+ }
+
+ LayerType* target_render_surface_layer() const {
+ return get_raw_ptr(
+ (*render_surface_layer_list_)[target_render_surface_layer_index_]);
+ }
+
+ operator const LayerIteratorPosition<LayerType>() const {
+ LayerIteratorPosition<LayerType> position;
+ position.represents_target_render_surface =
+ represents_target_render_surface();
+ position.represents_contributing_render_surface =
+ represents_contributing_render_surface();
+ position.represents_itself = represents_itself();
+ position.target_render_surface_layer = target_render_surface_layer();
+ position.current_layer = current_layer();
+ return position;
+ }
+
+ private:
+ LayerIterator(const LayerList* render_surface_layer_list, bool start)
+ : render_surface_layer_list_(render_surface_layer_list),
+ target_render_surface_layer_index_(0) {
+ for (size_t i = 0; i < render_surface_layer_list->size(); ++i) {
+ if (!(*render_surface_layer_list)[i]->render_surface()) {
+ NOTREACHED();
+ actions_.End(this);
+ return;
+ }
}
-private:
- LayerIterator(const LayerList* renderSurfaceLayerList, bool start)
- : m_renderSurfaceLayerList(renderSurfaceLayerList)
- , m_targetRenderSurfaceLayerIndex(0)
- {
- for (size_t i = 0; i < renderSurfaceLayerList->size(); ++i) {
- if (!(*renderSurfaceLayerList)[i]->render_surface()) {
- NOTREACHED();
- m_actions.end(*this);
- return;
- }
- }
-
- if (start && !renderSurfaceLayerList->empty())
- m_actions.begin(*this);
- else
- m_actions.end(*this);
- }
-
- inline static Layer* getRawPtr(const scoped_refptr<Layer>& ptr) { return ptr.get(); }
- inline static LayerImpl* getRawPtr(LayerImpl* ptr) { return ptr; }
-
- inline LayerType* currentLayer() const { return currentLayerRepresentsTargetRenderSurface() ? targetRenderSurfaceLayer() : getRawPtr(targetRenderSurfaceChildren()[m_currentLayerIndex]); }
-
- inline bool currentLayerRepresentsContributingRenderSurface() const { return LayerTreeHostCommon::renderSurfaceContributesToTarget<LayerType>(currentLayer(), targetRenderSurfaceLayer()->id()); }
- inline bool currentLayerRepresentsTargetRenderSurface() const { return m_currentLayerIndex == LayerIteratorValue::LayerIndexRepresentingTargetRenderSurface; }
-
- inline RenderSurfaceType* targetRenderSurface() const { return targetRenderSurfaceLayer()->render_surface(); }
- inline const LayerList& targetRenderSurfaceChildren() const { return targetRenderSurface()->layer_list(); }
-
- IteratorActionType m_actions;
- const LayerList* m_renderSurfaceLayerList;
-
- // The iterator's current position.
-
- // A position in the renderSurfaceLayerList. This points to a layer which owns the current target surface.
- // This is a value from 0 to n-1 (n = size of renderSurfaceLayerList = number of surfaces). A value outside of
- // this range (for example, LayerIteratorValue::InvalidTargetRenderSurfaceLayerIndex) is used to
- // indicate a position outside the bounds of the tree.
- int m_targetRenderSurfaceLayerIndex;
- // A position in the list of layers that are children of the current target surface. When pointing to one of
- // these layers, this is a value from 0 to n-1 (n = number of children). Since the iterator must also stop at
- // the layers representing the target surface, this is done by setting the currentLayerIndex to a value of
- // LayerIteratorValue::LayerRepresentingTargetRenderSurface.
- int m_currentLayerIndex;
-
- friend struct LayerIteratorActions;
+ if (start && !render_surface_layer_list->empty())
+ actions_.Begin(this);
+ else
+ actions_.End(this);
+ }
+
+ inline static Layer* get_raw_ptr(const scoped_refptr<Layer>& ptr) {
+ return ptr.get();
+ }
+ inline static LayerImpl* get_raw_ptr(LayerImpl* ptr) { return ptr; }
+
+ inline LayerType* current_layer() const {
+ return current_layer_represents_target_render_surface()
+ ? target_render_surface_layer()
+ : get_raw_ptr(
+ target_render_surface_children()[current_layer_index_]);
+ }
+
+ inline bool current_layer_represents_contributing_render_surface() const {
+ return LayerTreeHostCommon::renderSurfaceContributesToTarget<LayerType>(
+ current_layer(), target_render_surface_layer()->id());
+ }
+ inline bool current_layer_represents_target_render_surface() const {
+ return current_layer_index_ ==
+ LayerIteratorValue::kLayerIndexRepresentingTargetRenderSurface;
+ }
+
+ inline RenderSurfaceType* target_render_surface() const {
+ return target_render_surface_layer()->render_surface();
+ }
+ inline const LayerList& target_render_surface_children() const {
+ return target_render_surface()->layer_list();
+ }
+
+ IteratorActionType actions_;
+ const LayerList* render_surface_layer_list_;
+
+ // The iterator's current position.
+
+ // A position in the render_surface_layer_list. This points to a layer which
+ // owns the current target surface. This is a value from 0 to n-1
+ // (n = size of render_surface_layer_list = number of surfaces).
+ // A value outside of this range
+ // (for example, LayerIteratorValue::kInvalidTargetRenderSurfaceLayerIndex)
+ // is used to indicate a position outside the bounds of the tree.
+ int target_render_surface_layer_index_;
+ // A position in the list of layers that are children of the
+ // current target surface. When pointing to one of these layers,
+ // this is a value from 0 to n-1 (n = number of children).
+ // Since the iterator must also stop at the layers representing
+ // the target surface, this is done by setting the current_layerIndex
+ // to a value of LayerIteratorValue::LayerRepresentingTargetRenderSurface.
+ int current_layer_index_;
+
+ friend struct LayerIteratorActions;
};
-// Orderings for iterating over the RenderSurfaceImpl-Layer tree.
+// Orderings for iterating over the RenderSurface-Layer tree.
struct CC_EXPORT LayerIteratorActions {
- // Walks layers sorted by z-order from back to front.
- class CC_EXPORT BackToFront {
- public:
- template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
- void begin(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
-
- template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
- void end(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
-
- template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
- void next(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
-
- private:
- int m_highestTargetRenderSurfaceLayer;
- };
-
- // Walks layers sorted by z-order from front to back
- class CC_EXPORT FrontToBack {
- public:
- template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
- void begin(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
-
- template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
- void end(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
-
- template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
- void next(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
-
- private:
- template <typename LayerType, typename LayerList, typename RenderSurfaceType, typename ActionType>
- void goToHighestInSubtree(LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>&);
- };
+ // Walks layers sorted by z-order from back to front.
+ class CC_EXPORT BackToFront {
+ public:
+ template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename ActionType>
+ void Begin(
+ LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>* it);
+
+ template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename ActionType>
+ void End(
+ LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>* it);
+
+ template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename ActionType>
+ void Next(
+ LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>* it);
+
+ private:
+ int highest_target_render_surface_layer_;
+ };
+
+ // Walks layers sorted by z-order from front to back
+ class CC_EXPORT FrontToBack {
+ public:
+ template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename ActionType>
+ void Begin(
+ LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>* it);
+
+ template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename ActionType>
+ void End(
+ LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>* it);
+
+ template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename ActionType>
+ void Next(
+ LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>* it);
+
+ private:
+ template <typename LayerType,
+ typename LayerList,
+ typename RenderSurfaceType,
+ typename ActionType>
+ void GoToHighestInSubtree(
+ LayerIterator<LayerType, LayerList, RenderSurfaceType, ActionType>* it);
+ };
};
-} // namespace cc
+} // namespace cc
#endif // CC_LAYERS_LAYER_ITERATOR_H_
diff --git a/cc/layers/layer_iterator_unittest.cc b/cc/layers/layer_iterator_unittest.cc
index 9d4dc52..464c570 100644
--- a/cc/layers/layer_iterator_unittest.cc
+++ b/cc/layers/layer_iterator_unittest.cc
@@ -19,235 +19,262 @@ namespace cc {
namespace {
class TestLayer : public Layer {
-public:
- static scoped_refptr<TestLayer> Create() { return make_scoped_refptr(new TestLayer()); }
-
- int m_countRepresentingTargetSurface;
- int m_countRepresentingContributingSurface;
- int m_countRepresentingItself;
-
- virtual bool DrawsContent() const OVERRIDE { return m_drawsContent; }
- void setDrawsContent(bool drawsContent) { m_drawsContent = drawsContent; }
-
-private:
- TestLayer()
- : Layer()
- , m_drawsContent(true)
- {
- SetBounds(gfx::Size(100, 100));
- SetPosition(gfx::Point());
- SetAnchorPoint(gfx::Point());
- }
- virtual ~TestLayer()
- {
- }
-
- bool m_drawsContent;
+ public:
+ static scoped_refptr<TestLayer> Create() {
+ return make_scoped_refptr(new TestLayer());
+ }
+
+ int count_representing_target_surface_;
+ int count_representing_contributing_surface_;
+ int count_representing_itself_;
+
+ virtual bool DrawsContent() const OVERRIDE { return draws_content_; }
+ void set_draws_content(bool draws_content) { draws_content_ = draws_content; }
+
+ private:
+ TestLayer() : Layer(), draws_content_(true) {
+ SetBounds(gfx::Size(100, 100));
+ SetPosition(gfx::Point());
+ SetAnchorPoint(gfx::Point());
+ }
+ virtual ~TestLayer() {}
+
+ bool draws_content_;
};
-#define EXPECT_COUNT(layer, target, contrib, itself) \
- EXPECT_EQ(target, layer->m_countRepresentingTargetSurface); \
- EXPECT_EQ(contrib, layer->m_countRepresentingContributingSurface); \
- EXPECT_EQ(itself, layer->m_countRepresentingItself);
-
-typedef LayerIterator<Layer, std::vector<scoped_refptr<Layer> >, RenderSurface, LayerIteratorActions::FrontToBack> FrontToBack;
-typedef LayerIterator<Layer, std::vector<scoped_refptr<Layer> >, RenderSurface, LayerIteratorActions::BackToFront> BackToFront;
-
-void resetCounts(std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList)
-{
- for (unsigned surfaceIndex = 0; surfaceIndex < renderSurfaceLayerList.size(); ++surfaceIndex) {
- TestLayer* renderSurfaceLayer = static_cast<TestLayer*>(renderSurfaceLayerList[surfaceIndex].get());
- RenderSurface* renderSurface = renderSurfaceLayer->render_surface();
-
- renderSurfaceLayer->m_countRepresentingTargetSurface = -1;
- renderSurfaceLayer->m_countRepresentingContributingSurface = -1;
- renderSurfaceLayer->m_countRepresentingItself = -1;
-
- for (unsigned layerIndex = 0; layerIndex < renderSurface->layer_list().size(); ++layerIndex) {
- TestLayer* layer = static_cast<TestLayer*>(renderSurface->layer_list()[layerIndex].get());
-
- layer->m_countRepresentingTargetSurface = -1;
- layer->m_countRepresentingContributingSurface = -1;
- layer->m_countRepresentingItself = -1;
- }
+#define EXPECT_COUNT(layer, target, contrib, itself) \
+ EXPECT_EQ(target, layer->count_representing_target_surface_); \
+ EXPECT_EQ(contrib, layer->count_representing_contributing_surface_); \
+ EXPECT_EQ(itself, layer->count_representing_itself_);
+
+typedef LayerIterator<Layer,
+ std::vector<scoped_refptr<Layer> >,
+ RenderSurface,
+ LayerIteratorActions::FrontToBack> FrontToBack;
+typedef LayerIterator<Layer,
+ std::vector<scoped_refptr<Layer> >,
+ RenderSurface,
+ LayerIteratorActions::BackToFront> BackToFront;
+
+void ResetCounts(std::vector<scoped_refptr<Layer> >* render_surface_layerList) {
+ for (unsigned surface_index = 0;
+ surface_index < render_surface_layerList->size();
+ ++surface_index) {
+ TestLayer* render_surface_layer = static_cast<TestLayer*>(
+ (*render_surface_layerList)[surface_index].get());
+ RenderSurface* render_surface = render_surface_layer->render_surface();
+
+ render_surface_layer->count_representing_target_surface_ = -1;
+ render_surface_layer->count_representing_contributing_surface_ = -1;
+ render_surface_layer->count_representing_itself_ = -1;
+
+ for (unsigned layer_index = 0;
+ layer_index < render_surface->layer_list().size();
+ ++layer_index) {
+ TestLayer* layer = static_cast<TestLayer*>(
+ render_surface->layer_list()[layer_index].get());
+
+ layer->count_representing_target_surface_ = -1;
+ layer->count_representing_contributing_surface_ = -1;
+ layer->count_representing_itself_ = -1;
}
+ }
}
-void iterateFrontToBack(std::vector<scoped_refptr<Layer> >* renderSurfaceLayerList)
-{
- resetCounts(*renderSurfaceLayerList);
- int count = 0;
- for (FrontToBack it = FrontToBack::begin(renderSurfaceLayerList); it != FrontToBack::end(renderSurfaceLayerList); ++it, ++count) {
- TestLayer* layer = static_cast<TestLayer*>(*it);
- if (it.representsTargetRenderSurface())
- layer->m_countRepresentingTargetSurface = count;
- if (it.representsContributingRenderSurface())
- layer->m_countRepresentingContributingSurface = count;
- if (it.representsItself())
- layer->m_countRepresentingItself = count;
- }
+void IterateFrontToBack(
+ std::vector<scoped_refptr<Layer> >* render_surface_layerList) {
+ ResetCounts(render_surface_layerList);
+ int count = 0;
+ for (FrontToBack it = FrontToBack::Begin(render_surface_layerList);
+ it != FrontToBack::End(render_surface_layerList);
+ ++it, ++count) {
+ TestLayer* layer = static_cast<TestLayer*>(*it);
+ if (it.represents_target_render_surface())
+ layer->count_representing_target_surface_ = count;
+ if (it.represents_contributing_render_surface())
+ layer->count_representing_contributing_surface_ = count;
+ if (it.represents_itself())
+ layer->count_representing_itself_ = count;
+ }
}
-void iterateBackToFront(std::vector<scoped_refptr<Layer> >* renderSurfaceLayerList)
-{
- resetCounts(*renderSurfaceLayerList);
- int count = 0;
- for (BackToFront it = BackToFront::begin(renderSurfaceLayerList); it != BackToFront::end(renderSurfaceLayerList); ++it, ++count) {
- TestLayer* layer = static_cast<TestLayer*>(*it);
- if (it.representsTargetRenderSurface())
- layer->m_countRepresentingTargetSurface = count;
- if (it.representsContributingRenderSurface())
- layer->m_countRepresentingContributingSurface = count;
- if (it.representsItself())
- layer->m_countRepresentingItself = count;
- }
+void IterateBackToFront(
+ std::vector<scoped_refptr<Layer> >* render_surface_layerList) {
+ ResetCounts(render_surface_layerList);
+ int count = 0;
+ for (BackToFront it = BackToFront::Begin(render_surface_layerList);
+ it != BackToFront::End(render_surface_layerList);
+ ++it, ++count) {
+ TestLayer* layer = static_cast<TestLayer*>(*it);
+ if (it.represents_target_render_surface())
+ layer->count_representing_target_surface_ = count;
+ if (it.represents_contributing_render_surface())
+ layer->count_representing_contributing_surface_ = count;
+ if (it.represents_itself())
+ layer->count_representing_itself_ = count;
+ }
}
-TEST(LayerIteratorTest, emptyTree)
-{
- std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
+TEST(LayerIteratorTest, EmptyTree) {
+ std::vector<scoped_refptr<Layer> > render_surface_layerList;
- iterateBackToFront(&renderSurfaceLayerList);
- iterateFrontToBack(&renderSurfaceLayerList);
+ IterateBackToFront(&render_surface_layerList);
+ IterateFrontToBack(&render_surface_layerList);
}
-TEST(LayerIteratorTest, simpleTree)
-{
- scoped_refptr<TestLayer> rootLayer = TestLayer::Create();
- scoped_refptr<TestLayer> first = TestLayer::Create();
- scoped_refptr<TestLayer> second = TestLayer::Create();
- scoped_refptr<TestLayer> third = TestLayer::Create();
- scoped_refptr<TestLayer> fourth = TestLayer::Create();
-
- rootLayer->CreateRenderSurface();
-
- rootLayer->AddChild(first);
- rootLayer->AddChild(second);
- rootLayer->AddChild(third);
- rootLayer->AddChild(fourth);
-
- std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
- LayerTreeHostCommon::calculateDrawProperties(rootLayer.get(), rootLayer->bounds(), 1, 1, 256, false, renderSurfaceLayerList);
-
- iterateBackToFront(&renderSurfaceLayerList);
- EXPECT_COUNT(rootLayer, 0, -1, 1);
- EXPECT_COUNT(first, -1, -1, 2);
- EXPECT_COUNT(second, -1, -1, 3);
- EXPECT_COUNT(third, -1, -1, 4);
- EXPECT_COUNT(fourth, -1, -1, 5);
-
- iterateFrontToBack(&renderSurfaceLayerList);
- EXPECT_COUNT(rootLayer, 5, -1, 4);
- EXPECT_COUNT(first, -1, -1, 3);
- EXPECT_COUNT(second, -1, -1, 2);
- EXPECT_COUNT(third, -1, -1, 1);
- EXPECT_COUNT(fourth, -1, -1, 0);
+TEST(LayerIteratorTest, SimpleTree) {
+ scoped_refptr<TestLayer> root_layer = TestLayer::Create();
+ scoped_refptr<TestLayer> first = TestLayer::Create();
+ scoped_refptr<TestLayer> second = TestLayer::Create();
+ scoped_refptr<TestLayer> third = TestLayer::Create();
+ scoped_refptr<TestLayer> fourth = TestLayer::Create();
+
+ root_layer->CreateRenderSurface();
+
+ root_layer->AddChild(first);
+ root_layer->AddChild(second);
+ root_layer->AddChild(third);
+ root_layer->AddChild(fourth);
+
+ std::vector<scoped_refptr<Layer> > render_surface_layerList;
+ LayerTreeHostCommon::calculateDrawProperties(root_layer.get(),
+ root_layer->bounds(),
+ 1,
+ 1,
+ 256,
+ false,
+ render_surface_layerList);
+
+ IterateBackToFront(&render_surface_layerList);
+ EXPECT_COUNT(root_layer, 0, -1, 1);
+ EXPECT_COUNT(first, -1, -1, 2);
+ EXPECT_COUNT(second, -1, -1, 3);
+ EXPECT_COUNT(third, -1, -1, 4);
+ EXPECT_COUNT(fourth, -1, -1, 5);
+
+ IterateFrontToBack(&render_surface_layerList);
+ EXPECT_COUNT(root_layer, 5, -1, 4);
+ EXPECT_COUNT(first, -1, -1, 3);
+ EXPECT_COUNT(second, -1, -1, 2);
+ EXPECT_COUNT(third, -1, -1, 1);
+ EXPECT_COUNT(fourth, -1, -1, 0);
}
-TEST(LayerIteratorTest, complexTree)
-{
- scoped_refptr<TestLayer> rootLayer = TestLayer::Create();
- scoped_refptr<TestLayer> root1 = TestLayer::Create();
- scoped_refptr<TestLayer> root2 = TestLayer::Create();
- scoped_refptr<TestLayer> root3 = TestLayer::Create();
- scoped_refptr<TestLayer> root21 = TestLayer::Create();
- scoped_refptr<TestLayer> root22 = TestLayer::Create();
- scoped_refptr<TestLayer> root23 = TestLayer::Create();
- scoped_refptr<TestLayer> root221 = TestLayer::Create();
- scoped_refptr<TestLayer> root231 = TestLayer::Create();
-
- rootLayer->CreateRenderSurface();
-
- rootLayer->AddChild(root1);
- rootLayer->AddChild(root2);
- rootLayer->AddChild(root3);
- root2->AddChild(root21);
- root2->AddChild(root22);
- root2->AddChild(root23);
- root22->AddChild(root221);
- root23->AddChild(root231);
-
- std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
- LayerTreeHostCommon::calculateDrawProperties(rootLayer.get(), rootLayer->bounds(), 1, 1, 256, false, renderSurfaceLayerList);
-
- iterateBackToFront(&renderSurfaceLayerList);
- EXPECT_COUNT(rootLayer, 0, -1, 1);
- EXPECT_COUNT(root1, -1, -1, 2);
- EXPECT_COUNT(root2, -1, -1, 3);
- EXPECT_COUNT(root21, -1, -1, 4);
- EXPECT_COUNT(root22, -1, -1, 5);
- EXPECT_COUNT(root221, -1, -1, 6);
- EXPECT_COUNT(root23, -1, -1, 7);
- EXPECT_COUNT(root231, -1, -1, 8);
- EXPECT_COUNT(root3, -1, -1, 9);
-
- iterateFrontToBack(&renderSurfaceLayerList);
- EXPECT_COUNT(rootLayer, 9, -1, 8);
- EXPECT_COUNT(root1, -1, -1, 7);
- EXPECT_COUNT(root2, -1, -1, 6);
- EXPECT_COUNT(root21, -1, -1, 5);
- EXPECT_COUNT(root22, -1, -1, 4);
- EXPECT_COUNT(root221, -1, -1, 3);
- EXPECT_COUNT(root23, -1, -1, 2);
- EXPECT_COUNT(root231, -1, -1, 1);
- EXPECT_COUNT(root3, -1, -1, 0);
+TEST(LayerIteratorTest, ComplexTree) {
+ scoped_refptr<TestLayer> root_layer = TestLayer::Create();
+ scoped_refptr<TestLayer> root1 = TestLayer::Create();
+ scoped_refptr<TestLayer> root2 = TestLayer::Create();
+ scoped_refptr<TestLayer> root3 = TestLayer::Create();
+ scoped_refptr<TestLayer> root21 = TestLayer::Create();
+ scoped_refptr<TestLayer> root22 = TestLayer::Create();
+ scoped_refptr<TestLayer> root23 = TestLayer::Create();
+ scoped_refptr<TestLayer> root221 = TestLayer::Create();
+ scoped_refptr<TestLayer> root231 = TestLayer::Create();
+
+ root_layer->CreateRenderSurface();
+
+ root_layer->AddChild(root1);
+ root_layer->AddChild(root2);
+ root_layer->AddChild(root3);
+ root2->AddChild(root21);
+ root2->AddChild(root22);
+ root2->AddChild(root23);
+ root22->AddChild(root221);
+ root23->AddChild(root231);
+
+ std::vector<scoped_refptr<Layer> > render_surface_layerList;
+ LayerTreeHostCommon::calculateDrawProperties(root_layer.get(),
+ root_layer->bounds(),
+ 1,
+ 1,
+ 256,
+ false,
+ render_surface_layerList);
+
+ IterateBackToFront(&render_surface_layerList);
+ EXPECT_COUNT(root_layer, 0, -1, 1);
+ EXPECT_COUNT(root1, -1, -1, 2);
+ EXPECT_COUNT(root2, -1, -1, 3);
+ EXPECT_COUNT(root21, -1, -1, 4);
+ EXPECT_COUNT(root22, -1, -1, 5);
+ EXPECT_COUNT(root221, -1, -1, 6);
+ EXPECT_COUNT(root23, -1, -1, 7);
+ EXPECT_COUNT(root231, -1, -1, 8);
+ EXPECT_COUNT(root3, -1, -1, 9);
+
+ IterateFrontToBack(&render_surface_layerList);
+ EXPECT_COUNT(root_layer, 9, -1, 8);
+ EXPECT_COUNT(root1, -1, -1, 7);
+ EXPECT_COUNT(root2, -1, -1, 6);
+ EXPECT_COUNT(root21, -1, -1, 5);
+ EXPECT_COUNT(root22, -1, -1, 4);
+ EXPECT_COUNT(root221, -1, -1, 3);
+ EXPECT_COUNT(root23, -1, -1, 2);
+ EXPECT_COUNT(root231, -1, -1, 1);
+ EXPECT_COUNT(root3, -1, -1, 0);
}
-TEST(LayerIteratorTest, complexTreeMultiSurface)
-{
- scoped_refptr<TestLayer> rootLayer = TestLayer::Create();
- scoped_refptr<TestLayer> root1 = TestLayer::Create();
- scoped_refptr<TestLayer> root2 = TestLayer::Create();
- scoped_refptr<TestLayer> root3 = TestLayer::Create();
- scoped_refptr<TestLayer> root21 = TestLayer::Create();
- scoped_refptr<TestLayer> root22 = TestLayer::Create();
- scoped_refptr<TestLayer> root23 = TestLayer::Create();
- scoped_refptr<TestLayer> root221 = TestLayer::Create();
- scoped_refptr<TestLayer> root231 = TestLayer::Create();
-
- rootLayer->CreateRenderSurface();
- rootLayer->render_surface()->SetContentRect(gfx::Rect(gfx::Point(), rootLayer->bounds()));
-
- rootLayer->AddChild(root1);
- rootLayer->AddChild(root2);
- rootLayer->AddChild(root3);
- root2->setDrawsContent(false);
- root2->SetOpacity(0.5);
- root2->SetForceRenderSurface(true); // Force the layer to own a new surface.
- root2->AddChild(root21);
- root2->AddChild(root22);
- root2->AddChild(root23);
- root22->SetOpacity(0.5);
- root22->AddChild(root221);
- root23->SetOpacity(0.5);
- root23->AddChild(root231);
-
- std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
- LayerTreeHostCommon::calculateDrawProperties(rootLayer.get(), rootLayer->bounds(), 1, 1, 256, false, renderSurfaceLayerList);
-
- iterateBackToFront(&renderSurfaceLayerList);
- EXPECT_COUNT(rootLayer, 0, -1, 1);
- EXPECT_COUNT(root1, -1, -1, 2);
- EXPECT_COUNT(root2, 4, 3, -1);
- EXPECT_COUNT(root21, -1, -1, 5);
- EXPECT_COUNT(root22, 7, 6, 8);
- EXPECT_COUNT(root221, -1, -1, 9);
- EXPECT_COUNT(root23, 11, 10, 12);
- EXPECT_COUNT(root231, -1, -1, 13);
- EXPECT_COUNT(root3, -1, -1, 14);
-
- iterateFrontToBack(&renderSurfaceLayerList);
- EXPECT_COUNT(rootLayer, 14, -1, 13);
- EXPECT_COUNT(root1, -1, -1, 12);
- EXPECT_COUNT(root2, 10, 11, -1);
- EXPECT_COUNT(root21, -1, -1, 9);
- EXPECT_COUNT(root22, 7, 8, 6);
- EXPECT_COUNT(root221, -1, -1, 5);
- EXPECT_COUNT(root23, 3, 4, 2);
- EXPECT_COUNT(root231, -1, -1, 1);
- EXPECT_COUNT(root3, -1, -1, 0);
+TEST(LayerIteratorTest, ComplexTreeMultiSurface) {
+ scoped_refptr<TestLayer> root_layer = TestLayer::Create();
+ scoped_refptr<TestLayer> root1 = TestLayer::Create();
+ scoped_refptr<TestLayer> root2 = TestLayer::Create();
+ scoped_refptr<TestLayer> root3 = TestLayer::Create();
+ scoped_refptr<TestLayer> root21 = TestLayer::Create();
+ scoped_refptr<TestLayer> root22 = TestLayer::Create();
+ scoped_refptr<TestLayer> root23 = TestLayer::Create();
+ scoped_refptr<TestLayer> root221 = TestLayer::Create();
+ scoped_refptr<TestLayer> root231 = TestLayer::Create();
+
+ root_layer->CreateRenderSurface();
+ root_layer->render_surface()->
+ SetContentRect(gfx::Rect(gfx::Point(), root_layer->bounds()));
+
+ root_layer->AddChild(root1);
+ root_layer->AddChild(root2);
+ root_layer->AddChild(root3);
+ root2->set_draws_content(false);
+ root2->SetOpacity(0.5f);
+ root2->SetForceRenderSurface(true); // Force the layer to own a new surface.
+ root2->AddChild(root21);
+ root2->AddChild(root22);
+ root2->AddChild(root23);
+ root22->SetOpacity(0.5f);
+ root22->AddChild(root221);
+ root23->SetOpacity(0.5f);
+ root23->AddChild(root231);
+
+ std::vector<scoped_refptr<Layer> > render_surface_layerList;
+ LayerTreeHostCommon::calculateDrawProperties(root_layer.get(),
+ root_layer->bounds(),
+ 1,
+ 1,
+ 256,
+ false,
+ render_surface_layerList);
+
+ IterateBackToFront(&render_surface_layerList);
+ EXPECT_COUNT(root_layer, 0, -1, 1);
+ EXPECT_COUNT(root1, -1, -1, 2);
+ EXPECT_COUNT(root2, 4, 3, -1);
+ EXPECT_COUNT(root21, -1, -1, 5);
+ EXPECT_COUNT(root22, 7, 6, 8);
+ EXPECT_COUNT(root221, -1, -1, 9);
+ EXPECT_COUNT(root23, 11, 10, 12);
+ EXPECT_COUNT(root231, -1, -1, 13);
+ EXPECT_COUNT(root3, -1, -1, 14);
+
+ IterateFrontToBack(&render_surface_layerList);
+ EXPECT_COUNT(root_layer, 14, -1, 13);
+ EXPECT_COUNT(root1, -1, -1, 12);
+ EXPECT_COUNT(root2, 10, 11, -1);
+ EXPECT_COUNT(root21, -1, -1, 9);
+ EXPECT_COUNT(root22, 7, 8, 6);
+ EXPECT_COUNT(root221, -1, -1, 5);
+ EXPECT_COUNT(root23, 3, 4, 2);
+ EXPECT_COUNT(root231, -1, -1, 1);
+ EXPECT_COUNT(root3, -1, -1, 0);
}
} // namespace
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index bdba155..769bac8 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -732,13 +732,13 @@ void LayerTreeHost::SetPrioritiesForLayers(const LayerList& update_list) {
LayerIteratorActions::BackToFront> LayerIteratorType;
PriorityCalculator calculator;
- LayerIteratorType end = LayerIteratorType::end(&update_list);
- for (LayerIteratorType it = LayerIteratorType::begin(&update_list);
+ LayerIteratorType end = LayerIteratorType::End(&update_list);
+ for (LayerIteratorType it = LayerIteratorType::Begin(&update_list);
it != end;
++it) {
- if (it.representsItself()) {
+ if (it.represents_itself()) {
it->SetTexturePriorities(calculator);
- } else if (it.representsTargetRenderSurface()) {
+ } else if (it.represents_target_render_surface()) {
if (it->mask_layer())
it->mask_layer()->SetTexturePriorities(calculator);
if (it->replica_layer() && it->replica_layer()->mask_layer())
@@ -847,18 +847,18 @@ bool LayerTreeHost::PaintLayerContents(
RenderingStats* stats = debug_state_.RecordRenderingStats() ?
&rendering_stats_ : NULL;
- LayerIteratorType end = LayerIteratorType::end(&render_surface_layer_list);
+ LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list);
for (LayerIteratorType it =
- LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType::Begin(&render_surface_layer_list);
it != end;
++it) {
occlusion_tracker.EnterLayer(it);
- if (it.representsTargetRenderSurface()) {
+ if (it.represents_target_render_surface()) {
DCHECK(it->render_surface()->draw_opacity() ||
it->render_surface()->draw_opacity_is_animating());
need_more_updates |= PaintMasksForRenderSurface(*it, queue);
- } else if (it.representsItself()) {
+ } else if (it.represents_itself()) {
DCHECK(!it->bounds().IsEmpty());
it->Update(queue, &occlusion_tracker, stats);
need_more_updates |= it->NeedMoreUpdates();
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 931b6f9f..770a408 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -350,7 +350,7 @@ gfx::Transform computeScrollCompensationForThisLayer(LayerImpl* scrollingLayer,
return scrollCompensationForThisLayer;
}
-gfx::Transform computeScrollCompensationMatrixForChildren(Layer* currentLayer, const gfx::Transform& currentParentMatrix, const gfx::Transform& currentScrollCompensation)
+gfx::Transform computeScrollCompensationMatrixForChildren(Layer* current_layer, const gfx::Transform& currentParentMatrix, const gfx::Transform& currentScrollCompensation)
{
// The main thread (i.e. Layer) does not need to worry about scroll compensation.
// So we can just return an identity matrix here.
@@ -1127,20 +1127,20 @@ static bool pointHitsRegion(gfx::PointF screenSpacePoint, const gfx::Transform&
static bool pointIsClippedBySurfaceOrClipRect(const gfx::PointF& screenSpacePoint, LayerImpl* layer)
{
- LayerImpl* currentLayer = layer;
+ LayerImpl* current_layer = layer;
// Walk up the layer tree and hit-test any renderSurfaces and any layer clipRects that are active.
- while (currentLayer) {
- if (currentLayer->render_surface() && !pointHitsRect(screenSpacePoint, currentLayer->render_surface()->screen_space_transform(), currentLayer->render_surface()->content_rect()))
+ while (current_layer) {
+ if (current_layer->render_surface() && !pointHitsRect(screenSpacePoint, current_layer->render_surface()->screen_space_transform(), current_layer->render_surface()->content_rect()))
return true;
// Note that drawableContentRects are actually in targetSurface space, so the transform we
// have to provide is the target surface's screenSpaceTransform.
- LayerImpl* renderTarget = currentLayer->render_target();
- if (layerClipsSubtree(currentLayer) && !pointHitsRect(screenSpacePoint, renderTarget->render_surface()->screen_space_transform(), currentLayer->drawable_content_rect()))
+ LayerImpl* renderTarget = current_layer->render_target();
+ if (layerClipsSubtree(current_layer) && !pointHitsRect(screenSpacePoint, renderTarget->render_surface()->screen_space_transform(), current_layer->drawable_content_rect()))
return true;
- currentLayer = currentLayer->parent();
+ current_layer = current_layer->parent();
}
// If we have finished walking all ancestors without having already exited, then the point is not clipped by any ancestors.
@@ -1152,30 +1152,30 @@ LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPoint(const gfx::PointF& scr
LayerImpl* foundLayer = 0;
typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType;
- LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList);
+ LayerIteratorType end = LayerIteratorType::End(&renderSurfaceLayerList);
- for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) {
+ for (LayerIteratorType it = LayerIteratorType::Begin(&renderSurfaceLayerList); it != end; ++it) {
// We don't want to consider renderSurfaces for hit testing.
- if (!it.representsItself())
+ if (!it.represents_itself())
continue;
- LayerImpl* currentLayer = (*it);
+ LayerImpl* current_layer = (*it);
- gfx::RectF contentRect(gfx::PointF(), currentLayer->content_bounds());
- if (!pointHitsRect(screenSpacePoint, currentLayer->screen_space_transform(), contentRect))
+ gfx::RectF contentRect(gfx::PointF(), current_layer->content_bounds());
+ if (!pointHitsRect(screenSpacePoint, current_layer->screen_space_transform(), contentRect))
continue;
// At this point, we think the point does hit the layer, but we need to walk up
// the parents to ensure that the layer was not clipped in such a way that the
// hit point actually should not hit the layer.
- if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, currentLayer))
+ if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, current_layer))
continue;
// Skip the HUD layer.
- if (currentLayer == currentLayer->layer_tree_impl()->hud_layer())
+ if (current_layer == current_layer->layer_tree_impl()->hud_layer())
continue;
- foundLayer = currentLayer;
+ foundLayer = current_layer;
break;
}
@@ -1188,19 +1188,19 @@ LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPointInTouchHandlerRegion(co
LayerImpl* foundLayer = 0;
typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType;
- LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList);
+ LayerIteratorType end = LayerIteratorType::End(&renderSurfaceLayerList);
- for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) {
+ for (LayerIteratorType it = LayerIteratorType::Begin(&renderSurfaceLayerList); it != end; ++it) {
// We don't want to consider renderSurfaces for hit testing.
- if (!it.representsItself())
+ if (!it.represents_itself())
continue;
- LayerImpl* currentLayer = (*it);
+ LayerImpl* current_layer = (*it);
- if (!layerHasTouchEventHandlersAt(screenSpacePoint, currentLayer))
+ if (!layerHasTouchEventHandlersAt(screenSpacePoint, current_layer))
continue;
- foundLayer = currentLayer;
+ foundLayer = current_layer;
break;
}
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index e1341f6..216f6ce 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -541,13 +541,13 @@ bool LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) {
bool draw_frame = true;
LayerIteratorType end =
- LayerIteratorType::end(frame->render_surface_layer_list);
+ LayerIteratorType::End(frame->render_surface_layer_list);
for (LayerIteratorType it =
- LayerIteratorType::begin(frame->render_surface_layer_list);
+ LayerIteratorType::Begin(frame->render_surface_layer_list);
it != end;
++it) {
RenderPass::Id target_render_pass_id =
- it.targetRenderSurfaceLayer()->render_surface()->RenderPassId();
+ it.target_render_surface_layer()->render_surface()->RenderPassId();
RenderPass* target_render_pass =
frame->render_passes_by_id[target_render_pass_id];
@@ -555,7 +555,7 @@ bool LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) {
AppendQuadsData append_quads_data(target_render_pass->id);
- if (it.representsContributingRenderSurface()) {
+ if (it.represents_contributing_render_surface()) {
RenderPass::Id contributing_render_pass_id =
it->render_surface()->RenderPassId();
RenderPass* contributing_render_pass =
@@ -565,7 +565,7 @@ bool LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) {
contributing_render_pass,
occlusion_tracker,
&append_quads_data);
- } else if (it.representsItself() && !it->visible_content_rect().IsEmpty()) {
+ } else if (it.represents_itself() && !it->visible_content_rect().IsEmpty()) {
bool has_occlusion_from_outside_target_surface;
bool impl_draw_transform_is_unknown = false;
if (occlusion_tracker.Occluded(
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 79bf9c7..80e4723 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -334,10 +334,10 @@ bool LayerTreeImpl::AreVisibleResourcesReady() const {
std::vector<LayerImpl*>,
RenderSurfaceImpl,
LayerIteratorActions::BackToFront> LayerIteratorType;
- LayerIteratorType end = LayerIteratorType::end(&render_surface_layer_list_);
- for (LayerIteratorType it = LayerIteratorType::begin(
+ LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list_);
+ for (LayerIteratorType it = LayerIteratorType::Begin(
&render_surface_layer_list_); it != end; ++it) {
- if (it.representsItself() && !(*it)->AreVisibleResourcesReady())
+ if (it.represents_itself() && !(*it)->AreVisibleResourcesReady())
return false;
}
@@ -534,10 +534,10 @@ scoped_ptr<base::Value> LayerTreeImpl::AsValue() const {
std::vector<LayerImpl*>,
RenderSurfaceImpl,
LayerIteratorActions::BackToFront> LayerIteratorType;
- LayerIteratorType end = LayerIteratorType::end(&render_surface_layer_list_);
- for (LayerIteratorType it = LayerIteratorType::begin(
+ LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list_);
+ for (LayerIteratorType it = LayerIteratorType::Begin(
&render_surface_layer_list_); it != end; ++it) {
- if (!it.representsItself())
+ if (!it.represents_itself())
continue;
state->Append((*it)->AsValue().release());
}
diff --git a/cc/trees/occlusion_tracker.cc b/cc/trees/occlusion_tracker.cc
index 77b083b..d81232f9 100644
--- a/cc/trees/occlusion_tracker.cc
+++ b/cc/trees/occlusion_tracker.cc
@@ -29,24 +29,24 @@ OcclusionTrackerBase<LayerType, RenderSurfaceType>::~OcclusionTrackerBase() {}
template <typename LayerType, typename RenderSurfaceType>
void OcclusionTrackerBase<LayerType, RenderSurfaceType>::EnterLayer(
const LayerIteratorPosition<LayerType>& layer_iterator) {
- LayerType* render_target = layer_iterator.targetRenderSurfaceLayer;
+ LayerType* render_target = layer_iterator.target_render_surface_layer;
- if (layer_iterator.representsItself)
+ if (layer_iterator.represents_itself)
EnterRenderTarget(render_target);
- else if (layer_iterator.representsTargetRenderSurface)
+ else if (layer_iterator.represents_target_render_surface)
FinishedRenderTarget(render_target);
}
template <typename LayerType, typename RenderSurfaceType>
void OcclusionTrackerBase<LayerType, RenderSurfaceType>::LeaveLayer(
const LayerIteratorPosition<LayerType>& layer_iterator) {
- LayerType* render_target = layer_iterator.targetRenderSurfaceLayer;
+ LayerType* render_target = layer_iterator.target_render_surface_layer;
- if (layer_iterator.representsItself)
- MarkOccludedBehindLayer(layer_iterator.currentLayer);
+ if (layer_iterator.represents_itself)
+ MarkOccludedBehindLayer(layer_iterator.current_layer);
// TODO(danakj): This should be done when entering the contributing surface,
// but in a way that the surface's own occlusion won't occlude itself.
- else if (layer_iterator.representsContributingRenderSurface)
+ else if (layer_iterator.represents_contributing_render_surface)
LeaveToRenderTarget(render_target);
}
diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc
index 0ec71d1..a263aff 100644
--- a/cc/trees/occlusion_tracker_unittest.cc
+++ b/cc/trees/occlusion_tracker_unittest.cc
@@ -278,7 +278,7 @@ protected:
LayerTreeHostCommon::calculateDrawProperties(root, root->bounds(), 1, 1, dummyMaxTextureSize, false, m_renderSurfaceLayerListImpl, false);
- m_layerIterator = m_layerIteratorBegin = Types::TestLayerIterator::begin(&m_renderSurfaceLayerListImpl);
+ m_layerIterator = m_layerIteratorBegin = Types::TestLayerIterator::Begin(&m_renderSurfaceLayerListImpl);
}
void calcDrawEtc(TestContentLayer* root)
@@ -290,20 +290,20 @@ protected:
LayerTreeHostCommon::calculateDrawProperties(root, root->bounds(), 1, 1, dummyMaxTextureSize, false, m_renderSurfaceLayerList);
- m_layerIterator = m_layerIteratorBegin = Types::TestLayerIterator::begin(&m_renderSurfaceLayerList);
+ m_layerIterator = m_layerIteratorBegin = Types::TestLayerIterator::Begin(&m_renderSurfaceLayerList);
}
void EnterLayer(typename Types::LayerType* layer, typename Types::OcclusionTrackerType& occlusion)
{
ASSERT_EQ(layer, *m_layerIterator);
- ASSERT_TRUE(m_layerIterator.representsItself());
+ ASSERT_TRUE(m_layerIterator.represents_itself());
occlusion.EnterLayer(m_layerIterator);
}
void LeaveLayer(typename Types::LayerType* layer, typename Types::OcclusionTrackerType& occlusion)
{
ASSERT_EQ(layer, *m_layerIterator);
- ASSERT_TRUE(m_layerIterator.representsItself());
+ ASSERT_TRUE(m_layerIterator.represents_itself());
occlusion.LeaveLayer(m_layerIterator);
++m_layerIterator;
}
@@ -317,18 +317,18 @@ protected:
void enterContributingSurface(typename Types::LayerType* layer, typename Types::OcclusionTrackerType& occlusion)
{
ASSERT_EQ(layer, *m_layerIterator);
- ASSERT_TRUE(m_layerIterator.representsTargetRenderSurface());
+ ASSERT_TRUE(m_layerIterator.represents_target_render_surface());
occlusion.EnterLayer(m_layerIterator);
occlusion.LeaveLayer(m_layerIterator);
++m_layerIterator;
- ASSERT_TRUE(m_layerIterator.representsContributingRenderSurface());
+ ASSERT_TRUE(m_layerIterator.represents_contributing_render_surface());
occlusion.EnterLayer(m_layerIterator);
}
void leaveContributingSurface(typename Types::LayerType* layer, typename Types::OcclusionTrackerType& occlusion)
{
ASSERT_EQ(layer, *m_layerIterator);
- ASSERT_TRUE(m_layerIterator.representsContributingRenderSurface());
+ ASSERT_TRUE(m_layerIterator.represents_contributing_render_surface());
occlusion.LeaveLayer(m_layerIterator);
++m_layerIterator;
}
diff --git a/cc/trees/quad_culler_unittest.cc b/cc/trees/quad_culler_unittest.cc
index c7dad79..dd9c2e4 100644
--- a/cc/trees/quad_culler_unittest.cc
+++ b/cc/trees/quad_culler_unittest.cc
@@ -155,7 +155,7 @@ TEST_F(QuadCullerTest, VerifyNoCulling) {
gfx::Rect(),
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -190,7 +190,7 @@ TEST_F(QuadCullerTest, VerifyCullChildLinesUpTopLeft) {
gfx::Rect(),
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -225,7 +225,7 @@ TEST_F(QuadCullerTest, VerifyCullWhenChildOpacityNotOne) {
gfx::Rect(),
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -260,7 +260,7 @@ TEST_F(QuadCullerTest, VerifyCullWhenChildOpaqueFlagFalse) {
gfx::Rect(),
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -295,7 +295,7 @@ TEST_F(QuadCullerTest, VerifyCullCenterTileOnly) {
gfx::Rect(),
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -355,7 +355,7 @@ TEST_F(QuadCullerTest, VerifyCullCenterTileNonIntegralSize1) {
gfx::Rect(),
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -400,7 +400,7 @@ TEST_F(QuadCullerTest, VerifyCullCenterTileNonIntegralSize2) {
gfx::Rect(),
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -435,7 +435,7 @@ TEST_F(QuadCullerTest, VerifyCullChildLinesUpBottomRight) {
gfx::Rect(),
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -474,7 +474,7 @@ TEST_F(QuadCullerTest, VerifyCullSubRegion) {
child_opaque_rect,
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -514,7 +514,7 @@ TEST_F(QuadCullerTest, VerifyCullSubRegion2) {
child_opaque_rect,
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -554,7 +554,7 @@ TEST_F(QuadCullerTest, VerifyCullSubRegionCheckOvercull) {
child_opaque_rect,
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -592,7 +592,7 @@ TEST_F(QuadCullerTest, VerifyNonAxisAlignedQuadsDontOcclude) {
gfx::Rect(),
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -635,7 +635,7 @@ TEST_F(QuadCullerTest, VerifyNonAxisAlignedQuadsSafelyCulled) {
gfx::Rect(),
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(-100, -100, 1000, 1000));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -669,7 +669,7 @@ TEST_F(QuadCullerTest, VerifyCullOutsideScissorOverTile) {
gfx::Rect(),
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(200, 100, 100, 100));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -703,7 +703,7 @@ TEST_F(QuadCullerTest, VerifyCullOutsideScissorOverCulledTile) {
gfx::Rect(),
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(100, 100, 100, 100));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -737,7 +737,7 @@ TEST_F(QuadCullerTest, VerifyCullOutsideScissorOverPartialTiles) {
gfx::Rect(),
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(50, 50, 200, 200));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -771,7 +771,7 @@ TEST_F(QuadCullerTest, VerifyCullOutsideScissorOverNoTiles) {
gfx::Rect(),
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(500, 500, 100, 100));
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);
@@ -806,7 +806,7 @@ TEST_F(QuadCullerTest, VerifyWithoutMetrics) {
render_surface_layer_list);
TestOcclusionTrackerImpl occlusion_tracker(gfx::Rect(50, 50, 200, 200),
false);
- LayerIteratorType it = LayerIteratorType::begin(&render_surface_layer_list);
+ LayerIteratorType it = LayerIteratorType::Begin(&render_surface_layer_list);
AppendQuads(
quad_list, shared_state_list, child_layer.get(), it, occlusion_tracker);