| 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..3ae657ad573c972ce82a1d73a5e21042e0ff336a 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,20 @@ 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.
|
| + void ProgressToEffectiveStart(LayerAnimationDelegate* delegate);
|
|
|
| // Updates the delegate to the appropriate value for |now|. Returns true
|
| // if a redraw is required.
|
| @@ -134,7 +151,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 +159,30 @@ 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.
|
| + 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; }
|
| +
|
| 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 +192,16 @@ 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_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(LayerAnimationElement);
|
| };
|
|
|
|
|