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

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

Issue 60083018: Don't PushProperties every commit for animating layers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/layer.h ('k') | 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 920
921 layer->SetStackingOrderChanged(stacking_order_changed_); 921 layer->SetStackingOrderChanged(stacking_order_changed_);
922 922
923 layer_animation_controller_->PushAnimationUpdatesTo( 923 layer_animation_controller_->PushAnimationUpdatesTo(
924 layer->layer_animation_controller()); 924 layer->layer_animation_controller());
925 925
926 // Reset any state that should be cleared for the next update. 926 // Reset any state that should be cleared for the next update.
927 stacking_order_changed_ = false; 927 stacking_order_changed_ = false;
928 update_rect_ = gfx::RectF(); 928 update_rect_ = gfx::RectF();
929 929
930 // Animating layers require further push properties to clean up the animation. 930 needs_push_properties_ = false;
931 // crbug.com/259088
932 needs_push_properties_ = layer_animation_controller_->has_any_animation();
933 num_dependents_need_push_properties_ = 0; 931 num_dependents_need_push_properties_ = 0;
934 } 932 }
935 933
936 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) { 934 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
937 return LayerImpl::Create(tree_impl, layer_id_); 935 return LayerImpl::Create(tree_impl, layer_id_);
938 } 936 }
939 937
940 bool Layer::DrawsContent() const { 938 bool Layer::DrawsContent() const {
941 return is_drawable_; 939 return is_drawable_;
942 } 940 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 } 989 }
992 990
993 void Layer::OnOpacityAnimated(float opacity) { 991 void Layer::OnOpacityAnimated(float opacity) {
994 opacity_ = opacity; 992 opacity_ = opacity;
995 } 993 }
996 994
997 void Layer::OnTransformAnimated(const gfx::Transform& transform) { 995 void Layer::OnTransformAnimated(const gfx::Transform& transform) {
998 transform_ = transform; 996 transform_ = transform;
999 } 997 }
1000 998
999 void Layer::OnAnimationWaitingForDeletion() {
1000 // Animations are only deleted during PushProperties.
1001 SetNeedsPushProperties();
1002 }
1003
1001 bool Layer::IsActive() const { 1004 bool Layer::IsActive() const {
1002 return true; 1005 return true;
1003 } 1006 }
1004 1007
1005 bool Layer::AddAnimation(scoped_ptr <Animation> animation) { 1008 bool Layer::AddAnimation(scoped_ptr <Animation> animation) {
1006 if (!layer_animation_controller_->animation_registrar()) 1009 if (!layer_animation_controller_->animation_registrar())
1007 return false; 1010 return false;
1008 1011
1009 UMA_HISTOGRAM_BOOLEAN("Renderer.AnimationAddedToOrphanLayer", 1012 UMA_HISTOGRAM_BOOLEAN("Renderer.AnimationAddedToOrphanLayer",
1010 !layer_tree_host_); 1013 !layer_tree_host_);
1011 layer_animation_controller_->AddAnimation(animation.Pass()); 1014 layer_animation_controller_->AddAnimation(animation.Pass());
1012 SetNeedsCommit(); 1015 SetNeedsCommit();
1013 return true; 1016 return true;
1014 } 1017 }
1015 1018
1016 void Layer::PauseAnimation(int animation_id, double time_offset) { 1019 void Layer::PauseAnimation(int animation_id, double time_offset) {
1017 layer_animation_controller_->PauseAnimation(animation_id, time_offset); 1020 layer_animation_controller_->PauseAnimation(animation_id, time_offset);
1018 SetNeedsCommit(); 1021 SetNeedsCommit();
1019 } 1022 }
1020 1023
1021 void Layer::RemoveAnimation(int animation_id) { 1024 void Layer::RemoveAnimation(int animation_id) {
1022 layer_animation_controller_->RemoveAnimation(animation_id); 1025 layer_animation_controller_->RemoveAnimation(animation_id);
1023 SetNeedsCommit(); 1026 SetNeedsCommit();
1024 } 1027 }
1025 1028
1026 void Layer::SetLayerAnimationControllerForTest( 1029 void Layer::SetLayerAnimationControllerForTest(
1027 scoped_refptr<LayerAnimationController> controller) { 1030 scoped_refptr<LayerAnimationController> controller) {
1028 layer_animation_controller_->RemoveValueObserver(this); 1031 layer_animation_controller_->RemoveValueObserver(this);
1029 layer_animation_controller_ = controller; 1032 layer_animation_controller_ = controller;
1030 layer_animation_controller_->set_force_sync();
1031 layer_animation_controller_->AddValueObserver(this); 1033 layer_animation_controller_->AddValueObserver(this);
1032 SetNeedsCommit(); 1034 SetNeedsCommit();
1033 } 1035 }
1034 1036
1035 bool Layer::HasActiveAnimation() const { 1037 bool Layer::HasActiveAnimation() const {
1036 return layer_animation_controller_->HasActiveAnimation(); 1038 return layer_animation_controller_->HasActiveAnimation();
1037 } 1039 }
1038 1040
1039 void Layer::AddLayerAnimationEventObserver( 1041 void Layer::AddLayerAnimationEventObserver(
1040 LayerAnimationEventObserver* animation_observer) { 1042 LayerAnimationEventObserver* animation_observer) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 clip_parent_->RemoveClipChild(this); 1090 clip_parent_->RemoveClipChild(this);
1089 1091
1090 clip_parent_ = NULL; 1092 clip_parent_ = NULL;
1091 } 1093 }
1092 1094
1093 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { 1095 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) {
1094 benchmark->RunOnLayer(this); 1096 benchmark->RunOnLayer(this);
1095 } 1097 }
1096 1098
1097 } // namespace cc 1099 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698