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

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

Issue 465853004: Moving RenderSurface creation outside of CalcDrawProps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 draws_content_(false), 60 draws_content_(false),
61 hide_layer_and_subtree_(false), 61 hide_layer_and_subtree_(false),
62 masks_to_bounds_(false), 62 masks_to_bounds_(false),
63 contents_opaque_(false), 63 contents_opaque_(false),
64 double_sided_(true), 64 double_sided_(true),
65 should_flatten_transform_(true), 65 should_flatten_transform_(true),
66 use_parent_backface_visibility_(false), 66 use_parent_backface_visibility_(false),
67 draw_checkerboard_for_missing_tiles_(false), 67 draw_checkerboard_for_missing_tiles_(false),
68 force_render_surface_(false), 68 force_render_surface_(false),
69 transform_is_invertible_(true), 69 transform_is_invertible_(true),
70 has_render_surface_(false),
70 background_color_(0), 71 background_color_(0),
71 opacity_(1.f), 72 opacity_(1.f),
72 blend_mode_(SkXfermode::kSrcOver_Mode), 73 blend_mode_(SkXfermode::kSrcOver_Mode),
73 scroll_parent_(NULL), 74 scroll_parent_(NULL),
74 clip_parent_(NULL), 75 clip_parent_(NULL),
75 replica_layer_(NULL), 76 replica_layer_(NULL),
76 raster_scale_(0.f), 77 raster_scale_(0.f),
77 client_(NULL) { 78 client_(NULL) {
78 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); 79 layer_animation_controller_ = LayerAnimationController::Create(layer_id_);
79 layer_animation_controller_->AddValueObserver(this); 80 layer_animation_controller_->AddValueObserver(this);
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 TRACE_EVENT_CATEGORY_GROUP_ENABLED( 870 TRACE_EVENT_CATEGORY_GROUP_ENABLED(
870 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT( 871 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT(
871 "devtools.timeline.layers"), 872 "devtools.timeline.layers"),
872 &is_tracing); 873 &is_tracing);
873 if (is_tracing) 874 if (is_tracing)
874 layer->SetDebugInfo(TakeDebugInfo()); 875 layer->SetDebugInfo(TakeDebugInfo());
875 876
876 layer->SetDoubleSided(double_sided_); 877 layer->SetDoubleSided(double_sided_);
877 layer->SetDrawCheckerboardForMissingTiles( 878 layer->SetDrawCheckerboardForMissingTiles(
878 draw_checkerboard_for_missing_tiles_); 879 draw_checkerboard_for_missing_tiles_);
879 layer->SetForceRenderSurface(force_render_surface_);
880 layer->SetDrawsContent(DrawsContent()); 880 layer->SetDrawsContent(DrawsContent());
881 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); 881 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_);
882 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) 882 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating())
883 layer->SetFilters(filters_); 883 layer->SetFilters(filters_);
884 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly())); 884 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly()));
885 layer->SetBackgroundFilters(background_filters()); 885 layer->SetBackgroundFilters(background_filters());
886 layer->SetMasksToBounds(masks_to_bounds_); 886 layer->SetMasksToBounds(masks_to_bounds_);
887 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); 887 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_);
888 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); 888 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_);
889 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_); 889 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_);
(...skipping 13 matching lines...) Expand all
903 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); 903 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
904 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) 904 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating())
905 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); 905 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_);
906 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); 906 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly()));
907 layer->Set3dSortingContextId(sorting_context_id_); 907 layer->Set3dSortingContextId(sorting_context_id_);
908 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); 908 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_);
909 909
910 layer->SetScrollClipLayer(scroll_clip_layer_id_); 910 layer->SetScrollClipLayer(scroll_clip_layer_id_);
911 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); 911 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_);
912 layer->set_user_scrollable_vertical(user_scrollable_vertical_); 912 layer->set_user_scrollable_vertical(user_scrollable_vertical_);
913 layer->SetHasRenderSurface(has_render_surface_);
913 914
914 LayerImpl* scroll_parent = NULL; 915 LayerImpl* scroll_parent = NULL;
915 if (scroll_parent_) { 916 if (scroll_parent_) {
916 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); 917 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id());
917 DCHECK(scroll_parent); 918 DCHECK(scroll_parent);
918 } 919 }
919 920
920 layer->SetScrollParent(scroll_parent); 921 layer->SetScrollParent(scroll_parent);
921 if (scroll_children_) { 922 if (scroll_children_) {
922 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; 923 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 return true; 1072 return true;
1072 } 1073 }
1073 1074
1074 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() { 1075 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() {
1075 if (client_) 1076 if (client_)
1076 return client_->TakeDebugInfo(); 1077 return client_->TakeDebugInfo();
1077 else 1078 else
1078 return NULL; 1079 return NULL;
1079 } 1080 }
1080 1081
1082 void Layer::SetHasRenderSurface(bool has_render_surface) {
1083 if (has_render_surface_ == has_render_surface)
1084 return;
1085 has_render_surface_ = has_render_surface;
1086 // We do not need SetNeedsCommit here, since this is only ever called
1087 // during a commit, from CalculateDrawProperties.
1088 SetNeedsPushProperties();
1089 }
1090
1081 void Layer::CreateRenderSurface() { 1091 void Layer::CreateRenderSurface() {
1082 DCHECK(!draw_properties_.render_surface); 1092 DCHECK(!render_surface_);
1083 draw_properties_.render_surface = make_scoped_ptr(new RenderSurface(this)); 1093 render_surface_ = make_scoped_ptr(new RenderSurface(this));
1084 draw_properties_.render_target = this;
1085 } 1094 }
1086 1095
1087 void Layer::ClearRenderSurface() { 1096 void Layer::ClearRenderSurface() {
1088 draw_properties_.render_surface.reset(); 1097 render_surface_.reset();
1089 } 1098 }
1090 1099
1091 void Layer::ClearRenderSurfaceLayerList() { 1100 void Layer::ClearRenderSurfaceLayerList() {
1092 if (draw_properties_.render_surface) 1101 if (render_surface_)
1093 draw_properties_.render_surface->layer_list().clear(); 1102 render_surface_->layer_list().clear();
1094 } 1103 }
1095 1104
1096 gfx::Vector2dF Layer::ScrollOffsetForAnimation() const { 1105 gfx::Vector2dF Layer::ScrollOffsetForAnimation() const {
1097 return TotalScrollOffset(); 1106 return TotalScrollOffset();
1098 } 1107 }
1099 1108
1100 // On<Property>Animated is called due to an ongoing accelerated animation. 1109 // On<Property>Animated is called due to an ongoing accelerated animation.
1101 // Since this animation is also being run on the compositor thread, there 1110 // Since this animation is also being run on the compositor thread, there
1102 // is no need to request a commit to push this value over, so the value is 1111 // is no need to request a commit to push this value over, so the value is
1103 // set directly rather than by calling Set<Property>. 1112 // set directly rather than by calling Set<Property>.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 1246
1238 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { 1247 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) {
1239 benchmark->RunOnLayer(this); 1248 benchmark->RunOnLayer(this);
1240 } 1249 }
1241 1250
1242 bool Layer::HasDelegatedContent() const { 1251 bool Layer::HasDelegatedContent() const {
1243 return false; 1252 return false;
1244 } 1253 }
1245 1254
1246 } // namespace cc 1255 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | cc/layers/layer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698