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 239a29ae30d5d56972eafe636649c717a81df1eb..9489aa3d9cc40a26b51e2ab6a245c4eb0fd7fc6d 100644 |
| --- a/cc/animation/layer_animation_controller.cc |
| +++ b/cc/animation/layer_animation_controller.cc |
| @@ -24,9 +24,10 @@ LayerAnimationController::LayerAnimationController(int id) |
| : registrar_(0), |
| id_(id), |
| is_active_(false), |
| - last_tick_time_(0), |
| + last_tick_time_(), |
|
ajuma
2014/05/07 17:04:42
Not needed.
Sikugu_
2014/05/12 16:01:53
Done.
|
| value_provider_(NULL), |
| - layer_animation_delegate_(NULL) {} |
| + layer_animation_delegate_(NULL) { |
| +} |
| LayerAnimationController::~LayerAnimationController() { |
| if (registrar_) |
| @@ -39,7 +40,7 @@ scoped_refptr<LayerAnimationController> LayerAnimationController::Create( |
| } |
| void LayerAnimationController::PauseAnimation(int animation_id, |
| - double time_offset) { |
| + base::TimeDelta time_offset) { |
| for (size_t i = 0; i < animations_.size(); ++i) { |
| if (animations_[i]->id() == animation_id) { |
| animations_[i]->SetRunState(Animation::Paused, |
| @@ -121,8 +122,8 @@ void LayerAnimationController::PushAnimationUpdatesTo( |
| UpdateActivation(NormalActivation); |
| } |
| -void LayerAnimationController::Animate(double monotonic_time) { |
| - DCHECK(monotonic_time); |
| +void LayerAnimationController::Animate(base::TimeTicks monotonic_time) { |
| + DCHECK(monotonic_time != base::TimeTicks()); |
| if (!HasValueObserver()) |
| return; |
| @@ -132,7 +133,7 @@ void LayerAnimationController::Animate(double monotonic_time) { |
| } |
| void LayerAnimationController::AccumulatePropertyUpdates( |
| - double monotonic_time, |
| + base::TimeTicks monotonic_time, |
| AnimationEventsVector* events) { |
| if (!events) |
| return; |
| @@ -203,7 +204,7 @@ void LayerAnimationController::UpdateState(bool start_ready_animations, |
| if (!HasActiveValueObserver()) |
| return; |
| - DCHECK(last_tick_time_); |
| + DCHECK(last_tick_time_ != base::TimeTicks()); |
| if (start_ready_animations) |
| PromoteStartedAnimations(last_tick_time_, events); |
| @@ -300,15 +301,12 @@ void LayerAnimationController::SetAnimationRegistrar( |
| void LayerAnimationController::NotifyAnimationStarted( |
| const AnimationEvent& event) { |
| - base::TimeTicks monotonic_time = base::TimeTicks::FromInternalValue( |
| - event.monotonic_time * base::Time::kMicrosecondsPerSecond); |
| if (event.is_impl_only) { |
| FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, |
| OnAnimationStarted(event)); |
| if (layer_animation_delegate_) |
| - layer_animation_delegate_->NotifyAnimationStarted(monotonic_time, |
| + layer_animation_delegate_->NotifyAnimationStarted(event.monotonic_time, |
| event.target_property); |
| - |
| return; |
| } |
| @@ -324,7 +322,7 @@ void LayerAnimationController::NotifyAnimationStarted( |
| OnAnimationStarted(event)); |
| if (layer_animation_delegate_) |
| layer_animation_delegate_->NotifyAnimationStarted( |
| - monotonic_time, event.target_property); |
| + event.monotonic_time, event.target_property); |
| return; |
| } |
| @@ -333,11 +331,9 @@ void LayerAnimationController::NotifyAnimationStarted( |
| void LayerAnimationController::NotifyAnimationFinished( |
| const AnimationEvent& event) { |
| - base::TimeTicks monotonic_time = base::TimeTicks::FromInternalValue( |
| - event.monotonic_time * base::Time::kMicrosecondsPerSecond); |
| if (event.is_impl_only) { |
| if (layer_animation_delegate_) |
| - layer_animation_delegate_->NotifyAnimationFinished(monotonic_time, |
| + layer_animation_delegate_->NotifyAnimationFinished(event.monotonic_time, |
| event.target_property); |
| return; |
| } |
| @@ -348,7 +344,7 @@ void LayerAnimationController::NotifyAnimationFinished( |
| animations_[i]->set_received_finished_event(true); |
| if (layer_animation_delegate_) |
| layer_animation_delegate_->NotifyAnimationFinished( |
| - monotonic_time, event.target_property); |
| + event.monotonic_time, event.target_property); |
| return; |
| } |
| @@ -598,7 +594,7 @@ void LayerAnimationController::PushPropertiesToImplThread( |
| } |
| } |
| -void LayerAnimationController::StartAnimations(double monotonic_time) { |
| +void LayerAnimationController::StartAnimations(base::TimeTicks monotonic_time) { |
| // First collect running properties affecting each type of observer. |
| TargetProperties blocked_properties_for_active_observers; |
| TargetProperties blocked_properties_for_pending_observers; |
| @@ -669,7 +665,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 < animations_.size(); ++i) { |
| if (animations_[i]->run_state() == Animation::Starting && |
| @@ -691,7 +687,8 @@ void LayerAnimationController::PromoteStartedAnimations( |
| } |
| } |
| -void LayerAnimationController::MarkFinishedAnimations(double monotonic_time) { |
| +void LayerAnimationController::MarkFinishedAnimations( |
| + base::TimeTicks monotonic_time) { |
| for (size_t i = 0; i < animations_.size(); ++i) { |
| if (animations_[i]->IsFinishedAt(monotonic_time) && |
| animations_[i]->run_state() != Animation::Aborted && |
| @@ -701,7 +698,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 |
| @@ -788,7 +786,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 < animations_.size(); ++i) { |
| if (animations_[i]->run_state() == Animation::Starting || |
| animations_[i]->run_state() == Animation::Running || |