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

Side by Side Diff: cc/layers/layer_impl.cc

Issue 2053983003: cc : Move LayerImpl::parent to test properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 6 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/layers/layer_impl.h ('k') | cc/layers/layer_impl_test_properties.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "cc/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 26 matching lines...) Expand all
37 #include "cc/trees/proxy.h" 37 #include "cc/trees/proxy.h"
38 #include "ui/gfx/geometry/box_f.h" 38 #include "ui/gfx/geometry/box_f.h"
39 #include "ui/gfx/geometry/point_conversions.h" 39 #include "ui/gfx/geometry/point_conversions.h"
40 #include "ui/gfx/geometry/quad_f.h" 40 #include "ui/gfx/geometry/quad_f.h"
41 #include "ui/gfx/geometry/rect_conversions.h" 41 #include "ui/gfx/geometry/rect_conversions.h"
42 #include "ui/gfx/geometry/size_conversions.h" 42 #include "ui/gfx/geometry/size_conversions.h"
43 #include "ui/gfx/geometry/vector2d_conversions.h" 43 #include "ui/gfx/geometry/vector2d_conversions.h"
44 44
45 namespace cc { 45 namespace cc {
46 LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id) 46 LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id)
47 : parent_(nullptr), 47 : layer_id_(id),
48 layer_id_(id),
49 layer_tree_impl_(tree_impl), 48 layer_tree_impl_(tree_impl),
50 test_properties_(nullptr), 49 test_properties_(nullptr),
51 scroll_clip_layer_id_(Layer::INVALID_ID), 50 scroll_clip_layer_id_(Layer::INVALID_ID),
52 main_thread_scrolling_reasons_( 51 main_thread_scrolling_reasons_(
53 MainThreadScrollingReason::kNotScrollingOnMain), 52 MainThreadScrollingReason::kNotScrollingOnMain),
54 user_scrollable_horizontal_(true), 53 user_scrollable_horizontal_(true),
55 user_scrollable_vertical_(true), 54 user_scrollable_vertical_(true),
56 should_flatten_transform_from_property_tree_(false), 55 should_flatten_transform_from_property_tree_(false),
57 layer_property_changed_(false), 56 layer_property_changed_(false),
58 masks_to_bounds_(false), 57 masks_to_bounds_(false),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 layer_tree_impl_->UnregisterLayer(this); 94 layer_tree_impl_->UnregisterLayer(this);
96 layer_tree_impl_->RemoveLayerShouldPushProperties(this); 95 layer_tree_impl_->RemoveLayerShouldPushProperties(this);
97 96
98 layer_tree_impl_->RemoveFromElementMap(this); 97 layer_tree_impl_->RemoveFromElementMap(this);
99 98
100 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 99 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
101 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); 100 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this);
102 } 101 }
103 102
104 void LayerImpl::AddChild(std::unique_ptr<LayerImpl> child) { 103 void LayerImpl::AddChild(std::unique_ptr<LayerImpl> child) {
105 child->SetParent(this); 104 child->test_properties()->parent = this;
106 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl()); 105 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl());
107 test_properties()->children.push_back(child.get()); 106 test_properties()->children.push_back(child.get());
108 layer_tree_impl_->AddLayer(std::move(child)); 107 layer_tree_impl_->AddLayer(std::move(child));
109 } 108 }
110 109
111 std::unique_ptr<LayerImpl> LayerImpl::RemoveChildForTesting(LayerImpl* child) { 110 std::unique_ptr<LayerImpl> LayerImpl::RemoveChildForTesting(LayerImpl* child) {
112 auto it = std::find(test_properties()->children.begin(), 111 auto it = std::find(test_properties()->children.begin(),
113 test_properties()->children.end(), child); 112 test_properties()->children.end(), child);
114 if (it != test_properties()->children.end()) 113 if (it != test_properties()->children.end())
115 test_properties()->children.erase(it); 114 test_properties()->children.erase(it);
116 layer_tree_impl()->property_trees()->RemoveIdFromIdToIndexMaps(child->id()); 115 layer_tree_impl()->property_trees()->RemoveIdFromIdToIndexMaps(child->id());
117 return layer_tree_impl_->RemoveLayer(child->id()); 116 return layer_tree_impl_->RemoveLayer(child->id());
118 } 117 }
119 118
120 void LayerImpl::SetParent(LayerImpl* parent) {
121 parent_ = parent;
122 }
123
124 void LayerImpl::SetHasWillChangeTransformHint(bool has_will_change) { 119 void LayerImpl::SetHasWillChangeTransformHint(bool has_will_change) {
125 if (has_will_change_transform_hint_ == has_will_change) 120 if (has_will_change_transform_hint_ == has_will_change)
126 return; 121 return;
127 has_will_change_transform_hint_ = has_will_change; 122 has_will_change_transform_hint_ = has_will_change;
128 SetNeedsPushProperties(); 123 SetNeedsPushProperties();
129 } 124 }
130 125
131 void LayerImpl::SetDebugInfo( 126 void LayerImpl::SetDebugInfo(
132 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info) { 127 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info) {
133 owned_debug_info_ = std::move(debug_info); 128 owned_debug_info_ = std::move(debug_info);
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 .layer_transforms_should_scale_layer_contents) { 1257 .layer_transforms_should_scale_layer_contents) {
1263 return default_scale; 1258 return default_scale;
1264 } 1259 }
1265 1260
1266 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1261 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1267 ScreenSpaceTransform(), default_scale); 1262 ScreenSpaceTransform(), default_scale);
1268 return std::max(transform_scales.x(), transform_scales.y()); 1263 return std::max(transform_scales.x(), transform_scales.y());
1269 } 1264 }
1270 1265
1271 } // namespace cc 1266 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_test_properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698