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

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: Fixed formatting Created 6 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
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_(nullptr), 74 scroll_parent_(nullptr),
74 clip_parent_(nullptr), 75 clip_parent_(nullptr),
75 replica_layer_(nullptr), 76 replica_layer_(nullptr),
76 raster_scale_(0.f), 77 raster_scale_(0.f),
77 client_(nullptr) { 78 client_(nullptr) {
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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 } 584 }
584 585
585 void Layer::SetTransformOrigin(const gfx::Point3F& transform_origin) { 586 void Layer::SetTransformOrigin(const gfx::Point3F& transform_origin) {
586 DCHECK(IsPropertyChangeAllowed()); 587 DCHECK(IsPropertyChangeAllowed());
587 if (transform_origin_ == transform_origin) 588 if (transform_origin_ == transform_origin)
588 return; 589 return;
589 transform_origin_ = transform_origin; 590 transform_origin_ = transform_origin;
590 SetNeedsCommit(); 591 SetNeedsCommit();
591 } 592 }
592 593
594 bool Layer::AnimationsPreserveAxisAlignment() const {
595 return layer_animation_controller_->AnimationsPreserveAxisAlignment();
596 }
597
593 bool Layer::TransformIsAnimating() const { 598 bool Layer::TransformIsAnimating() const {
594 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); 599 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform);
595 } 600 }
596 601
597 void Layer::SetScrollParent(Layer* parent) { 602 void Layer::SetScrollParent(Layer* parent) {
598 DCHECK(IsPropertyChangeAllowed()); 603 DCHECK(IsPropertyChangeAllowed());
599 if (scroll_parent_ == parent) 604 if (scroll_parent_ == parent)
600 return; 605 return;
601 606
602 if (scroll_parent_) 607 if (scroll_parent_)
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 TRACE_EVENT_CATEGORY_GROUP_ENABLED( 875 TRACE_EVENT_CATEGORY_GROUP_ENABLED(
871 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT( 876 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT(
872 "devtools.timeline.layers"), 877 "devtools.timeline.layers"),
873 &is_tracing); 878 &is_tracing);
874 if (is_tracing) 879 if (is_tracing)
875 layer->SetDebugInfo(TakeDebugInfo()); 880 layer->SetDebugInfo(TakeDebugInfo());
876 881
877 layer->SetDoubleSided(double_sided_); 882 layer->SetDoubleSided(double_sided_);
878 layer->SetDrawCheckerboardForMissingTiles( 883 layer->SetDrawCheckerboardForMissingTiles(
879 draw_checkerboard_for_missing_tiles_); 884 draw_checkerboard_for_missing_tiles_);
880 layer->SetForceRenderSurface(force_render_surface_);
881 layer->SetDrawsContent(DrawsContent()); 885 layer->SetDrawsContent(DrawsContent());
882 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); 886 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_);
887 layer->SetHasRenderSurface(has_render_surface_);
883 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) 888 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating())
884 layer->SetFilters(filters_); 889 layer->SetFilters(filters_);
885 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly())); 890 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly()));
886 layer->SetBackgroundFilters(background_filters()); 891 layer->SetBackgroundFilters(background_filters());
887 layer->SetMasksToBounds(masks_to_bounds_); 892 layer->SetMasksToBounds(masks_to_bounds_);
888 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); 893 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_);
889 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); 894 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_);
890 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_); 895 layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_);
891 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); 896 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
892 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); 897 layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 return true; 1078 return true;
1074 } 1079 }
1075 1080
1076 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() { 1081 scoped_refptr<base::debug::ConvertableToTraceFormat> Layer::TakeDebugInfo() {
1077 if (client_) 1082 if (client_)
1078 return client_->TakeDebugInfo(); 1083 return client_->TakeDebugInfo();
1079 else 1084 else
1080 return nullptr; 1085 return nullptr;
1081 } 1086 }
1082 1087
1088 void Layer::SetHasRenderSurface(bool has_render_surface) {
1089 if (has_render_surface_ == has_render_surface)
1090 return;
1091 has_render_surface_ = has_render_surface;
1092 // We do not need SetNeedsCommit here, since this is only ever called
1093 // during a commit, from CalculateDrawProperties.
1094 SetNeedsPushProperties();
1095 }
1096
1083 void Layer::CreateRenderSurface() { 1097 void Layer::CreateRenderSurface() {
1084 DCHECK(!draw_properties_.render_surface); 1098 DCHECK(!render_surface_);
1085 draw_properties_.render_surface = make_scoped_ptr(new RenderSurface(this)); 1099 render_surface_ = make_scoped_ptr(new RenderSurface(this));
1086 draw_properties_.render_target = this;
1087 } 1100 }
1088 1101
1089 void Layer::ClearRenderSurface() { 1102 void Layer::ClearRenderSurface() {
1090 draw_properties_.render_surface = nullptr; 1103 render_surface_ = nullptr;
1091 } 1104 }
1092 1105
1093 void Layer::ClearRenderSurfaceLayerList() { 1106 void Layer::ClearRenderSurfaceLayerList() {
1094 if (draw_properties_.render_surface) 1107 if (render_surface_)
1095 draw_properties_.render_surface->layer_list().clear(); 1108 render_surface_->layer_list().clear();
1096 } 1109 }
1097 1110
1098 gfx::ScrollOffset Layer::ScrollOffsetForAnimation() const { 1111 gfx::ScrollOffset Layer::ScrollOffsetForAnimation() const {
1099 return TotalScrollOffset(); 1112 return TotalScrollOffset();
1100 } 1113 }
1101 1114
1102 // On<Property>Animated is called due to an ongoing accelerated animation. 1115 // On<Property>Animated is called due to an ongoing accelerated animation.
1103 // Since this animation is also being run on the compositor thread, there 1116 // Since this animation is also being run on the compositor thread, there
1104 // is no need to request a commit to push this value over, so the value is 1117 // is no need to request a commit to push this value over, so the value is
1105 // set directly rather than by calling Set<Property>. 1118 // set directly rather than by calling Set<Property>.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 1248
1236 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { 1249 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) {
1237 benchmark->RunOnLayer(this); 1250 benchmark->RunOnLayer(this);
1238 } 1251 }
1239 1252
1240 bool Layer::HasDelegatedContent() const { 1253 bool Layer::HasDelegatedContent() const {
1241 return false; 1254 return false;
1242 } 1255 }
1243 1256
1244 } // namespace cc 1257 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698