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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 UpdateActivation(ForceActivation); | 268 UpdateActivation(ForceActivation); |
269 } | 269 } |
270 | 270 |
271 void LayerAnimationController::NotifyAnimationStarted( | 271 void LayerAnimationController::NotifyAnimationStarted( |
272 const AnimationEvent& event, | 272 const AnimationEvent& event, |
273 double wall_clock_time) { | 273 double wall_clock_time) { |
274 if (event.is_impl_only) { | 274 if (event.is_impl_only) { |
275 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, | 275 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, |
276 OnAnimationStarted(event)); | 276 OnAnimationStarted(event)); |
277 if (layer_animation_delegate_) | 277 if (layer_animation_delegate_) |
278 layer_animation_delegate_->NotifyAnimationStarted(wall_clock_time); | 278 layer_animation_delegate_->NotifyAnimationStarted( |
| 279 wall_clock_time, event.monotonic_time, event.target_property); |
279 | 280 |
280 return; | 281 return; |
281 } | 282 } |
282 | 283 |
283 for (size_t i = 0; i < active_animations_.size(); ++i) { | 284 for (size_t i = 0; i < active_animations_.size(); ++i) { |
284 if (active_animations_[i]->group() == event.group_id && | 285 if (active_animations_[i]->group() == event.group_id && |
285 active_animations_[i]->target_property() == event.target_property && | 286 active_animations_[i]->target_property() == event.target_property && |
286 active_animations_[i]->needs_synchronized_start_time()) { | 287 active_animations_[i]->needs_synchronized_start_time()) { |
287 active_animations_[i]->set_needs_synchronized_start_time(false); | 288 active_animations_[i]->set_needs_synchronized_start_time(false); |
288 active_animations_[i]->set_start_time(event.monotonic_time); | 289 active_animations_[i]->set_start_time(event.monotonic_time); |
289 | 290 |
290 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, | 291 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, |
291 OnAnimationStarted(event)); | 292 OnAnimationStarted(event)); |
292 if (layer_animation_delegate_) | 293 if (layer_animation_delegate_) |
293 layer_animation_delegate_->NotifyAnimationStarted(wall_clock_time); | 294 layer_animation_delegate_->NotifyAnimationStarted( |
| 295 wall_clock_time, event.monotonic_time, event.target_property); |
294 | 296 |
295 return; | 297 return; |
296 } | 298 } |
297 } | 299 } |
298 } | 300 } |
299 | 301 |
300 void LayerAnimationController::NotifyAnimationFinished( | 302 void LayerAnimationController::NotifyAnimationFinished( |
301 const AnimationEvent& event, | 303 const AnimationEvent& event, |
302 double wall_clock_time) { | 304 double wall_clock_time) { |
303 if (event.is_impl_only) { | 305 if (event.is_impl_only) { |
304 if (layer_animation_delegate_) | 306 if (layer_animation_delegate_) |
305 layer_animation_delegate_->NotifyAnimationFinished(wall_clock_time); | 307 layer_animation_delegate_->NotifyAnimationFinished( |
| 308 wall_clock_time, event.monotonic_time, event.target_property); |
306 return; | 309 return; |
307 } | 310 } |
308 | 311 |
309 for (size_t i = 0; i < active_animations_.size(); ++i) { | 312 for (size_t i = 0; i < active_animations_.size(); ++i) { |
310 if (active_animations_[i]->group() == event.group_id && | 313 if (active_animations_[i]->group() == event.group_id && |
311 active_animations_[i]->target_property() == event.target_property) { | 314 active_animations_[i]->target_property() == event.target_property) { |
312 active_animations_[i]->set_received_finished_event(true); | 315 active_animations_[i]->set_received_finished_event(true); |
313 if (layer_animation_delegate_) | 316 if (layer_animation_delegate_) |
314 layer_animation_delegate_->NotifyAnimationFinished(wall_clock_time); | 317 layer_animation_delegate_->NotifyAnimationFinished( |
| 318 wall_clock_time, event.monotonic_time, event.target_property); |
315 | 319 |
316 return; | 320 return; |
317 } | 321 } |
318 } | 322 } |
319 } | 323 } |
320 | 324 |
321 void LayerAnimationController::NotifyAnimationAborted( | 325 void LayerAnimationController::NotifyAnimationAborted( |
322 const AnimationEvent& event) { | 326 const AnimationEvent& event) { |
323 for (size_t i = 0; i < active_animations_.size(); ++i) { | 327 for (size_t i = 0; i < active_animations_.size(); ++i) { |
324 if (active_animations_[i]->group() == event.group_id && | 328 if (active_animations_[i]->group() == event.group_id && |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 value_observers_); | 749 value_observers_); |
746 LayerAnimationValueObserver* obs; | 750 LayerAnimationValueObserver* obs; |
747 while ((obs = it.GetNext()) != NULL) | 751 while ((obs = it.GetNext()) != NULL) |
748 if (obs->IsActive()) | 752 if (obs->IsActive()) |
749 return true; | 753 return true; |
750 } | 754 } |
751 return false; | 755 return false; |
752 } | 756 } |
753 | 757 |
754 } // namespace cc | 758 } // namespace cc |
OLD | NEW |