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

Unified Diff: cc/trees/property_tree.h

Issue 2087963003: cc: Stop creating unused 0 property tree nodes other than transform Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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/trees/layer_tree_impl.cc ('k') | cc/trees/property_tree.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/property_tree.h
diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h
index b00d090a3d863eb43bbd2946455cf70dc4cc4cf9..7aa86d60bc9ba2033540f38655d0453079220591 100644
--- a/cc/trees/property_tree.h
+++ b/cc/trees/property_tree.h
@@ -67,6 +67,10 @@ class CC_EXPORT PropertyTree {
~PropertyTree();
PropertyTree<T>& operator=(const PropertyTree<T>&);
+ // Property tree node starts from index 0.
+ static const int kInvalidNodeId = -1;
+ static const int kRootNodeId = 0;
+
bool operator==(const PropertyTree<T>& other) const;
int Insert(const T& tree_node, int parent_id);
@@ -82,8 +86,12 @@ class CC_EXPORT PropertyTree {
return i > -1 ? &nodes_[i] : nullptr;
}
- T* parent(const T* t) { return Node(t->parent_id); }
- const T* parent(const T* t) const { return Node(t->parent_id); }
+ T* parent(const T* t) {
+ return t->parent_id >= 0 ? Node(t->parent_id) : nullptr;
+ }
+ const T* parent(const T* t) const {
+ return t->parent_id >= 0 ? Node(t->parent_id) : nullptr;
+ }
T* back() { return size() ? &nodes_.back() : nullptr; }
const T* back() const { return size() ? &nodes_.back() : nullptr; }
@@ -129,6 +137,13 @@ class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> {
~TransformTree();
TransformTree& operator=(const TransformTree&);
+ // Transform tree requires a dummy node 0 representing device space. The root
+ // node of transform tree with real information is node 1, unlike all other
+ // property trees. When transform tree is created, it is created with dummy
+ // node 0.
+ static const int kDeviceNodeId = 0;
+ static const int kRootNodeId = 1;
+
bool operator==(const TransformTree& other) const;
int Insert(const TransformNode& tree_node, int parent_id);
@@ -309,6 +324,8 @@ class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> {
class CC_EXPORT ClipTree final : public PropertyTree<ClipNode> {
public:
+ static const int kViewportNodeId = 0;
+
bool operator==(const ClipTree& other) const;
void SetViewportClip(gfx::RectF viewport_rect);
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | cc/trees/property_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698