Chromium Code Reviews| Index: cc/animation/animation.h |
| diff --git a/cc/animation/animation.h b/cc/animation/animation.h |
| index f996c38bbb3dd410bad69189955c8533a2b77e00..893141147ca0de36a4d938d808a8e3daf1c48078 100644 |
| --- a/cc/animation/animation.h |
| +++ b/cc/animation/animation.h |
| @@ -7,6 +7,7 @@ |
| #include "base/basictypes.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/time/time.h" |
| #include "cc/base/cc_export.h" |
| namespace cc { |
| @@ -60,7 +61,7 @@ class CC_EXPORT Animation { |
| TargetProperty target_property() const { return target_property_; } |
| RunState run_state() const { return run_state_; } |
| - void SetRunState(RunState run_state, double monotonic_time); |
| + void SetRunState(RunState run_state, base::TimeTicks monotonic_time); |
| // This is the number of times that the animation will play. If this |
| // value is zero the animation will not play. If it is negative, then |
| @@ -68,15 +69,25 @@ class CC_EXPORT Animation { |
| int iterations() const { return iterations_; } |
| void set_iterations(int n) { iterations_ = n; } |
| - double start_time() const { return start_time_; } |
| - void set_start_time(double monotonic_time) { start_time_ = monotonic_time; } |
| - bool has_set_start_time() const { return !!start_time_; } |
| + double start_time() const { |
|
ajuma
2014/04/08 15:44:16
We should make this return a TimeTicks instead of
|
| + return (start_time_ - base::TimeTicks()).InSecondsF(); |
| + } |
| + void set_start_time(base::TimeTicks monotonic_time) { |
| + start_time_ = monotonic_time; |
| + } |
| + bool has_set_start_time() const { |
| + return !!(start_time_ - base::TimeTicks()).InSecondsF(); |
|
ajuma
2014/04/08 15:44:16
return start_time_ != base::TimeTicks()
|
| + } |
| - double time_offset() const { return time_offset_; } |
| - void set_time_offset(double monotonic_time) { time_offset_ = monotonic_time; } |
| + double time_offset() const { |
| + return (time_offset_ - base::TimeTicks()).InSecondsF(); |
|
ajuma
2014/04/08 15:44:16
It seems like time_offset_ should be a TimeDelta,
|
| + } |
| + void set_time_offset(base::TimeTicks monotonic_time) { |
|
ajuma
2014/04/08 15:44:16
TimeDelta?
|
| + time_offset_ = monotonic_time; |
| + } |
| - void Suspend(double monotonic_time); |
| - void Resume(double monotonic_time); |
| + void Suspend(base::TimeTicks monotonic_time); |
| + void Resume(base::TimeTicks monotonic_time); |
| // If alternates_direction is true, on odd numbered iterations we reverse the |
| // curve. |
| @@ -85,7 +96,7 @@ class CC_EXPORT Animation { |
| alternates_direction_ = alternates; |
| } |
| - bool IsFinishedAt(double monotonic_time) const; |
| + bool IsFinishedAt(base::TimeTicks monotonic_time) const; |
| bool is_finished() const { |
| return run_state_ == Finished || |
| run_state_ == Aborted || |
| @@ -116,11 +127,11 @@ class CC_EXPORT Animation { |
| // Takes the given absolute time, and using the start time and the number |
| // of iterations, returns the relative time in the current iteration. |
| - double TrimTimeToCurrentIteration(double monotonic_time) const; |
| + double TrimTimeToCurrentIteration(base::TimeTicks monotonic_time) const; |
| scoped_ptr<Animation> Clone() const; |
| scoped_ptr<Animation> CloneAndInitialize(RunState initial_run_state, |
| - double start_time) const; |
| + base::TimeTicks start_time) const; |
| bool is_controlling_instance() const { return is_controlling_instance_; } |
| void PushPropertiesTo(Animation* other) const; |
| @@ -149,14 +160,14 @@ class CC_EXPORT Animation { |
| TargetProperty target_property_; |
| RunState run_state_; |
| int iterations_; |
| - double start_time_; |
| + base::TimeTicks start_time_; |
| bool alternates_direction_; |
| // The time offset effectively pushes the start of the animation back in time. |
| // This is used for resuming paused animations -- an animation is added with a |
| // non-zero time offset, causing the animation to skip ahead to the desired |
| // point in time. |
| - double time_offset_; |
| + base::TimeTicks time_offset_; |
|
ajuma
2014/04/08 15:44:16
TimeDelta seems more appropriate for an offset.
|
| bool needs_synchronized_start_time_; |
| bool received_finished_event_; |