| Index: cc/animation/layer_animation_controller.cc
|
| diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc
|
| index 464801ce92fb02a3803c27cfe2b837f4d066c1e5..a878354777734782daa7b84cc90ba05ae8b0816a 100644
|
| --- a/cc/animation/layer_animation_controller.cc
|
| +++ b/cc/animation/layer_animation_controller.cc
|
| @@ -20,11 +20,15 @@
|
|
|
| namespace cc {
|
|
|
| +static double TimeTicksToDoubleTime(base::TimeTicks time) {
|
| + return (time - base::TimeTicks()).InSecondsF();
|
| +}
|
| +
|
| 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) {}
|
|
|
| @@ -42,6 +46,9 @@ void LayerAnimationController::PauseAnimation(int animation_id,
|
| double time_offset) {
|
| for (size_t i = 0; i < active_animations_.size(); ++i) {
|
| if (active_animations_[i]->id() == animation_id) {
|
| + // TODO(sikugu): http://crbug.com/178171 - Remove double
|
| + // and use base::TimeTicks/TimeDelta instead all over the file.
|
| + // Remove usage of TimeTicksToDoubleTime.
|
| active_animations_[i]->SetRunState(
|
| Animation::Paused, time_offset + active_animations_[i]->start_time());
|
| }
|
| @@ -99,7 +106,8 @@ void LayerAnimationController::AbortAnimations(
|
| for (size_t i = 0; i < active_animations_.size(); ++i) {
|
| if (active_animations_[i]->target_property() == target_property &&
|
| !active_animations_[i]->is_finished())
|
| - active_animations_[i]->SetRunState(Animation::Aborted, last_tick_time_);
|
| + active_animations_[i]->SetRunState(
|
| + Animation::Aborted, TimeTicksToDoubleTime(last_tick_time_));
|
| }
|
| }
|
|
|
| @@ -123,8 +131,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;
|
|
|
| @@ -134,8 +142,9 @@ void LayerAnimationController::Animate(double monotonic_time) {
|
| }
|
|
|
| void LayerAnimationController::AccumulatePropertyUpdates(
|
| - double monotonic_time,
|
| + base::TimeTicks time,
|
| AnimationEventsVector* events) {
|
| + double monotonic_time = TimeTicksToDoubleTime(time);
|
| if (!events)
|
| return;
|
|
|
| @@ -289,7 +298,6 @@ void LayerAnimationController::NotifyAnimationStarted(
|
| if (layer_animation_delegate_)
|
| layer_animation_delegate_->NotifyAnimationStarted(monotonic_time,
|
| event.target_property);
|
| -
|
| return;
|
| }
|
|
|
| @@ -575,7 +583,8 @@ void LayerAnimationController::PushPropertiesToImplThread(
|
| }
|
| }
|
|
|
| -void LayerAnimationController::StartAnimations(double monotonic_time) {
|
| +void LayerAnimationController::StartAnimations(base::TimeTicks time) {
|
| + double monotonic_time = TimeTicksToDoubleTime(time);
|
| // First collect running properties.
|
| TargetProperties blocked_properties;
|
| for (size_t i = 0; i < active_animations_.size(); ++i) {
|
| @@ -626,8 +635,9 @@ void LayerAnimationController::StartAnimations(double monotonic_time) {
|
| }
|
|
|
| void LayerAnimationController::PromoteStartedAnimations(
|
| - double monotonic_time,
|
| + base::TimeTicks time,
|
| AnimationEventsVector* events) {
|
| + double monotonic_time = TimeTicksToDoubleTime(time);
|
| for (size_t i = 0; i < active_animations_.size(); ++i) {
|
| if (active_animations_[i]->run_state() == Animation::Starting) {
|
| active_animations_[i]->SetRunState(Animation::Running, monotonic_time);
|
| @@ -648,7 +658,8 @@ void LayerAnimationController::PromoteStartedAnimations(
|
| }
|
| }
|
|
|
| -void LayerAnimationController::MarkFinishedAnimations(double monotonic_time) {
|
| +void LayerAnimationController::MarkFinishedAnimations(base::TimeTicks time) {
|
| + double monotonic_time = TimeTicksToDoubleTime(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 &&
|
| @@ -658,7 +669,9 @@ void LayerAnimationController::MarkFinishedAnimations(double monotonic_time) {
|
| }
|
|
|
| void LayerAnimationController::MarkAnimationsForDeletion(
|
| - double monotonic_time, AnimationEventsVector* events) {
|
| + base::TimeTicks time,
|
| + AnimationEventsVector* events) {
|
| + double monotonic_time = TimeTicksToDoubleTime(time);
|
| bool marked_animations_for_deletions = false;
|
|
|
| // Non-aborted animations are marked for deletion after a corresponding
|
| @@ -748,13 +761,13 @@ 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 ||
|
| active_animations_[i]->run_state() == Animation::Paused) {
|
| - double trimmed =
|
| - active_animations_[i]->TrimTimeToCurrentIteration(monotonic_time);
|
| + double trimmed = active_animations_[i]->TrimTimeToCurrentIteration(
|
| + TimeTicksToDoubleTime(monotonic_time));
|
|
|
| switch (active_animations_[i]->target_property()) {
|
| case Animation::Transform: {
|
|
|