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

Side by Side Diff: cc/trees/property_tree.h

Issue 1139573004: Reset property tree indices when layer is removed from layer tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_TREES_PROPERTY_TREE_H_ 5 #ifndef CC_TREES_PROPERTY_TREE_H_
6 #define CC_TREES_PROPERTY_TREE_H_ 6 #define CC_TREES_PROPERTY_TREE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 typedef TreeNode<float> OpacityNode; 134 typedef TreeNode<float> OpacityNode;
135 135
136 template <typename T> 136 template <typename T>
137 class CC_EXPORT PropertyTree { 137 class CC_EXPORT PropertyTree {
138 public: 138 public:
139 PropertyTree(); 139 PropertyTree();
140 virtual ~PropertyTree(); 140 virtual ~PropertyTree();
141 141
142 int Insert(const T& tree_node, int parent_id); 142 int Insert(const T& tree_node, int parent_id);
143 143
144 T* Node(int i) { return i > -1 ? &nodes_[i] : nullptr; } 144 T* Node(int i) {
145 const T* Node(int i) const { return i > -1 ? &nodes_[i] : nullptr; } 145 CHECK(i < static_cast<int>(nodes_.size()));
ajuma 2015/05/19 20:06:23 I think it's a good idea to land these CHECKs to h
Ian Vollick 2015/05/19 21:11:48 Done.
146 return i > -1 ? &nodes_[i] : nullptr;
147 }
148 const T* Node(int i) const {
149 CHECK(i < static_cast<int>(nodes_.size()));
150 return i > -1 ? &nodes_[i] : nullptr;
151 }
146 152
147 T* parent(const T* t) { return Node(t->parent_id); } 153 T* parent(const T* t) { return Node(t->parent_id); }
148 const T* parent(const T* t) const { return Node(t->parent_id); } 154 const T* parent(const T* t) const { return Node(t->parent_id); }
149 155
150 T* back() { return size() ? &nodes_[nodes_.size() - 1] : nullptr; } 156 T* back() { return size() ? &nodes_[nodes_.size() - 1] : nullptr; }
151 const T* back() const { 157 const T* back() const {
152 return size() ? &nodes_[nodes_.size() - 1] : nullptr; 158 return size() ? &nodes_[nodes_.size() - 1] : nullptr;
153 } 159 }
154 160
155 void clear(); 161 void clear();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 250
245 TransformTree transform_tree; 251 TransformTree transform_tree;
246 OpacityTree opacity_tree; 252 OpacityTree opacity_tree;
247 ClipTree clip_tree; 253 ClipTree clip_tree;
248 bool needs_rebuild; 254 bool needs_rebuild;
249 }; 255 };
250 256
251 } // namespace cc 257 } // namespace cc
252 258
253 #endif // CC_TREES_PROPERTY_TREE_H_ 259 #endif // CC_TREES_PROPERTY_TREE_H_
OLDNEW
« cc/trees/layer_tree_host_common_unittest.cc ('K') | « cc/trees/layer_tree_host_common_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698