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

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, 4 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 draws_content_(false), 59 draws_content_(false),
60 hide_layer_and_subtree_(false), 60 hide_layer_and_subtree_(false),
61 masks_to_bounds_(false), 61 masks_to_bounds_(false),
62 contents_opaque_(false), 62 contents_opaque_(false),
63 double_sided_(true), 63 double_sided_(true),
64 should_flatten_transform_(true), 64 should_flatten_transform_(true),
65 use_parent_backface_visibility_(false), 65 use_parent_backface_visibility_(false),
66 draw_checkerboard_for_missing_tiles_(false), 66 draw_checkerboard_for_missing_tiles_(false),
67 force_render_surface_(false), 67 force_render_surface_(false),
68 transform_is_invertible_(true), 68 transform_is_invertible_(true),
69 should_have_render_surface_(false),
69 background_color_(0), 70 background_color_(0),
70 opacity_(1.f), 71 opacity_(1.f),
71 blend_mode_(SkXfermode::kSrcOver_Mode), 72 blend_mode_(SkXfermode::kSrcOver_Mode),
72 scroll_parent_(NULL), 73 scroll_parent_(NULL),
73 clip_parent_(NULL), 74 clip_parent_(NULL),
74 replica_layer_(NULL), 75 replica_layer_(NULL),
75 raster_scale_(0.f), 76 raster_scale_(0.f),
76 client_(NULL) { 77 client_(NULL) {
77 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); 78 layer_animation_controller_ = LayerAnimationController::Create(layer_id_);
78 layer_animation_controller_->AddValueObserver(this); 79 layer_animation_controller_->AddValueObserver(this);
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); 903 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
903 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) 904 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating())
904 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); 905 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_);
905 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); 906 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly()));
906 layer->Set3dSortingContextId(sorting_context_id_); 907 layer->Set3dSortingContextId(sorting_context_id_);
907 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); 908 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_);
908 909
909 layer->SetScrollClipLayer(scroll_clip_layer_id_); 910 layer->SetScrollClipLayer(scroll_clip_layer_id_);
910 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); 911 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_);
911 layer->set_user_scrollable_vertical(user_scrollable_vertical_); 912 layer->set_user_scrollable_vertical(user_scrollable_vertical_);
913 layer->SetShouldHaveRenderSurface(ShouldHaveRenderSurface());
912 914
913 LayerImpl* scroll_parent = NULL; 915 LayerImpl* scroll_parent = NULL;
914 if (scroll_parent_) { 916 if (scroll_parent_) {
915 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); 917 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id());
916 DCHECK(scroll_parent); 918 DCHECK(scroll_parent);
917 } 919 }
918 920
919 layer->SetScrollParent(scroll_parent); 921 layer->SetScrollParent(scroll_parent);
920 if (scroll_children_) { 922 if (scroll_children_) {
921 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; 923 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 } 1073 }
1072 1074
1073 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() { 1075 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() {
1074 if (client_) 1076 if (client_)
1075 return client_->TakeDebugInfo(); 1077 return client_->TakeDebugInfo();
1076 else 1078 else
1077 return NULL; 1079 return NULL;
1078 } 1080 }
1079 1081
1080 void Layer::CreateRenderSurface() { 1082 void Layer::CreateRenderSurface() {
1081 DCHECK(!draw_properties_.render_surface); 1083 DCHECK(!render_surface_);
1082 draw_properties_.render_surface = make_scoped_ptr(new RenderSurface(this)); 1084 render_surface_ = make_scoped_ptr(new RenderSurface(this));
1083 draw_properties_.render_target = this; 1085 draw_properties_.render_target = this;
1084 } 1086 }
1085 1087
1086 void Layer::ClearRenderSurface() { 1088 void Layer::ClearRenderSurface() {
1087 draw_properties_.render_surface.reset(); 1089 render_surface_.reset();
1088 } 1090 }
1089 1091
1090 void Layer::ClearRenderSurfaceLayerList() { 1092 void Layer::ClearRenderSurfaceLayerList() {
1091 if (draw_properties_.render_surface) 1093 if (render_surface_)
1092 draw_properties_.render_surface->layer_list().clear(); 1094 render_surface_->layer_list().clear();
1093 } 1095 }
1094 1096
1095 gfx::Vector2dF Layer::ScrollOffsetForAnimation() const { 1097 gfx::Vector2dF Layer::ScrollOffsetForAnimation() const {
1096 return TotalScrollOffset(); 1098 return TotalScrollOffset();
1097 } 1099 }
1098 1100
1099 // On<Property>Animated is called due to an ongoing accelerated animation. 1101 // On<Property>Animated is called due to an ongoing accelerated animation.
1100 // Since this animation is also being run on the compositor thread, there 1102 // Since this animation is also being run on the compositor thread, there
1101 // is no need to request a commit to push this value over, so the value is 1103 // is no need to request a commit to push this value over, so the value is
1102 // set directly rather than by calling Set<Property>. 1104 // set directly rather than by calling Set<Property>.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 } 1237 }
1236 1238
1237 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { 1239 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) {
1238 benchmark->RunOnLayer(this); 1240 benchmark->RunOnLayer(this);
1239 } 1241 }
1240 1242
1241 bool Layer::HasDelegatedContent() const { 1243 bool Layer::HasDelegatedContent() const {
1242 return false; 1244 return false;
1243 } 1245 }
1244 1246
1247 void Layer::SetShouldHaveRenderSurface(bool should_have) {
1248 if (should_have_render_surface_ == should_have)
1249 return;
1250 should_have_render_surface_ = should_have;
1251 SetNeedsPushProperties();
1252 }
1253
1254 void Layer::SetRenderSurfaceActive(bool active) {
1255 if (active) {
1256 if (!render_surface_)
1257 CreateRenderSurface();
1258 return;
1259 }
1260 ClearRenderSurface();
1261 }
1262
1245 } // namespace cc 1263 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | cc/trees/layer_tree_host_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698