| Index: cc/animation/animation.cc
|
| diff --git a/cc/animation/animation.cc b/cc/animation/animation.cc
|
| index 81659cbc269ba83469cc3c475f9d11b2572be772..bba2588284ecf22daefd1e75ed4f65a17de5b42b 100644
|
| --- a/cc/animation/animation.cc
|
| +++ b/cc/animation/animation.cc
|
| @@ -64,23 +64,24 @@ Animation::Animation(scoped_ptr<AnimationCurve> curve,
|
| target_property_(target_property),
|
| run_state_(WaitingForTargetAvailability),
|
| iterations_(1),
|
| - start_time_(0),
|
| + start_time_(base::TimeTicks()),
|
| alternates_direction_(false),
|
| - time_offset_(0),
|
| + time_offset_(base::TimeDelta()),
|
| needs_synchronized_start_time_(false),
|
| received_finished_event_(false),
|
| suspended_(false),
|
| - pause_time_(0),
|
| - total_paused_time_(0),
|
| + pause_time_(base::TimeTicks()),
|
| + total_paused_time_(base::TimeTicks()),
|
| is_controlling_instance_(false),
|
| is_impl_only_(false) {}
|
|
|
| Animation::~Animation() {
|
| if (run_state_ == Running || run_state_ == Paused)
|
| - SetRunState(Aborted, 0);
|
| + SetRunState(Aborted, base::TimeTicks());
|
| }
|
|
|
| -void Animation::SetRunState(RunState run_state, double monotonic_time) {
|
| +void Animation::SetRunState(RunState run_state,
|
| + base::TimeTicks monotonic_time) {
|
| if (suspended_)
|
| return;
|
|
|
| @@ -94,7 +95,6 @@ void Animation::SetRunState(RunState run_state, double monotonic_time) {
|
|
|
| bool is_waiting_to_start = run_state_ == WaitingForTargetAvailability ||
|
| run_state_ == Starting;
|
| -
|
| if (is_waiting_to_start && run_state == Running) {
|
| TRACE_EVENT_ASYNC_BEGIN1(
|
| "cc", "Animation", this, "Name", TRACE_STR_COPY(name_buffer));
|
| @@ -131,47 +131,45 @@ void Animation::SetRunState(RunState run_state, double monotonic_time) {
|
| TRACE_STR_COPY(state_buffer));
|
| }
|
|
|
| -void Animation::Suspend(double monotonic_time) {
|
| +void Animation::Suspend(base::TimeTicks monotonic_time) {
|
| SetRunState(Paused, monotonic_time);
|
| suspended_ = true;
|
| }
|
|
|
| -void Animation::Resume(double monotonic_time) {
|
| +void Animation::Resume(base::TimeTicks monotonic_time) {
|
| suspended_ = false;
|
| SetRunState(Running, monotonic_time);
|
| }
|
|
|
| -bool Animation::IsFinishedAt(double monotonic_time) const {
|
| +bool Animation::IsFinishedAt(base::TimeTicks monotonic_time) const {
|
| if (is_finished())
|
| return true;
|
| -
|
| if (needs_synchronized_start_time_)
|
| return false;
|
| -
|
| - return run_state_ == Running &&
|
| - iterations_ >= 0 &&
|
| - iterations_ * curve_->Duration() <= (monotonic_time -
|
| - start_time() -
|
| - total_paused_time_ +
|
| - time_offset_);
|
| + return run_state_ == Running && iterations_ >= 0 &&
|
| + iterations_ * curve_->Duration() <=
|
| + ticks_inseconds((monotonic_time + time_offset_) -
|
| + (start_time_ - total_paused_time_));
|
| }
|
|
|
| -double Animation::TrimTimeToCurrentIteration(double monotonic_time) const {
|
| - double trimmed = monotonic_time + time_offset_;
|
| +double Animation::TrimTimeToCurrentIteration(
|
| + base::TimeTicks monotonic_time) const {
|
| +
|
| + double trimmed = ticks_inseconds(monotonic_time + time_offset_);
|
|
|
| // If we're paused, time is 'stuck' at the pause time.
|
| if (run_state_ == Paused)
|
| - trimmed = pause_time_;
|
| + trimmed = ticks_inseconds(pause_time_);
|
|
|
| // Returned time should always be relative to the start time and should
|
| // subtract all time spent paused.
|
| - trimmed -= start_time_ + total_paused_time_;
|
| + trimmed -= ticks_inseconds(start_time_) + ticks_inseconds(total_paused_time_);
|
|
|
| // If we're just starting or we're waiting on receiving a start time,
|
| // time is 'stuck' at the initial state.
|
| if ((run_state_ == Starting && !has_set_start_time()) ||
|
| needs_synchronized_start_time())
|
| - trimmed = time_offset_;
|
| + trimmed = delta_inseconds(time_offset_);
|
|
|
| // Zero is always the start of the animation.
|
| if (trimmed <= 0)
|
|
|