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

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

Issue 1547893003: WIP - compositor worker mega patch. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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.cc ('k') | cc/layers/layer_unittest.cc » ('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 <utility> 10 #include <utility>
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 layer_animation_controller_->RemoveValueObserver(this); 125 layer_animation_controller_->RemoveValueObserver(this);
126 layer_animation_controller_->remove_value_provider(this); 126 layer_animation_controller_->remove_value_provider(this);
127 layer_animation_controller_->remove_layer_animation_delegate(this); 127 layer_animation_controller_->remove_layer_animation_delegate(this);
128 } 128 }
129 129
130 if (!copy_requests_.empty() && layer_tree_impl_->IsActiveTree()) 130 if (!copy_requests_.empty() && layer_tree_impl_->IsActiveTree())
131 layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this); 131 layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this);
132 layer_tree_impl_->UnregisterScrollLayer(this); 132 layer_tree_impl_->UnregisterScrollLayer(this);
133 layer_tree_impl_->UnregisterLayer(this); 133 layer_tree_impl_->UnregisterLayer(this);
134 134
135 if (element_id_)
136 layer_tree_impl_->RemoveFromElementMap(this);
137
135 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 138 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
136 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); 139 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this);
137 } 140 }
138 141
139 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) { 142 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) {
140 child->SetParent(this); 143 child->SetParent(this);
141 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl()); 144 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl());
142 children_.push_back(std::move(child)); 145 children_.push_back(std::move(child));
143 layer_tree_impl()->set_needs_update_draw_properties(); 146 layer_tree_impl()->set_needs_update_draw_properties();
144 } 147 }
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 return opacity_animation && opacity_animation->is_impl_only(); 1238 return opacity_animation && opacity_animation->is_impl_only();
1236 } 1239 }
1237 1240
1238 void LayerImpl::SetElementId(uint64_t element_id) { 1241 void LayerImpl::SetElementId(uint64_t element_id) {
1239 if (element_id == element_id_) 1242 if (element_id == element_id_)
1240 return; 1243 return;
1241 1244
1242 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), 1245 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
1243 "LayerImpl::SetElementId", "id", element_id); 1246 "LayerImpl::SetElementId", "id", element_id);
1244 1247
1248 if (element_id_)
1249 layer_tree_impl_->RemoveFromElementMap(this);
1245 element_id_ = element_id; 1250 element_id_ = element_id;
1251 if (element_id_)
1252 layer_tree_impl_->AddToElementMap(this);
1246 SetNeedsPushProperties(); 1253 SetNeedsPushProperties();
1247 } 1254 }
1248 1255
1249 void LayerImpl::SetMutableProperties(uint32_t properties) { 1256 void LayerImpl::SetMutableProperties(uint32_t properties) {
1250 if (mutable_properties_ == properties) 1257 if (mutable_properties_ == properties)
1251 return; 1258 return;
1252 1259
1253 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), 1260 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
1254 "LayerImpl::SetMutableProperties", "properties", properties); 1261 "LayerImpl::SetMutableProperties", "properties", properties);
1255 1262
1256 mutable_properties_ = properties; 1263 mutable_properties_ = properties;
1264 if (element_id_)
1265 layer_tree_impl_->AddToElementMap(this);
1257 SetNeedsPushProperties(); 1266 SetNeedsPushProperties();
1258 } 1267 }
1259 1268
1260 void LayerImpl::SetBlendMode(SkXfermode::Mode blend_mode) { 1269 void LayerImpl::SetBlendMode(SkXfermode::Mode blend_mode) {
1261 if (blend_mode_ == blend_mode) 1270 if (blend_mode_ == blend_mode)
1262 return; 1271 return;
1263 1272
1264 blend_mode_ = blend_mode; 1273 blend_mode_ = blend_mode;
1265 NoteLayerPropertyChangedForSubtree(); 1274 NoteLayerPropertyChangedForSubtree();
1266 } 1275 }
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 gfx::ScrollOffset current_offset = scroll_offset_->Current(IsActive()); 1547 gfx::ScrollOffset current_offset = scroll_offset_->Current(IsActive());
1539 if (node->data.scroll_offset != current_offset) { 1548 if (node->data.scroll_offset != current_offset) {
1540 node->data.scroll_offset = current_offset; 1549 node->data.scroll_offset = current_offset;
1541 node->data.needs_local_transform_update = true; 1550 node->data.needs_local_transform_update = true;
1542 transform_tree.set_needs_update(true); 1551 transform_tree.set_needs_update(true);
1543 } 1552 }
1544 } 1553 }
1545 } 1554 }
1546 1555
1547 void LayerImpl::DidUpdateScrollOffset() { 1556 void LayerImpl::DidUpdateScrollOffset() {
1557 TRACE_EVENT2("compositor-worker,scroll-compensation",
1558 "LayerImpl::DidUpdateScrollOffset", "x",
1559 scroll_offset_->Current(IsActive()).x(), "y",
1560 scroll_offset_->Current(IsActive()).y());
1561
1548 DCHECK(scroll_offset_); 1562 DCHECK(scroll_offset_);
1549 1563
1550 layer_tree_impl()->DidUpdateScrollState(id()); 1564 layer_tree_impl()->DidUpdateScrollState(id());
1551 NoteLayerPropertyChangedForSubtree(); 1565 NoteLayerPropertyChangedForSubtree();
1552 1566
1553 UpdatePropertyTreeScrollOffset(); 1567 UpdatePropertyTreeScrollOffset();
1554 1568
1555 // Inform the pending twin that a property changed. 1569 // Inform the pending twin that a property changed.
1556 if (layer_tree_impl()->IsActiveTree()) { 1570 if (layer_tree_impl()->IsActiveTree()) {
1557 LayerImpl* pending_twin = layer_tree_impl()->FindPendingTreeLayerById(id()); 1571 LayerImpl* pending_twin = layer_tree_impl()->FindPendingTreeLayerById(id());
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 .layer_transforms_should_scale_layer_contents) { 1914 .layer_transforms_should_scale_layer_contents) {
1901 return default_scale; 1915 return default_scale;
1902 } 1916 }
1903 1917
1904 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1918 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1905 DrawTransform(), default_scale); 1919 DrawTransform(), default_scale);
1906 return std::max(transform_scales.x(), transform_scales.y()); 1920 return std::max(transform_scales.x(), transform_scales.y());
1907 } 1921 }
1908 1922
1909 } // namespace cc 1923 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698