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

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
« no previous file with comments | « ui/compositor/layer_animator.h ('k') | ui/compositor/scoped_layer_animation_settings.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 (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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 if (observers_.might_have_observers()) { 791 if (observers_.might_have_observers()) {
797 ObserverListBase<LayerAnimationObserver>::Iterator it(observers_); 792 ObserverListBase<LayerAnimationObserver>::Iterator it(observers_);
798 LayerAnimationObserver* obs; 793 LayerAnimationObserver* obs;
799 while ((obs = it.GetNext()) != NULL) { 794 while ((obs = it.GetNext()) != NULL) {
800 sequence->AddObserver(obs); 795 sequence->AddObserver(obs);
801 } 796 }
802 } 797 }
803 sequence->OnScheduled(); 798 sequence->OnScheduled();
804 } 799 }
805 800
806 void LayerAnimator::SetTransitionDuration(base::TimeDelta duration) { 801 base::TimeDelta LayerAnimator::GetTransitionDuration() const {
807 if (is_transition_duration_locked_) 802 return transition_duration_;
808 return;
809 transition_duration_ = duration;
810 } 803 }
811 804
812 void LayerAnimator::ClearAnimationsInternal() { 805 void LayerAnimator::ClearAnimationsInternal() {
813 PurgeDeletedAnimations(); 806 PurgeDeletedAnimations();
814 807
815 // Abort should never affect the set of running animations, but just in case 808 // Abort should never affect the set of running animations, but just in case
816 // clients are badly behaved, we will use a copy of the running animations. 809 // clients are badly behaved, we will use a copy of the running animations.
817 RunningAnimations running_animations_copy = running_animations_; 810 RunningAnimations running_animations_copy = running_animations_;
818 for (size_t i = 0; i < running_animations_copy.size(); ++i) { 811 for (size_t i = 0; i < running_animations_copy.size(); ++i) {
819 if (!SAFE_INVOKE_BOOL(HasAnimation, running_animations_copy[i])) 812 if (!SAFE_INVOKE_BOOL(HasAnimation, running_animations_copy[i]))
(...skipping 21 matching lines...) Expand all
841 } 834 }
842 835
843 LayerAnimator::RunningAnimation::RunningAnimation( 836 LayerAnimator::RunningAnimation::RunningAnimation(
844 const base::WeakPtr<LayerAnimationSequence>& sequence) 837 const base::WeakPtr<LayerAnimationSequence>& sequence)
845 : sequence_(sequence) { 838 : sequence_(sequence) {
846 } 839 }
847 840
848 LayerAnimator::RunningAnimation::~RunningAnimation() { } 841 LayerAnimator::RunningAnimation::~RunningAnimation() { }
849 842
850 } // namespace ui 843 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer_animator.h ('k') | ui/compositor/scoped_layer_animation_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698