Chromium Code Reviews| Index: ui/compositor/layer_animation_element.h |
| diff --git a/ui/compositor/layer_animation_element.h b/ui/compositor/layer_animation_element.h |
| index 9b658442b017342e89bd92fffceffbbd2a89c964..9999b891fe341b8e6bd48cb264310804b84c56fe 100644 |
| --- a/ui/compositor/layer_animation_element.h |
| +++ b/ui/compositor/layer_animation_element.h |
| @@ -8,6 +8,8 @@ |
| #include <set> |
| #include "base/time.h" |
| +#include "cc/animation.h" |
| +#include "cc/animation_events.h" |
| #include "third_party/skia/include/core/SkColor.h" |
| #include "ui/base/animation/tween.h" |
| #include "ui/compositor/compositor_export.h" |
| @@ -34,6 +36,9 @@ class COMPOSITOR_EXPORT LayerAnimationElement { |
| COLOR, |
| }; |
| + static AnimatableProperty ToAnimatableProperty( |
| + cc::Animation::TargetProperty property); |
| + |
| struct COMPOSITOR_EXPORT TargetValue { |
| TargetValue(); |
| // Initializes the target value to match the delegate. NULL may be supplied. |
| @@ -116,8 +121,22 @@ class COMPOSITOR_EXPORT LayerAnimationElement { |
| // Sets the start time for the animation. This must be called before the first |
| // call to {Progress, IsFinished}. Once the animation is finished, this must |
| // be called again in order to restart the animation. |
| - void set_start_time(base::TimeTicks start_time) { start_time_ = start_time; } |
| - base::TimeTicks start_time() const { return start_time_; } |
| + void set_requested_start_time(base::TimeTicks start_time) { |
| + requested_start_time_ = start_time; |
| + } |
| + base::TimeTicks requested_start_time() const { return requested_start_time_; } |
| + |
| + // Sets the actual start time for the animation, taking into account any |
| + // queueing delays. |
| + void set_effective_start_time(base::TimeTicks start_time) { |
| + effective_start_time_ = start_time; |
| + } |
| + |
| + // If starting the animation involves dispatching to another thread, then |
| + // proceed with that dispatch; this will ultimately result in the animation |
| + // getting an effective start time (the time the animation starts on the other |
| + // thread). |
| + void ProgressToEffectiveStart(LayerAnimationDelegate* delegate); |
|
sky
2013/02/19 17:06:56
Can this be called Start() and always invoked? Int
ajuma
2013/02/20 16:09:10
Done. I've similarly renamed LayerAnimationSequenc
|
| // Updates the delegate to the appropriate value for |now|. Returns true |
| // if a redraw is required. |
| @@ -134,7 +153,7 @@ class COMPOSITOR_EXPORT LayerAnimationElement { |
| // Called if the animation is not allowed to complete. This may be called |
| // before OnStarted or Progress. |
| - void Abort(); |
| + void Abort(LayerAnimationDelegate* delegate); |
| // Assigns the target value to |target|. |
| void GetTargetValue(TargetValue* target) const; |
| @@ -142,16 +161,34 @@ class COMPOSITOR_EXPORT LayerAnimationElement { |
| // The properties that the element modifies. |
| const AnimatableProperties& properties() const { return properties_; } |
| + // Whether this element animates on the compositor thread. |
| + virtual bool IsThreaded() const; |
| + |
| Tween::Type tween_type() const { return tween_type_; } |
| void set_tween_type(Tween::Type tween_type) { tween_type_ = tween_type; } |
| + // Used to identify animations. |
|
sky
2013/02/19 17:06:56
These need better descriptions. In particular how
ajuma
2013/02/20 16:09:10
Done.
|
| + int animation_id() const { return animation_id_; } |
| + void set_animation_id(int id) { animation_id_ = id; } |
| + int animation_group_id() const { return animation_group_id_; } |
| + void set_animation_group_id(int id) { animation_group_id_ = id; } |
| + |
| + // The fraction of the animation that has been completed after the last |
| + // call made to {Progress, ProgressToEnd}. |
| + double last_progressed_fraction() const { return last_progressed_fraction_; } |
| + |
| protected: |
| // Called once each time the animation element is run before any call to |
| // OnProgress. |
| virtual void OnStart(LayerAnimationDelegate* delegate) = 0; |
| virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) = 0; |
| virtual void OnGetTarget(TargetValue* target) const = 0; |
| - virtual void OnAbort() = 0; |
| + virtual void OnAbort(LayerAnimationDelegate* delegate) = 0; |
| + |
| + base::TimeDelta duration() const { return duration_; } |
| + |
| + // Actually start the animation, dispatching to another thread if needed. |
| + virtual void RequestEffectiveStart(LayerAnimationDelegate* delegate); |
| private: |
| // For debugging purposes, we sometimes alter the duration we actually use. |
| @@ -161,10 +198,18 @@ class COMPOSITOR_EXPORT LayerAnimationElement { |
| bool first_frame_; |
| const AnimatableProperties properties_; |
| - base::TimeTicks start_time_; |
| + base::TimeTicks requested_start_time_; |
| + |
| + // When the animation actually started, taking into account queueing delays. |
| + base::TimeTicks effective_start_time_; |
| const base::TimeDelta duration_; |
| Tween::Type tween_type_; |
| + int animation_id_; |
| + int animation_group_id_; |
| + |
| + double last_progressed_fraction_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(LayerAnimationElement); |
| }; |