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

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

Issue 2755803003: cc: Remove SetNeedsCommitNoRebuild from Layer API (Closed)
Patch Set: rebase from previous commit Created 3 years, 9 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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 T* parent(const T* t) { return Node(t->parent_id); } 76 T* parent(const T* t) { return Node(t->parent_id); }
77 const T* parent(const T* t) const { return Node(t->parent_id); } 77 const T* parent(const T* t) const { return Node(t->parent_id); }
78 78
79 T* back() { return size() ? &nodes_.back() : nullptr; } 79 T* back() { return size() ? &nodes_.back() : nullptr; }
80 const T* back() const { return size() ? &nodes_.back() : nullptr; } 80 const T* back() const { return size() ? &nodes_.back() : nullptr; }
81 81
82 void clear(); 82 void clear();
83 size_t size() const { return nodes_.size(); } 83 size_t size() const { return nodes_.size(); }
84 84
85 void set_needs_update(bool needs_update) { needs_update_ = needs_update; } 85 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.
86 needs_update_ = needs_update;
87 }
86 bool needs_update() const { return needs_update_; } 88 bool needs_update() const { return needs_update_; }
87 89
88 std::vector<T>& nodes() { return nodes_; } 90 std::vector<T>& nodes() { return nodes_; }
89 const std::vector<T>& nodes() const { return nodes_; } 91 const std::vector<T>& nodes() const { return nodes_; }
90 92
91 int next_available_id() const { return static_cast<int>(size()); } 93 int next_available_id() const { return static_cast<int>(size()); }
92 94
93 void SetPropertyTrees(PropertyTrees* property_trees) { 95 void SetPropertyTrees(PropertyTrees* property_trees) {
94 property_trees_ = property_trees; 96 property_trees_ = property_trees;
95 } 97 }
96 PropertyTrees* property_trees() const { return property_trees_; } 98 PropertyTrees* property_trees() const { return property_trees_; }
97 99
98 void AsValueInto(base::trace_event::TracedValue* value) const; 100 void AsValueInto(base::trace_event::TracedValue* value) const;
99 101
100 T* FindNodeFromOwningLayerId(int id) { 102 const T* FindNodeFromOwningLayerId(int id) const {
101 return Node(FindNodeIndexFromOwningLayerId(id)); 103 return Node(FindNodeIndexFromOwningLayerId(id));
102 } 104 }
105 T* UpdateNodeFromOwningLayerId(int id) {
106 int index = FindNodeIndexFromOwningLayerId(id);
107 if (index == kInvalidNodeId) {
108 // DCHECK(property_trees()->is_main_thread);
109 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
110 }
111
112 return Node(index);
113 }
114
103 int FindNodeIndexFromOwningLayerId(int id) const { 115 int FindNodeIndexFromOwningLayerId(int id) const {
104 auto iter = owning_layer_id_to_node_index.find(id); 116 auto iter = owning_layer_id_to_node_index.find(id);
105 if (iter == owning_layer_id_to_node_index.end()) 117 if (iter == owning_layer_id_to_node_index.end())
106 return kInvalidNodeId; 118 return kInvalidNodeId;
107 else 119 else
108 return iter->second; 120 return iter->second;
109 } 121 }
110 122
111 void SetOwningLayerIdForNode(const T* node, int id) { 123 void SetOwningLayerIdForNode(const T* node, int id) {
112 if (!node) { 124 if (!node) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 void ResetChangeTracking(); 188 void ResetChangeTracking();
177 // Updates the parent, target, and screen space transforms and snapping. 189 // Updates the parent, target, and screen space transforms and snapping.
178 void UpdateTransforms(int id); 190 void UpdateTransforms(int id);
179 void UpdateTransformChanged(TransformNode* node, 191 void UpdateTransformChanged(TransformNode* node,
180 TransformNode* parent_node, 192 TransformNode* parent_node,
181 TransformNode* source_node); 193 TransformNode* source_node);
182 void UpdateNodeAndAncestorsAreAnimatedOrInvertible( 194 void UpdateNodeAndAncestorsAreAnimatedOrInvertible(
183 TransformNode* node, 195 TransformNode* node,
184 TransformNode* parent_node); 196 TransformNode* parent_node);
185 197
186 void set_needs_update(bool needs_update); 198 void set_needs_update(bool needs_update) override;
187 199
188 // A TransformNode's source_to_parent value is used to account for the fact 200 // A TransformNode's source_to_parent value is used to account for the fact
189 // that fixed-position layers are positioned by Blink wrt to their layer tree 201 // that fixed-position layers are positioned by Blink wrt to their layer tree
190 // parent (their "source"), but are parented in the transform tree by their 202 // parent (their "source"), but are parented in the transform tree by their
191 // fixed-position container. This value needs to be updated on main-thread 203 // fixed-position container. This value needs to be updated on main-thread
192 // property trees (for position changes initiated by Blink), but not on the 204 // property trees (for position changes initiated by Blink), but not on the
193 // compositor thread (since the offset from a node corresponding to a 205 // compositor thread (since the offset from a node corresponding to a
194 // fixed-position layer to its fixed-position container is unaffected by 206 // fixed-position layer to its fixed-position container is unaffected by
195 // compositor-driven effects). 207 // compositor-driven effects).
196 void set_source_to_parent_updates_allowed(bool allowed) { 208 void set_source_to_parent_updates_allowed(bool allowed) {
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const; 689 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const;
678 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id, 690 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id,
679 int effect_id) const; 691 int effect_id) const;
680 692
681 PropertyTreesCachedData cached_data_; 693 PropertyTreesCachedData cached_data_;
682 }; 694 };
683 695
684 } // namespace cc 696 } // namespace cc
685 697
686 #endif // CC_TREES_PROPERTY_TREE_H_ 698 #endif // CC_TREES_PROPERTY_TREE_H_
OLDNEW
« cc/layers/layer.cc ('K') | « 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