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

Unified 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 side-by-side diff with in-line comments
Download patch
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
« 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