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..cb3fbef933d91ad2338f39fd651b73480b88ba48 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) {} |
@@ -39,11 +39,15 @@ scoped_refptr<LayerAnimationController> LayerAnimationController::Create( |
} |
void LayerAnimationController::PauseAnimation(int animation_id, |
- double time_offset) { |
+ base::TimeTicks time_offset) { |
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()); |
+ // TODO(sikugu): http://crbug.com/178171 - Remove double |
+ // and use base::TimeTicks/TimeDelta instead all over the file. |
+ // Remove usage of GetTimeTicks. |
+ double time = |
+ GetTimeTicks(time_offset) + active_animations_[i]->start_time(); |
+ active_animations_[i]->SetRunState(Animation::Paused, time); |
} |
} |
} |
@@ -99,7 +103,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, |
+ GetTimeTicks(last_tick_time_)); |
} |
} |
@@ -123,8 +128,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 +139,9 @@ void LayerAnimationController::Animate(double monotonic_time) { |
} |
void LayerAnimationController::AccumulatePropertyUpdates( |
- double monotonic_time, |
+ base::TimeTicks time, |
AnimationEventsVector* events) { |
+ double monotonic_time = GetTimeTicks(time); |
if (!events) |
return; |
@@ -283,10 +289,12 @@ void LayerAnimationController::NotifyAnimationStarted( |
const AnimationEvent& event) { |
base::TimeTicks monotonic_time = base::TimeTicks::FromInternalValue( |
event.monotonic_time * base::Time::kMicrosecondsPerSecond); |
+ |
danakj
2014/04/09 16:33:03
whitespace?
Sikugu_
2014/04/10 14:04:57
Done.
|
if (event.is_impl_only) { |
FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, |
OnAnimationStarted(event)); |
if (layer_animation_delegate_) |
+ |
danakj
2014/04/09 16:33:03
whitespace?
Sikugu_
2014/04/10 14:04:57
Done.
|
layer_animation_delegate_->NotifyAnimationStarted(monotonic_time, |
event.target_property); |
@@ -575,7 +583,8 @@ void LayerAnimationController::PushPropertiesToImplThread( |
} |
} |
-void LayerAnimationController::StartAnimations(double monotonic_time) { |
+void LayerAnimationController::StartAnimations(base::TimeTicks time) { |
+ double monotonic_time = GetTimeTicks(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 = GetTimeTicks(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 = GetTimeTicks(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 = GetTimeTicks(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( |
+ GetTimeTicks(monotonic_time)); |
switch (active_animations_[i]->target_property()) { |
case Animation::Transform: { |