Chromium Code Reviews| Index: cc/trees/property_tree.h |
| diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h |
| index eea67f77cefc664970bddba85dcc9b1e2436e753..5f03063802e28b79c196ed784163148ddaeaae58 100644 |
| --- a/cc/trees/property_tree.h |
| +++ b/cc/trees/property_tree.h |
| @@ -82,7 +82,9 @@ class CC_EXPORT PropertyTree { |
| void clear(); |
| size_t size() const { return nodes_.size(); } |
| - void set_needs_update(bool needs_update) { needs_update_ = needs_update; } |
| + virtual void set_needs_update(bool needs_update) { |
|
ajuma
2017/03/16 23:42:11
Since we don't ever have a base class pointer, do
ajuma
2017/03/17 00:00:37
Actually, after reading https://codereview.chromiu
weiliangc
2017/03/17 20:58:42
Change the transform tree override to final.
|
| + needs_update_ = needs_update; |
| + } |
| bool needs_update() const { return needs_update_; } |
| std::vector<T>& nodes() { return nodes_; } |
| @@ -97,9 +99,19 @@ class CC_EXPORT PropertyTree { |
| void AsValueInto(base::trace_event::TracedValue* value) const; |
| - T* FindNodeFromOwningLayerId(int id) { |
| + const T* FindNodeFromOwningLayerId(int id) const { |
| return Node(FindNodeIndexFromOwningLayerId(id)); |
| } |
| + T* UpdateNodeFromOwningLayerId(int id) { |
| + int index = FindNodeIndexFromOwningLayerId(id); |
| + if (index == kInvalidNodeId) { |
| + // DCHECK(property_trees()->is_main_thread); |
| + property_trees()->needs_rebuild = true; |
|
ajuma
2017/03/16 23:42:12
Assuming the DCHECK doesn't always hold, this shou
weiliangc
2017/03/17 20:58:42
Talked w/ Ali, can make the DCHECK work if we actu
|
| + } |
| + |
| + return Node(index); |
| + } |
| + |
| int FindNodeIndexFromOwningLayerId(int id) const { |
| auto iter = owning_layer_id_to_node_index.find(id); |
| if (iter == owning_layer_id_to_node_index.end()) |
| @@ -183,7 +195,7 @@ class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> { |
| TransformNode* node, |
| TransformNode* parent_node); |
| - void set_needs_update(bool needs_update); |
| + void set_needs_update(bool needs_update) override; |
| // A TransformNode's source_to_parent value is used to account for the fact |
| // that fixed-position layers are positioned by Blink wrt to their layer tree |