Chromium Code Reviews| Index: cc/animation/layer_animation_controller.cc |
| diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc |
| index 4c0b8bb2b0d7f350ca6304b9e087c179ad4285c2..8dd41bfe8a10faa625736d2059e7702e2ae1e00e 100644 |
| --- a/cc/animation/layer_animation_controller.cc |
| +++ b/cc/animation/layer_animation_controller.cc |
| @@ -24,7 +24,7 @@ LayerAnimationController::LayerAnimationController(int id) |
| : registrar_(0), |
| id_(id), |
| is_active_(false), |
| - last_tick_time_(0), |
| + last_tick_time_(base::TimeTicks()), |
| value_provider_(NULL), |
| layer_animation_delegate_(NULL) {} |
| @@ -43,7 +43,10 @@ void LayerAnimationController::PauseAnimation(int animation_id, |
| for (size_t i = 0; i < active_animations_.size(); ++i) { |
| if (active_animations_[i]->id() == animation_id) { |
| active_animations_[i]->SetRunState( |
| - Animation::Paused, time_offset + active_animations_[i]->start_time()); |
| + Animation::Paused, |
| + base::TimeTicks::FromInternalValue( |
| + (time_offset + active_animations_[i]->start_time()) * |
|
ajuma
2014/04/08 15:44:16
We should change time_offset to a TimeDelta, and t
|
| + base::Time::kMicrosecondsPerSecond)); |
| } |
| } |
| } |
| @@ -123,8 +126,9 @@ void LayerAnimationController::PushAnimationUpdatesTo( |
| UpdateActivation(NormalActivation); |
| } |
| -void LayerAnimationController::Animate(double monotonic_time) { |
| - DCHECK(monotonic_time); |
| +void LayerAnimationController::Animate(base::TimeTicks monotonic_time) { |
| + bool time = (monotonic_time - base::TimeTicks()).InSecondsF(); |
| + DCHECK(time); |
|
ajuma
2014/04/08 15:44:16
Instead of converting to double, just DCHECK(monot
|
| if (!HasValueObserver()) |
| return; |
| @@ -134,7 +138,7 @@ void LayerAnimationController::Animate(double monotonic_time) { |
| } |
| void LayerAnimationController::AccumulatePropertyUpdates( |
| - double monotonic_time, |
| + base::TimeTicks monotonic_time, |
| AnimationEventsVector* events) { |
| if (!events) |
| return; |
| @@ -281,8 +285,7 @@ void LayerAnimationController::SetAnimationRegistrar( |
| void LayerAnimationController::NotifyAnimationStarted( |
| const AnimationEvent& event) { |
| - base::TimeTicks monotonic_time = base::TimeTicks::FromInternalValue( |
| - event.monotonic_time * base::Time::kMicrosecondsPerSecond); |
| + base::TimeTicks monotonic_time = event.monotonic_time; |
| if (event.is_impl_only) { |
| FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, |
| OnAnimationStarted(event)); |
| @@ -313,8 +316,7 @@ void LayerAnimationController::NotifyAnimationStarted( |
| void LayerAnimationController::NotifyAnimationFinished( |
| const AnimationEvent& event) { |
| - base::TimeTicks monotonic_time = base::TimeTicks::FromInternalValue( |
| - event.monotonic_time * base::Time::kMicrosecondsPerSecond); |
| + base::TimeTicks monotonic_time = event.monotonic_time; |
| if (event.is_impl_only) { |
| if (layer_animation_delegate_) |
| layer_animation_delegate_->NotifyAnimationFinished(monotonic_time, |
| @@ -523,9 +525,8 @@ void LayerAnimationController::PushNewAnimationsToImplThread( |
| // The new animation should be set to run as soon as possible. |
| Animation::RunState initial_run_state = |
| Animation::WaitingForTargetAvailability; |
| - double start_time = 0; |
| scoped_ptr<Animation> to_add(active_animations_[i]->CloneAndInitialize( |
| - initial_run_state, start_time)); |
| + initial_run_state, base::TimeTicks())); |
| DCHECK(!to_add->needs_synchronized_start_time()); |
| controller_impl->AddAnimation(to_add.Pass()); |
| } |
| @@ -575,7 +576,7 @@ void LayerAnimationController::PushPropertiesToImplThread( |
| } |
| } |
| -void LayerAnimationController::StartAnimations(double monotonic_time) { |
| +void LayerAnimationController::StartAnimations(base::TimeTicks monotonic_time) { |
| // First collect running properties. |
| TargetProperties blocked_properties; |
| for (size_t i = 0; i < active_animations_.size(); ++i) { |
| @@ -616,8 +617,8 @@ void LayerAnimationController::StartAnimations(double monotonic_time) { |
| for (size_t j = i + 1; j < active_animations_.size(); ++j) { |
| if (active_animations_[i]->group() == |
| active_animations_[j]->group()) { |
| - active_animations_[j]->SetRunState( |
| - Animation::Starting, monotonic_time); |
| + active_animations_[j]->SetRunState(Animation::Starting, |
| + monotonic_time); |
| } |
| } |
| } |
| @@ -626,7 +627,7 @@ void LayerAnimationController::StartAnimations(double monotonic_time) { |
| } |
| void LayerAnimationController::PromoteStartedAnimations( |
| - double monotonic_time, |
| + base::TimeTicks monotonic_time, |
| AnimationEventsVector* events) { |
| for (size_t i = 0; i < active_animations_.size(); ++i) { |
| if (active_animations_[i]->run_state() == Animation::Starting) { |
| @@ -647,7 +648,8 @@ void LayerAnimationController::PromoteStartedAnimations( |
| } |
| } |
| -void LayerAnimationController::MarkFinishedAnimations(double monotonic_time) { |
| +void LayerAnimationController::MarkFinishedAnimations( |
| + base::TimeTicks monotonic_time) { |
| for (size_t i = 0; i < active_animations_.size(); ++i) { |
| if (active_animations_[i]->IsFinishedAt(monotonic_time) && |
| active_animations_[i]->run_state() != Animation::Aborted && |
| @@ -657,7 +659,8 @@ void LayerAnimationController::MarkFinishedAnimations(double monotonic_time) { |
| } |
| void LayerAnimationController::MarkAnimationsForDeletion( |
| - double monotonic_time, AnimationEventsVector* events) { |
| + base::TimeTicks monotonic_time, |
| + AnimationEventsVector* events) { |
| bool marked_animations_for_deletions = false; |
| // Non-aborted animations are marked for deletion after a corresponding |
| @@ -747,7 +750,7 @@ void LayerAnimationController::PurgeAnimationsMarkedForDeletion() { |
| animations.end()); |
| } |
| -void LayerAnimationController::TickAnimations(double monotonic_time) { |
| +void LayerAnimationController::TickAnimations(base::TimeTicks monotonic_time) { |
| for (size_t i = 0; i < active_animations_.size(); ++i) { |
| if (active_animations_[i]->run_state() == Animation::Starting || |
| active_animations_[i]->run_state() == Animation::Running || |