OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/animation/layer_animation_controller.h" | 5 #include "cc/animation/layer_animation_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "cc/animation/animation.h" | 9 #include "cc/animation/animation.h" |
10 #include "cc/animation/animation_delegate.h" | 10 #include "cc/animation/animation_delegate.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 registrar_ = registrar; | 275 registrar_ = registrar; |
276 if (registrar_) | 276 if (registrar_) |
277 registrar_->RegisterAnimationController(this); | 277 registrar_->RegisterAnimationController(this); |
278 | 278 |
279 UpdateActivation(ForceActivation); | 279 UpdateActivation(ForceActivation); |
280 } | 280 } |
281 | 281 |
282 void LayerAnimationController::NotifyAnimationStarted( | 282 void LayerAnimationController::NotifyAnimationStarted( |
283 const AnimationEvent& event, | 283 const AnimationEvent& event, |
284 double wall_clock_time) { | 284 double wall_clock_time) { |
| 285 base::TimeTicks monotonic_time = base::TimeTicks::FromInternalValue( |
| 286 event.monotonic_time * base::Time::kMicrosecondsPerSecond); |
285 if (event.is_impl_only) { | 287 if (event.is_impl_only) { |
286 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, | 288 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, |
287 OnAnimationStarted(event)); | 289 OnAnimationStarted(event)); |
288 if (layer_animation_delegate_) | 290 if (layer_animation_delegate_) |
289 layer_animation_delegate_->NotifyAnimationStarted(wall_clock_time); | 291 layer_animation_delegate_->NotifyAnimationStarted( |
| 292 wall_clock_time, monotonic_time, event.target_property); |
290 | 293 |
291 return; | 294 return; |
292 } | 295 } |
293 | 296 |
294 for (size_t i = 0; i < active_animations_.size(); ++i) { | 297 for (size_t i = 0; i < active_animations_.size(); ++i) { |
295 if (active_animations_[i]->group() == event.group_id && | 298 if (active_animations_[i]->group() == event.group_id && |
296 active_animations_[i]->target_property() == event.target_property && | 299 active_animations_[i]->target_property() == event.target_property && |
297 active_animations_[i]->needs_synchronized_start_time()) { | 300 active_animations_[i]->needs_synchronized_start_time()) { |
298 active_animations_[i]->set_needs_synchronized_start_time(false); | 301 active_animations_[i]->set_needs_synchronized_start_time(false); |
299 active_animations_[i]->set_start_time(event.monotonic_time); | 302 active_animations_[i]->set_start_time(event.monotonic_time); |
300 | 303 |
301 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, | 304 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, |
302 OnAnimationStarted(event)); | 305 OnAnimationStarted(event)); |
303 if (layer_animation_delegate_) | 306 if (layer_animation_delegate_) |
304 layer_animation_delegate_->NotifyAnimationStarted(wall_clock_time); | 307 layer_animation_delegate_->NotifyAnimationStarted( |
| 308 wall_clock_time, monotonic_time, event.target_property); |
305 | 309 |
306 return; | 310 return; |
307 } | 311 } |
308 } | 312 } |
309 } | 313 } |
310 | 314 |
311 void LayerAnimationController::NotifyAnimationFinished( | 315 void LayerAnimationController::NotifyAnimationFinished( |
312 const AnimationEvent& event, | 316 const AnimationEvent& event, |
313 double wall_clock_time) { | 317 double wall_clock_time) { |
| 318 base::TimeTicks monotonic_time = base::TimeTicks::FromInternalValue( |
| 319 event.monotonic_time * base::Time::kMicrosecondsPerSecond); |
314 if (event.is_impl_only) { | 320 if (event.is_impl_only) { |
315 if (layer_animation_delegate_) | 321 if (layer_animation_delegate_) |
316 layer_animation_delegate_->NotifyAnimationFinished(wall_clock_time); | 322 layer_animation_delegate_->NotifyAnimationFinished( |
| 323 wall_clock_time, monotonic_time, event.target_property); |
317 return; | 324 return; |
318 } | 325 } |
319 | 326 |
320 for (size_t i = 0; i < active_animations_.size(); ++i) { | 327 for (size_t i = 0; i < active_animations_.size(); ++i) { |
321 if (active_animations_[i]->group() == event.group_id && | 328 if (active_animations_[i]->group() == event.group_id && |
322 active_animations_[i]->target_property() == event.target_property) { | 329 active_animations_[i]->target_property() == event.target_property) { |
323 active_animations_[i]->set_received_finished_event(true); | 330 active_animations_[i]->set_received_finished_event(true); |
324 if (layer_animation_delegate_) | 331 if (layer_animation_delegate_) |
325 layer_animation_delegate_->NotifyAnimationFinished(wall_clock_time); | 332 layer_animation_delegate_->NotifyAnimationFinished( |
| 333 wall_clock_time, monotonic_time, event.target_property); |
326 | 334 |
327 return; | 335 return; |
328 } | 336 } |
329 } | 337 } |
330 } | 338 } |
331 | 339 |
332 void LayerAnimationController::NotifyAnimationAborted( | 340 void LayerAnimationController::NotifyAnimationAborted( |
333 const AnimationEvent& event) { | 341 const AnimationEvent& event) { |
334 for (size_t i = 0; i < active_animations_.size(); ++i) { | 342 for (size_t i = 0; i < active_animations_.size(); ++i) { |
335 if (active_animations_[i]->group() == event.group_id && | 343 if (active_animations_[i]->group() == event.group_id && |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 value_observers_); | 795 value_observers_); |
788 LayerAnimationValueObserver* obs; | 796 LayerAnimationValueObserver* obs; |
789 while ((obs = it.GetNext()) != NULL) | 797 while ((obs = it.GetNext()) != NULL) |
790 if (obs->IsActive()) | 798 if (obs->IsActive()) |
791 return true; | 799 return true; |
792 } | 800 } |
793 return false; | 801 return false; |
794 } | 802 } |
795 | 803 |
796 } // namespace cc | 804 } // namespace cc |
OLD | NEW |