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

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

Issue 1697613002: cc :: Move tracking of layer_property_changed to main thread (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 layer->SetDebugInfo(debug_info_); 699 layer->SetDebugInfo(debug_info_);
700 700
701 if (frame_timing_requests_dirty_) { 701 if (frame_timing_requests_dirty_) {
702 layer->SetFrameTimingRequests(frame_timing_requests_); 702 layer->SetFrameTimingRequests(frame_timing_requests_);
703 frame_timing_requests_dirty_ = false; 703 frame_timing_requests_dirty_ = false;
704 } 704 }
705 705
706 // Reset any state that should be cleared for the next update. 706 // Reset any state that should be cleared for the next update.
707 stacking_order_changed_ = false; 707 stacking_order_changed_ = false;
708 layer_property_changed_ = false; 708 layer_property_changed_ = false;
709 if (TransformNode* transform_node =
710 layer_tree_impl_->property_trees()->transform_tree.Node(
711 transform_tree_index())) {
712 transform_node->data.transform_changed = false;
ajuma 2016/02/12 23:57:03 Same comment as in Layer::PushProperties.
jaydasika 2016/02/16 22:30:36 Done.
713 }
709 update_rect_ = gfx::Rect(); 714 update_rect_ = gfx::Rect();
710 needs_push_properties_ = false; 715 needs_push_properties_ = false;
711 num_dependents_need_push_properties_ = 0; 716 num_dependents_need_push_properties_ = 0;
712 } 717 }
713 718
714 bool LayerImpl::IsAffectedByPageScale() const { 719 bool LayerImpl::IsAffectedByPageScale() const {
715 TransformTree& transform_tree = 720 TransformTree& transform_tree =
716 layer_tree_impl()->property_trees()->transform_tree; 721 layer_tree_impl()->property_trees()->transform_tree;
717 return transform_tree.Node(transform_tree_index()) 722 return transform_tree.Node(transform_tree_index())
718 ->data.in_subtree_of_page_scale_layer; 723 ->data.in_subtree_of_page_scale_layer;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 return result; 776 return result;
772 } 777 }
773 778
774 void LayerImpl::SetStackingOrderChanged(bool stacking_order_changed) { 779 void LayerImpl::SetStackingOrderChanged(bool stacking_order_changed) {
775 if (stacking_order_changed) { 780 if (stacking_order_changed) {
776 stacking_order_changed_ = true; 781 stacking_order_changed_ = true;
777 NoteLayerPropertyChangedForSubtree(); 782 NoteLayerPropertyChangedForSubtree();
778 } 783 }
779 } 784 }
780 785
786 bool LayerImpl::LayerPropertyChanged() const {
787 if (layer_property_changed_)
788 return true;
789 TransformNode* node =
790 layer_tree_impl()->property_trees()->transform_tree.Node(
791 transform_tree_index());
792 if (node && node->data.transform_changed)
793 return true;
794 return false;
795 }
796
781 void LayerImpl::NoteLayerPropertyChanged() { 797 void LayerImpl::NoteLayerPropertyChanged() {
782 layer_property_changed_ = true; 798 layer_property_changed_ = true;
783 layer_tree_impl()->set_needs_update_draw_properties(); 799 layer_tree_impl()->set_needs_update_draw_properties();
784 SetNeedsPushProperties(); 800 SetNeedsPushProperties();
785 } 801 }
786 802
787 void LayerImpl::NoteLayerPropertyChangedForSubtree() { 803 void LayerImpl::NoteLayerPropertyChangedForSubtree() {
788 layer_property_changed_ = true; 804 layer_property_changed_ = true;
789 layer_tree_impl()->set_needs_update_draw_properties(); 805 layer_tree_impl()->set_needs_update_draw_properties();
790 for (size_t i = 0; i < children_.size(); ++i) 806 for (size_t i = 0; i < children_.size(); ++i)
(...skipping 22 matching lines...) Expand all
813 resource_provider->ValidateResource(resource_id); 829 resource_provider->ValidateResource(resource_id);
814 #endif 830 #endif
815 } 831 }
816 832
817 const char* LayerImpl::LayerTypeAsString() const { 833 const char* LayerImpl::LayerTypeAsString() const {
818 return "cc::LayerImpl"; 834 return "cc::LayerImpl";
819 } 835 }
820 836
821 void LayerImpl::ResetAllChangeTrackingForSubtree() { 837 void LayerImpl::ResetAllChangeTrackingForSubtree() {
822 layer_property_changed_ = false; 838 layer_property_changed_ = false;
839 if (TransformNode* transform_node =
840 layer_tree_impl_->property_trees()->transform_tree.Node(
841 transform_tree_index())) {
842 transform_node->data.transform_changed = false;
ajuma 2016/02/12 23:57:03 An alternative to doing this layer-by-layer would
jaydasika 2016/02/16 22:30:36 Done.
843 }
823 844
824 update_rect_.SetRect(0, 0, 0, 0); 845 update_rect_.SetRect(0, 0, 0, 0);
825 damage_rect_.SetRect(0, 0, 0, 0); 846 damage_rect_.SetRect(0, 0, 0, 0);
826 847
827 if (render_surface_) 848 if (render_surface_)
828 render_surface_->ResetPropertyChangedFlag(); 849 render_surface_->ResetPropertyChangedFlag();
829 850
830 if (mask_layer_) 851 if (mask_layer_)
831 mask_layer_->ResetAllChangeTrackingForSubtree(); 852 mask_layer_->ResetAllChangeTrackingForSubtree();
832 853
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 } 1029 }
1009 1030
1010 void LayerImpl::SetBounds(const gfx::Size& bounds) { 1031 void LayerImpl::SetBounds(const gfx::Size& bounds) {
1011 if (bounds_ == bounds) 1032 if (bounds_ == bounds)
1012 return; 1033 return;
1013 1034
1014 bounds_ = bounds; 1035 bounds_ = bounds;
1015 1036
1016 layer_tree_impl()->DidUpdateScrollState(id()); 1037 layer_tree_impl()->DidUpdateScrollState(id());
1017 1038
1018 if (masks_to_bounds()) 1039 if (!masks_to_bounds())
1019 NoteLayerPropertyChangedForSubtree();
1020 else
1021 NoteLayerPropertyChanged(); 1040 NoteLayerPropertyChanged();
ajuma 2016/02/12 23:57:03 Is this still needed? LayerImpl::SetBounds should
jaydasika 2016/02/16 22:30:36 In Layer, we set SubtreePropertyChanged to true on
ajuma 2016/02/16 22:55:50 Ah, makes sense. Please add a comment about this (
jaydasika 2016/02/17 02:00:15 Forgot adding a comment here, will add it in the n
1022 } 1041 }
1023 1042
1024 void LayerImpl::SetBoundsDelta(const gfx::Vector2dF& bounds_delta) { 1043 void LayerImpl::SetBoundsDelta(const gfx::Vector2dF& bounds_delta) {
1025 DCHECK(IsActive()); 1044 DCHECK(IsActive());
1026 if (bounds_delta_ == bounds_delta) 1045 if (bounds_delta_ == bounds_delta)
1027 return; 1046 return;
1028 1047
1029 bounds_delta_ = bounds_delta; 1048 bounds_delta_ = bounds_delta;
1030 1049
1031 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); 1050 PropertyTrees* property_trees = layer_tree_impl()->property_trees();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 if (hide_layer_and_subtree_ == hide) 1131 if (hide_layer_and_subtree_ == hide)
1113 return; 1132 return;
1114 1133
1115 hide_layer_and_subtree_ = hide; 1134 hide_layer_and_subtree_ = hide;
1116 } 1135 }
1117 1136
1118 void LayerImpl::SetTransformOrigin(const gfx::Point3F& transform_origin) { 1137 void LayerImpl::SetTransformOrigin(const gfx::Point3F& transform_origin) {
1119 if (transform_origin_ == transform_origin) 1138 if (transform_origin_ == transform_origin)
1120 return; 1139 return;
1121 transform_origin_ = transform_origin; 1140 transform_origin_ = transform_origin;
1122 NoteLayerPropertyChangedForSubtree();
1123 } 1141 }
1124 1142
1125 void LayerImpl::SetBackgroundColor(SkColor background_color) { 1143 void LayerImpl::SetBackgroundColor(SkColor background_color) {
1126 if (background_color_ == background_color) 1144 if (background_color_ == background_color)
1127 return; 1145 return;
1128 1146
1129 background_color_ = background_color; 1147 background_color_ = background_color;
1130 NoteLayerPropertyChanged(); 1148 NoteLayerPropertyChanged();
1131 } 1149 }
1132 1150
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 1307
1290 is_root_for_isolated_group_ = root; 1308 is_root_for_isolated_group_ = root;
1291 SetNeedsPushProperties(); 1309 SetNeedsPushProperties();
1292 } 1310 }
1293 1311
1294 void LayerImpl::SetPosition(const gfx::PointF& position) { 1312 void LayerImpl::SetPosition(const gfx::PointF& position) {
1295 if (position_ == position) 1313 if (position_ == position)
1296 return; 1314 return;
1297 1315
1298 position_ = position; 1316 position_ = position;
1299 NoteLayerPropertyChangedForSubtree();
1300 } 1317 }
1301 1318
1302 void LayerImpl::SetShouldFlattenTransform(bool flatten) { 1319 void LayerImpl::SetShouldFlattenTransform(bool flatten) {
1303 if (should_flatten_transform_ == flatten) 1320 if (should_flatten_transform_ == flatten)
1304 return; 1321 return;
1305 1322
1306 should_flatten_transform_ = flatten; 1323 should_flatten_transform_ = flatten;
1307 } 1324 }
1308 1325
1309 void LayerImpl::Set3dSortingContextId(int id) { 1326 void LayerImpl::Set3dSortingContextId(int id) {
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 .layer_transforms_should_scale_layer_contents) { 1888 .layer_transforms_should_scale_layer_contents) {
1872 return default_scale; 1889 return default_scale;
1873 } 1890 }
1874 1891
1875 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1892 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1876 DrawTransform(), default_scale); 1893 DrawTransform(), default_scale);
1877 return std::max(transform_scales.x(), transform_scales.y()); 1894 return std::max(transform_scales.x(), transform_scales.y());
1878 } 1895 }
1879 1896
1880 } // namespace cc 1897 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698