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

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

Issue 1715973002: cc: Move tracking of layer_property_changed to main thread (3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove LayerImpl::stacking_order_changed Created 4 years, 10 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 | « no previous file | cc/layers/layer_impl.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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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.h" 5 #include "cc/layers/layer.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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 void Layer::AddChild(scoped_refptr<Layer> child) { 284 void Layer::AddChild(scoped_refptr<Layer> child) {
285 InsertChild(child, children_.size()); 285 InsertChild(child, children_.size());
286 } 286 }
287 287
288 void Layer::InsertChild(scoped_refptr<Layer> child, size_t index) { 288 void Layer::InsertChild(scoped_refptr<Layer> child, size_t index) {
289 DCHECK(IsPropertyChangeAllowed()); 289 DCHECK(IsPropertyChangeAllowed());
290 child->RemoveFromParent(); 290 child->RemoveFromParent();
291 AddDrawableDescendants(child->NumDescendantsThatDrawContent() + 291 AddDrawableDescendants(child->NumDescendantsThatDrawContent() +
292 (child->DrawsContent() ? 1 : 0)); 292 (child->DrawsContent() ? 1 : 0));
293 child->SetParent(this); 293 child->SetParent(this);
294 child->stacking_order_changed_ = true; 294 child->stacking_order_changed_ = true;
ajuma 2016/02/22 20:43:09 Is Layer::stacking_order_changed_ unused now that
295 child->SetSubtreePropertyChanged();
295 296
296 index = std::min(index, children_.size()); 297 index = std::min(index, children_.size());
297 children_.insert(children_.begin() + index, child); 298 children_.insert(children_.begin() + index, child);
298 SetNeedsFullTreeSync(); 299 SetNeedsFullTreeSync();
299 } 300 }
300 301
301 void Layer::RemoveFromParent() { 302 void Layer::RemoveFromParent() {
302 DCHECK(IsPropertyChangeAllowed()); 303 DCHECK(IsPropertyChangeAllowed());
303 if (parent_) 304 if (parent_)
304 parent_->RemoveChildOrDependent(this); 305 parent_->RemoveChildOrDependent(this);
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 678
678 inverse *= a; 679 inverse *= a;
679 return inverse.Preserves2dAxisAlignment(); 680 return inverse.Preserves2dAxisAlignment();
680 } 681 }
681 682
682 void Layer::SetTransform(const gfx::Transform& transform) { 683 void Layer::SetTransform(const gfx::Transform& transform) {
683 DCHECK(IsPropertyChangeAllowed()); 684 DCHECK(IsPropertyChangeAllowed());
684 if (transform_ == transform) 685 if (transform_ == transform)
685 return; 686 return;
686 687
688 SetSubtreePropertyChanged();
687 if (layer_tree_host_) { 689 if (layer_tree_host_) {
688 if (TransformNode* transform_node = 690 if (TransformNode* transform_node =
689 layer_tree_host_->property_trees()->transform_tree.Node( 691 layer_tree_host_->property_trees()->transform_tree.Node(
690 transform_tree_index())) { 692 transform_tree_index())) {
691 if (transform_node->owner_id == id()) { 693 if (transform_node->owner_id == id()) {
692 // We need to trigger a rebuild if we could have affected 2d axis 694 // We need to trigger a rebuild if we could have affected 2d axis
693 // alignment. We'll check to see if transform and transform_ are axis 695 // alignment. We'll check to see if transform and transform_ are axis
694 // align with respect to one another. 696 // align with respect to one another.
695 bool invertible = false; 697 bool invertible = false;
696 bool preserves_2d_axis_alignment = 698 bool preserves_2d_axis_alignment =
697 Are2dAxisAligned(transform_, transform, &invertible); 699 Are2dAxisAligned(transform_, transform, &invertible);
698 transform_node->data.local = transform; 700 transform_node->data.local = transform;
699 transform_node->data.needs_local_transform_update = true; 701 transform_node->data.needs_local_transform_update = true;
702 transform_node->data.transform_changed = true;
700 layer_tree_host_->property_trees()->transform_tree.set_needs_update( 703 layer_tree_host_->property_trees()->transform_tree.set_needs_update(
701 true); 704 true);
702 if (preserves_2d_axis_alignment) 705 if (preserves_2d_axis_alignment)
703 SetNeedsCommitNoRebuild(); 706 SetNeedsCommitNoRebuild();
704 else 707 else
705 SetNeedsCommit(); 708 SetNeedsCommit();
706 transform_ = transform; 709 transform_ = transform;
707 transform_is_invertible_ = invertible; 710 transform_is_invertible_ = invertible;
708 return; 711 return;
709 } 712 }
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 layer->PassCopyRequests(&main_thread_copy_requests); 1359 layer->PassCopyRequests(&main_thread_copy_requests);
1357 } 1360 }
1358 1361
1359 // If the main thread commits multiple times before the impl thread actually 1362 // If the main thread commits multiple times before the impl thread actually
1360 // draws, then damage tracking will become incorrect if we simply clobber the 1363 // draws, then damage tracking will become incorrect if we simply clobber the
1361 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. 1364 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e.
1362 // union) any update changes that have occurred on the main thread. 1365 // union) any update changes that have occurred on the main thread.
1363 update_rect_.Union(layer->update_rect()); 1366 update_rect_.Union(layer->update_rect());
1364 layer->SetUpdateRect(update_rect_); 1367 layer->SetUpdateRect(update_rect_);
1365 1368
1366 layer->SetStackingOrderChanged(stacking_order_changed_);
1367
1368 if (layer->layer_animation_controller() && layer_animation_controller_) 1369 if (layer->layer_animation_controller() && layer_animation_controller_)
1369 layer_animation_controller_->PushAnimationUpdatesTo( 1370 layer_animation_controller_->PushAnimationUpdatesTo(
1370 layer->layer_animation_controller()); 1371 layer->layer_animation_controller());
1371 1372
1372 if (frame_timing_requests_dirty_) { 1373 if (frame_timing_requests_dirty_) {
1373 layer->SetFrameTimingRequests(frame_timing_requests_); 1374 layer->SetFrameTimingRequests(frame_timing_requests_);
1374 frame_timing_requests_dirty_ = false; 1375 frame_timing_requests_dirty_ = false;
1375 } 1376 }
1376 1377
1377 // Reset any state that should be cleared for the next update. 1378 // Reset any state that should be cleared for the next update.
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 this, layer_tree_host_->property_trees()->transform_tree); 2071 this, layer_tree_host_->property_trees()->transform_tree);
2071 } 2072 }
2072 2073
2073 gfx::Transform Layer::screen_space_transform() const { 2074 gfx::Transform Layer::screen_space_transform() const {
2074 DCHECK_NE(transform_tree_index_, -1); 2075 DCHECK_NE(transform_tree_index_, -1);
2075 return ScreenSpaceTransformFromPropertyTrees( 2076 return ScreenSpaceTransformFromPropertyTrees(
2076 this, layer_tree_host_->property_trees()->transform_tree); 2077 this, layer_tree_host_->property_trees()->transform_tree);
2077 } 2078 }
2078 2079
2079 } // namespace cc 2080 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698