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

Side by Side Diff: ui/compositor/layer_animator.cc

Issue 105673008: Remove unneeded ScopedLayerAnimationSettings::LockTransitionDuration() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/compositor/layer_animator.h" 5 #include "ui/compositor/layer_animator.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "cc/animation/animation_id_provider.h" 10 #include "cc/animation/animation_id_provider.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 return container; 48 return container;
49 } 49 }
50 50
51 } // namespace 51 } // namespace
52 52
53 // LayerAnimator public -------------------------------------------------------- 53 // LayerAnimator public --------------------------------------------------------
54 54
55 LayerAnimator::LayerAnimator(base::TimeDelta transition_duration) 55 LayerAnimator::LayerAnimator(base::TimeDelta transition_duration)
56 : delegate_(NULL), 56 : delegate_(NULL),
57 preemption_strategy_(IMMEDIATELY_SET_NEW_TARGET), 57 preemption_strategy_(IMMEDIATELY_SET_NEW_TARGET),
58 is_transition_duration_locked_(false),
59 transition_duration_(transition_duration), 58 transition_duration_(transition_duration),
60 tween_type_(gfx::Tween::LINEAR), 59 tween_type_(gfx::Tween::LINEAR),
61 is_started_(false), 60 is_started_(false),
62 disable_timer_for_test_(false), 61 disable_timer_for_test_(false),
63 adding_animations_(false) { 62 adding_animations_(false) {
64 } 63 }
65 64
66 LayerAnimator::~LayerAnimator() { 65 LayerAnimator::~LayerAnimator() {
67 for (size_t i = 0; i < running_animations_.size(); ++i) { 66 for (size_t i = 0; i < running_animations_.size(); ++i) {
68 if (running_animations_[i].is_sequence_alive()) 67 if (running_animations_[i].is_sequence_alive())
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 111
113 ANIMATED_PROPERTY( 112 ANIMATED_PROPERTY(
114 const gfx::Transform&, TRANSFORM, Transform, gfx::Transform, transform); 113 const gfx::Transform&, TRANSFORM, Transform, gfx::Transform, transform);
115 ANIMATED_PROPERTY(const gfx::Rect&, BOUNDS, Bounds, gfx::Rect, bounds); 114 ANIMATED_PROPERTY(const gfx::Rect&, BOUNDS, Bounds, gfx::Rect, bounds);
116 ANIMATED_PROPERTY(float, OPACITY, Opacity, float, opacity); 115 ANIMATED_PROPERTY(float, OPACITY, Opacity, float, opacity);
117 ANIMATED_PROPERTY(bool, VISIBILITY, Visibility, bool, visibility); 116 ANIMATED_PROPERTY(bool, VISIBILITY, Visibility, bool, visibility);
118 ANIMATED_PROPERTY(float, BRIGHTNESS, Brightness, float, brightness); 117 ANIMATED_PROPERTY(float, BRIGHTNESS, Brightness, float, brightness);
119 ANIMATED_PROPERTY(float, GRAYSCALE, Grayscale, float, grayscale); 118 ANIMATED_PROPERTY(float, GRAYSCALE, Grayscale, float, grayscale);
120 ANIMATED_PROPERTY(SkColor, COLOR, Color, SkColor, color); 119 ANIMATED_PROPERTY(SkColor, COLOR, Color, SkColor, color);
121 120
122 base::TimeDelta LayerAnimator::GetTransitionDuration() const {
123 return transition_duration_;
124 }
125
126 void LayerAnimator::SetDelegate(LayerAnimationDelegate* delegate) { 121 void LayerAnimator::SetDelegate(LayerAnimationDelegate* delegate) {
127 delegate_ = delegate; 122 delegate_ = delegate;
128 } 123 }
129 124
130 void LayerAnimator::StartAnimation(LayerAnimationSequence* animation) { 125 void LayerAnimator::StartAnimation(LayerAnimationSequence* animation) {
131 scoped_refptr<LayerAnimator> retain(this); 126 scoped_refptr<LayerAnimator> retain(this);
132 OnScheduled(animation); 127 OnScheduled(animation);
133 if (!StartSequenceImmediately(animation)) { 128 if (!StartSequenceImmediately(animation)) {
134 // Attempt to preempt a running animation. 129 // Attempt to preempt a running animation.
135 switch (preemption_strategy_) { 130 switch (preemption_strategy_) {
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 if (observers_.might_have_observers()) { 803 if (observers_.might_have_observers()) {
809 ObserverListBase<LayerAnimationObserver>::Iterator it(observers_); 804 ObserverListBase<LayerAnimationObserver>::Iterator it(observers_);
810 LayerAnimationObserver* obs; 805 LayerAnimationObserver* obs;
811 while ((obs = it.GetNext()) != NULL) { 806 while ((obs = it.GetNext()) != NULL) {
812 sequence->AddObserver(obs); 807 sequence->AddObserver(obs);
813 } 808 }
814 } 809 }
815 sequence->OnScheduled(); 810 sequence->OnScheduled();
816 } 811 }
817 812
818 void LayerAnimator::SetTransitionDuration(base::TimeDelta duration) { 813 base::TimeDelta LayerAnimator::GetTransitionDuration() const {
819 if (is_transition_duration_locked_) 814 return transition_duration_;
820 return;
821 transition_duration_ = duration;
822 } 815 }
823 816
824 void LayerAnimator::ClearAnimationsInternal() { 817 void LayerAnimator::ClearAnimationsInternal() {
825 PurgeDeletedAnimations(); 818 PurgeDeletedAnimations();
826 819
827 // Abort should never affect the set of running animations, but just in case 820 // Abort should never affect the set of running animations, but just in case
828 // clients are badly behaved, we will use a copy of the running animations. 821 // clients are badly behaved, we will use a copy of the running animations.
829 RunningAnimations running_animations_copy = running_animations_; 822 RunningAnimations running_animations_copy = running_animations_;
830 for (size_t i = 0; i < running_animations_copy.size(); ++i) { 823 for (size_t i = 0; i < running_animations_copy.size(); ++i) {
831 if (!SAFE_INVOKE_BOOL(HasAnimation, running_animations_copy[i])) 824 if (!SAFE_INVOKE_BOOL(HasAnimation, running_animations_copy[i]))
(...skipping 21 matching lines...) Expand all
853 } 846 }
854 847
855 LayerAnimator::RunningAnimation::RunningAnimation( 848 LayerAnimator::RunningAnimation::RunningAnimation(
856 const base::WeakPtr<LayerAnimationSequence>& sequence) 849 const base::WeakPtr<LayerAnimationSequence>& sequence)
857 : sequence_(sequence) { 850 : sequence_(sequence) {
858 } 851 }
859 852
860 LayerAnimator::RunningAnimation::~RunningAnimation() { } 853 LayerAnimator::RunningAnimation::~RunningAnimation() { }
861 854
862 } // namespace ui 855 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698