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

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

Issue 2801603010: Convert cc::PropertyTree to use a flat_map. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « cc/trees/property_tree.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return node.id; 63 return node.id;
64 } 64 }
65 65
66 template <typename T> 66 template <typename T>
67 void PropertyTree<T>::clear() { 67 void PropertyTree<T>::clear() {
68 needs_update_ = false; 68 needs_update_ = false;
69 nodes_.clear(); 69 nodes_.clear();
70 nodes_.push_back(T()); 70 nodes_.push_back(T());
71 back()->id = kRootNodeId; 71 back()->id = kRootNodeId;
72 back()->parent_id = kInvalidNodeId; 72 back()->parent_id = kInvalidNodeId;
73 owning_layer_id_to_node_index.clear(); 73 owning_layer_id_to_node_index_.clear();
74 74
75 #if DCHECK_IS_ON() 75 #if DCHECK_IS_ON()
76 PropertyTree<T> tree; 76 PropertyTree<T> tree;
77 DCHECK(tree == *this); 77 DCHECK(tree == *this);
78 #endif 78 #endif
79 } 79 }
80 80
81 template <typename T> 81 template <typename T>
82 bool PropertyTree<T>::operator==(const PropertyTree<T>& other) const { 82 bool PropertyTree<T>::operator==(const PropertyTree<T>& other) const {
83 return nodes_ == other.nodes() && needs_update_ == other.needs_update() && 83 return nodes_ == other.nodes() && needs_update_ == other.needs_update() &&
84 owning_layer_id_to_node_index == other.owning_layer_id_to_node_index; 84 owning_layer_id_to_node_index_ == other.owning_layer_id_to_node_index_;
85 } 85 }
86 86
87 template <typename T> 87 template <typename T>
88 void PropertyTree<T>::AsValueInto(base::trace_event::TracedValue* value) const { 88 void PropertyTree<T>::AsValueInto(base::trace_event::TracedValue* value) const {
89 value->BeginArray("nodes"); 89 value->BeginArray("nodes");
90 for (const auto& node : nodes_) { 90 for (const auto& node : nodes_) {
91 value->BeginDictionary(); 91 value->BeginDictionary();
92 node.AsValueInto(value); 92 node.AsValueInto(value);
93 value->EndDictionary(); 93 value->EndDictionary();
94 } 94 }
(...skipping 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 const EffectNode* effect_node = effect_tree.Node(effect_id); 2111 const EffectNode* effect_node = effect_tree.Node(effect_id);
2112 2112
2113 if (effect_node->surface_contents_scale.x() != 0.0 && 2113 if (effect_node->surface_contents_scale.x() != 0.0 &&
2114 effect_node->surface_contents_scale.y() != 0.0) 2114 effect_node->surface_contents_scale.y() != 0.0)
2115 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), 2115 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(),
2116 1.0 / effect_node->surface_contents_scale.y()); 2116 1.0 / effect_node->surface_contents_scale.y());
2117 return screen_space_transform; 2117 return screen_space_transform;
2118 } 2118 }
2119 2119
2120 } // namespace cc 2120 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/property_tree.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698