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_registrar.h" | 10 #include "cc/animation/animation_registrar.h" |
11 #include "cc/animation/keyframed_animation_curve.h" | 11 #include "cc/animation/keyframed_animation_curve.h" |
12 #include "cc/animation/layer_animation_value_observer.h" | 12 #include "cc/animation/layer_animation_value_observer.h" |
13 #include "cc/base/scoped_ptr_algorithm.h" | 13 #include "cc/base/scoped_ptr_algorithm.h" |
| 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimationDelegat
e.h" |
14 #include "ui/gfx/transform.h" | 15 #include "ui/gfx/transform.h" |
15 | 16 |
16 namespace cc { | 17 namespace cc { |
17 | 18 |
18 LayerAnimationController::LayerAnimationController(int id) | 19 LayerAnimationController::LayerAnimationController(int id) |
19 : force_sync_(false), | 20 : force_sync_(false), |
20 registrar_(0), | 21 registrar_(0), |
21 id_(id), | 22 id_(id), |
22 is_active_(false), | 23 is_active_(false), |
23 last_tick_time_(0) {} | 24 last_tick_time_(0), |
| 25 layer_animation_delegate_(NULL) {} |
24 | 26 |
25 LayerAnimationController::~LayerAnimationController() { | 27 LayerAnimationController::~LayerAnimationController() { |
26 if (registrar_) | 28 if (registrar_) |
27 registrar_->UnregisterAnimationController(this); | 29 registrar_->UnregisterAnimationController(this); |
28 } | 30 } |
29 | 31 |
30 scoped_refptr<LayerAnimationController> LayerAnimationController::Create( | 32 scoped_refptr<LayerAnimationController> LayerAnimationController::Create( |
31 int id) { | 33 int id) { |
32 return make_scoped_refptr(new LayerAnimationController(id)); | 34 return make_scoped_refptr(new LayerAnimationController(id)); |
33 } | 35 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 for (size_t i = 0; i < active_animations_.size(); ++i) { | 104 for (size_t i = 0; i < active_animations_.size(); ++i) { |
103 if (active_animations_[i]->run_state() == Animation::Paused) | 105 if (active_animations_[i]->run_state() == Animation::Paused) |
104 active_animations_[i]->SetRunState(Animation::Running, monotonic_time); | 106 active_animations_[i]->SetRunState(Animation::Running, monotonic_time); |
105 } | 107 } |
106 } | 108 } |
107 | 109 |
108 // Ensures that the list of active animations on the main thread and the impl | 110 // Ensures that the list of active animations on the main thread and the impl |
109 // thread are kept in sync. | 111 // thread are kept in sync. |
110 void LayerAnimationController::PushAnimationUpdatesTo( | 112 void LayerAnimationController::PushAnimationUpdatesTo( |
111 LayerAnimationController* controller_impl) { | 113 LayerAnimationController* controller_impl) { |
| 114 DCHECK(this != controller_impl); |
112 if (force_sync_) { | 115 if (force_sync_) { |
113 ReplaceImplThreadAnimations(controller_impl); | 116 ReplaceImplThreadAnimations(controller_impl); |
114 force_sync_ = false; | 117 force_sync_ = false; |
115 } else { | 118 } else { |
116 PurgeAnimationsMarkedForDeletion(); | 119 PurgeAnimationsMarkedForDeletion(); |
117 PushNewAnimationsToImplThread(controller_impl); | 120 PushNewAnimationsToImplThread(controller_impl); |
118 | 121 |
119 // Remove finished impl side animations only after pushing, | 122 // Remove finished impl side animations only after pushing, |
120 // and only after the animations are deleted on the main thread | 123 // and only after the animations are deleted on the main thread |
121 // this insures we will never push an animation twice. | 124 // this insures we will never push an animation twice. |
122 RemoveAnimationsCompletedOnMainThread(controller_impl); | 125 RemoveAnimationsCompletedOnMainThread(controller_impl); |
123 | 126 |
124 PushPropertiesToImplThread(controller_impl); | 127 PushPropertiesToImplThread(controller_impl); |
125 } | 128 } |
126 controller_impl->UpdateActivation(NormalActivation); | 129 controller_impl->UpdateActivation(NormalActivation); |
127 UpdateActivation(NormalActivation); | 130 UpdateActivation(NormalActivation); |
128 } | 131 } |
129 | 132 |
| 133 void LayerAnimationController::TransferAnimationsTo( |
| 134 LayerAnimationController* other_controller) { |
| 135 other_controller->active_animations_.clear(); |
| 136 active_animations_.swap(other_controller->active_animations_); |
| 137 UpdateActivation(NormalActivation); |
| 138 set_force_sync(); |
| 139 other_controller->UpdateActivation(NormalActivation); |
| 140 other_controller->set_force_sync(); |
| 141 other_controller->SetAnimationRegistrar(registrar_); |
| 142 } |
| 143 |
130 void LayerAnimationController::Animate(double monotonic_time) { | 144 void LayerAnimationController::Animate(double monotonic_time) { |
131 if (!HasActiveObserver()) | 145 if (!HasActiveValueObserver()) |
132 return; | 146 return; |
133 | 147 |
134 StartAnimationsWaitingForNextTick(monotonic_time); | 148 StartAnimationsWaitingForNextTick(monotonic_time); |
135 StartAnimationsWaitingForStartTime(monotonic_time); | 149 StartAnimationsWaitingForStartTime(monotonic_time); |
136 StartAnimationsWaitingForTargetAvailability(monotonic_time); | 150 StartAnimationsWaitingForTargetAvailability(monotonic_time); |
137 ResolveConflicts(monotonic_time); | 151 ResolveConflicts(monotonic_time); |
138 TickAnimations(monotonic_time); | 152 TickAnimations(monotonic_time); |
139 last_tick_time_ = monotonic_time; | 153 last_tick_time_ = monotonic_time; |
140 } | 154 } |
141 | 155 |
(...skipping 27 matching lines...) Expand all Loading... |
169 event.transform = | 183 event.transform = |
170 animation->curve()->ToTransformAnimationCurve()->GetValue( | 184 animation->curve()->ToTransformAnimationCurve()->GetValue( |
171 monotonic_time); | 185 monotonic_time); |
172 events->push_back(event); | 186 events->push_back(event); |
173 } | 187 } |
174 } | 188 } |
175 } | 189 } |
176 | 190 |
177 void LayerAnimationController::UpdateState(bool start_ready_animations, | 191 void LayerAnimationController::UpdateState(bool start_ready_animations, |
178 AnimationEventsVector* events) { | 192 AnimationEventsVector* events) { |
179 if (!HasActiveObserver()) | 193 if (!HasActiveValueObserver()) |
180 return; | 194 return; |
181 | 195 |
182 if (start_ready_animations) | 196 if (start_ready_animations) |
183 PromoteStartedAnimations(last_tick_time_, events); | 197 PromoteStartedAnimations(last_tick_time_, events); |
184 | 198 |
185 MarkFinishedAnimations(last_tick_time_); | 199 MarkFinishedAnimations(last_tick_time_); |
186 MarkAnimationsForDeletion(last_tick_time_, events); | 200 MarkAnimationsForDeletion(last_tick_time_, events); |
187 | 201 |
188 if (start_ready_animations) { | 202 if (start_ready_animations) { |
189 StartAnimationsWaitingForTargetAvailability(last_tick_time_); | 203 StartAnimationsWaitingForTargetAvailability(last_tick_time_); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 for (size_t i = 0; i < active_animations_.size(); ++i) { | 238 for (size_t i = 0; i < active_animations_.size(); ++i) { |
225 if (!active_animations_[i]->is_finished()) | 239 if (!active_animations_[i]->is_finished()) |
226 return true; | 240 return true; |
227 } | 241 } |
228 return false; | 242 return false; |
229 } | 243 } |
230 | 244 |
231 bool LayerAnimationController::IsAnimatingProperty( | 245 bool LayerAnimationController::IsAnimatingProperty( |
232 Animation::TargetProperty target_property) const { | 246 Animation::TargetProperty target_property) const { |
233 for (size_t i = 0; i < active_animations_.size(); ++i) { | 247 for (size_t i = 0; i < active_animations_.size(); ++i) { |
234 if (active_animations_[i]->run_state() != Animation::Finished && | 248 if (!active_animations_[i]->is_finished() && |
235 active_animations_[i]->run_state() != Animation::Aborted && | |
236 active_animations_[i]->target_property() == target_property) | 249 active_animations_[i]->target_property() == target_property) |
237 return true; | 250 return true; |
238 } | 251 } |
239 return false; | 252 return false; |
240 } | 253 } |
241 | 254 |
242 void LayerAnimationController::OnAnimationStarted( | |
243 const AnimationEvent& event) { | |
244 for (size_t i = 0; i < active_animations_.size(); ++i) { | |
245 if (active_animations_[i]->group() == event.group_id && | |
246 active_animations_[i]->target_property() == event.target_property && | |
247 active_animations_[i]->needs_synchronized_start_time()) { | |
248 active_animations_[i]->set_needs_synchronized_start_time(false); | |
249 active_animations_[i]->set_start_time(event.monotonic_time); | |
250 return; | |
251 } | |
252 } | |
253 } | |
254 | |
255 void LayerAnimationController::SetAnimationRegistrar( | 255 void LayerAnimationController::SetAnimationRegistrar( |
256 AnimationRegistrar* registrar) { | 256 AnimationRegistrar* registrar) { |
257 if (registrar_ == registrar) | 257 if (registrar_ == registrar) |
258 return; | 258 return; |
259 | 259 |
260 if (registrar_) | 260 if (registrar_) |
261 registrar_->UnregisterAnimationController(this); | 261 registrar_->UnregisterAnimationController(this); |
262 | 262 |
263 registrar_ = registrar; | 263 registrar_ = registrar; |
264 if (registrar_) | 264 if (registrar_) |
265 registrar_->RegisterAnimationController(this); | 265 registrar_->RegisterAnimationController(this); |
266 | 266 |
267 UpdateActivation(ForceActivation); | 267 UpdateActivation(ForceActivation); |
268 } | 268 } |
269 | 269 |
270 void LayerAnimationController::AddObserver( | 270 void LayerAnimationController::NotifyAnimationStarted( |
271 LayerAnimationValueObserver* observer) { | 271 const AnimationEvent& event, |
272 if (!observers_.HasObserver(observer)) | 272 double wall_clock_time) { |
273 observers_.AddObserver(observer); | 273 for (size_t i = 0; i < active_animations_.size(); ++i) { |
| 274 if (active_animations_[i]->group() == event.group_id && |
| 275 active_animations_[i]->target_property() == event.target_property && |
| 276 active_animations_[i]->needs_synchronized_start_time()) { |
| 277 active_animations_[i]->set_needs_synchronized_start_time(false); |
| 278 active_animations_[i]->set_start_time(event.monotonic_time); |
| 279 |
| 280 FOR_EACH_OBSERVER(LayerAnimationEventObserver, event_observers_, |
| 281 OnAnimationStarted(event)); |
| 282 if (layer_animation_delegate_) |
| 283 layer_animation_delegate_->notifyAnimationStarted(wall_clock_time); |
| 284 |
| 285 return; |
| 286 } |
| 287 } |
274 } | 288 } |
275 | 289 |
276 void LayerAnimationController::RemoveObserver( | 290 void LayerAnimationController::NotifyAnimationFinished( |
| 291 const AnimationEvent& event, |
| 292 double wall_clock_time) { |
| 293 for (size_t i = 0; i < active_animations_.size(); ++i) { |
| 294 if (active_animations_[i]->group() == event.group_id && |
| 295 active_animations_[i]->target_property() == event.target_property) { |
| 296 active_animations_[i]->set_received_finished_event(true); |
| 297 if (layer_animation_delegate_) |
| 298 layer_animation_delegate_->notifyAnimationFinished(wall_clock_time); |
| 299 |
| 300 return; |
| 301 } |
| 302 } |
| 303 } |
| 304 |
| 305 void LayerAnimationController::NotifyAnimationPropertyUpdate( |
| 306 const AnimationEvent& event) { |
| 307 switch (event.target_property) { |
| 308 case Animation::Opacity: |
| 309 NotifyObserversOpacityAnimated(event.opacity); |
| 310 break; |
| 311 case Animation::Transform: |
| 312 NotifyObserversTransformAnimated(event.transform); |
| 313 break; |
| 314 default: |
| 315 NOTREACHED(); |
| 316 } |
| 317 } |
| 318 |
| 319 void LayerAnimationController::AddValueObserver( |
277 LayerAnimationValueObserver* observer) { | 320 LayerAnimationValueObserver* observer) { |
278 observers_.RemoveObserver(observer); | 321 if (!value_observers_.HasObserver(observer)) |
| 322 value_observers_.AddObserver(observer); |
| 323 } |
| 324 |
| 325 void LayerAnimationController::RemoveValueObserver( |
| 326 LayerAnimationValueObserver* observer) { |
| 327 value_observers_.RemoveObserver(observer); |
| 328 } |
| 329 |
| 330 void LayerAnimationController::AddEventObserver( |
| 331 LayerAnimationEventObserver* observer) { |
| 332 if (!event_observers_.HasObserver(observer)) |
| 333 event_observers_.AddObserver(observer); |
| 334 } |
| 335 |
| 336 void LayerAnimationController::RemoveEventObserver( |
| 337 LayerAnimationEventObserver* observer) { |
| 338 event_observers_.RemoveObserver(observer); |
279 } | 339 } |
280 | 340 |
281 void LayerAnimationController::PushNewAnimationsToImplThread( | 341 void LayerAnimationController::PushNewAnimationsToImplThread( |
282 LayerAnimationController* controller_impl) const { | 342 LayerAnimationController* controller_impl) const { |
283 // Any new animations owned by the main thread's controller are cloned and | 343 // Any new animations owned by the main thread's controller are cloned and |
284 // add to the impl thread's controller. | 344 // add to the impl thread's controller. |
285 for (size_t i = 0; i < active_animations_.size(); ++i) { | 345 for (size_t i = 0; i < active_animations_.size(); ++i) { |
286 // If the animation is already running on the impl thread, there is no | 346 // If the animation is already running on the impl thread, there is no |
287 // need to copy it over. | 347 // need to copy it over. |
288 if (controller_impl->GetAnimation(active_animations_[i]->group(), | 348 if (controller_impl->GetAnimation(active_animations_[i]->group(), |
(...skipping 17 matching lines...) Expand all Loading... |
306 Animation::ControllingInstance, initial_run_state, start_time)); | 366 Animation::ControllingInstance, initial_run_state, start_time)); |
307 DCHECK(!to_add->needs_synchronized_start_time()); | 367 DCHECK(!to_add->needs_synchronized_start_time()); |
308 controller_impl->AddAnimation(to_add.Pass()); | 368 controller_impl->AddAnimation(to_add.Pass()); |
309 } | 369 } |
310 } | 370 } |
311 | 371 |
312 struct IsCompleted { | 372 struct IsCompleted { |
313 explicit IsCompleted(const LayerAnimationController& main_thread_controller) | 373 explicit IsCompleted(const LayerAnimationController& main_thread_controller) |
314 : main_thread_controller_(main_thread_controller) {} | 374 : main_thread_controller_(main_thread_controller) {} |
315 bool operator()(Animation* animation) const { | 375 bool operator()(Animation* animation) const { |
316 if (animation->is_impl_only()) | 376 if (animation->is_impl_only()) { |
317 return false; | 377 return (animation->run_state() == Animation::WaitingForDeletion); |
318 return !main_thread_controller_.GetAnimation(animation->group(), | 378 } else { |
319 animation->target_property()); | 379 return !main_thread_controller_.GetAnimation( |
| 380 animation->group(), |
| 381 animation->target_property()); |
| 382 } |
320 } | 383 } |
321 | 384 |
322 private: | 385 private: |
323 const LayerAnimationController& main_thread_controller_; | 386 const LayerAnimationController& main_thread_controller_; |
324 }; | 387 }; |
325 | 388 |
326 void LayerAnimationController::RemoveAnimationsCompletedOnMainThread( | 389 void LayerAnimationController::RemoveAnimationsCompletedOnMainThread( |
327 LayerAnimationController* controller_impl) const { | 390 LayerAnimationController* controller_impl) const { |
328 // Delete all impl thread animations for which there is no corresponding | 391 // Delete all impl thread animations for which there is no corresponding |
329 // main thread animation. Each iteration, | 392 // main thread animation. Each iteration, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 active_animations_[i]->SetRunState(Animation::Starting, monotonic_time); | 429 active_animations_[i]->SetRunState(Animation::Starting, monotonic_time); |
367 } | 430 } |
368 } | 431 } |
369 | 432 |
370 void LayerAnimationController::StartAnimationsWaitingForTargetAvailability( | 433 void LayerAnimationController::StartAnimationsWaitingForTargetAvailability( |
371 double monotonic_time) { | 434 double monotonic_time) { |
372 // First collect running properties. | 435 // First collect running properties. |
373 TargetProperties blocked_properties; | 436 TargetProperties blocked_properties; |
374 for (size_t i = 0; i < active_animations_.size(); ++i) { | 437 for (size_t i = 0; i < active_animations_.size(); ++i) { |
375 if (active_animations_[i]->run_state() == Animation::Starting || | 438 if (active_animations_[i]->run_state() == Animation::Starting || |
376 active_animations_[i]->run_state() == Animation::Running || | 439 active_animations_[i]->run_state() == Animation::Running) |
377 active_animations_[i]->run_state() == Animation::Finished) | |
378 blocked_properties.insert(active_animations_[i]->target_property()); | 440 blocked_properties.insert(active_animations_[i]->target_property()); |
379 } | 441 } |
380 | 442 |
381 for (size_t i = 0; i < active_animations_.size(); ++i) { | 443 for (size_t i = 0; i < active_animations_.size(); ++i) { |
382 if (active_animations_[i]->run_state() == | 444 if (active_animations_[i]->run_state() == |
383 Animation::WaitingForTargetAvailability) { | 445 Animation::WaitingForTargetAvailability) { |
384 // Collect all properties for animations with the same group id (they | 446 // Collect all properties for animations with the same group id (they |
385 // should all also be in the list of animations). | 447 // should all also be in the list of animations). |
386 TargetProperties enqueued_properties; | 448 TargetProperties enqueued_properties; |
387 enqueued_properties.insert(active_animations_[i]->target_property()); | 449 enqueued_properties.insert(active_animations_[i]->target_property()); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 active_animations_[i]->group(), | 496 active_animations_[i]->group(), |
435 active_animations_[i]->target_property(), | 497 active_animations_[i]->target_property(), |
436 monotonic_time)); | 498 monotonic_time)); |
437 } | 499 } |
438 } | 500 } |
439 } | 501 } |
440 } | 502 } |
441 | 503 |
442 void LayerAnimationController::MarkFinishedAnimations(double monotonic_time) { | 504 void LayerAnimationController::MarkFinishedAnimations(double monotonic_time) { |
443 for (size_t i = 0; i < active_animations_.size(); ++i) { | 505 for (size_t i = 0; i < active_animations_.size(); ++i) { |
444 if (active_animations_[i]->IsFinishedAt(monotonic_time)) | 506 if (active_animations_[i]->IsFinishedAt(monotonic_time) && |
| 507 active_animations_[i]->run_state() != Animation::WaitingForDeletion) |
445 active_animations_[i]->SetRunState(Animation::Finished, monotonic_time); | 508 active_animations_[i]->SetRunState(Animation::Finished, monotonic_time); |
446 } | 509 } |
447 } | 510 } |
448 | 511 |
449 void LayerAnimationController::ResolveConflicts(double monotonic_time) { | 512 void LayerAnimationController::ResolveConflicts(double monotonic_time) { |
450 // Find any animations that are animating the same property and resolve the | 513 // Find any animations that are animating the same property and resolve the |
451 // confict. We could eventually blend, but for now we'll just abort the | 514 // confict. We could eventually blend, but for now we'll just abort the |
452 // previous animation (where 'previous' means: (1) has a prior start time or | 515 // previous animation (where 'previous' means: (1) has a prior start time or |
453 // (2) has an equal start time, but was added to the queue earlier, i.e., | 516 // (2) has an equal start time, but was added to the queue earlier, i.e., |
454 // has a lower index in active_animations_). | 517 // has a lower index in active_animations_). |
(...skipping 14 matching lines...) Expand all Loading... |
469 monotonic_time); | 532 monotonic_time); |
470 } | 533 } |
471 } | 534 } |
472 } | 535 } |
473 } | 536 } |
474 } | 537 } |
475 } | 538 } |
476 | 539 |
477 void LayerAnimationController::MarkAnimationsForDeletion( | 540 void LayerAnimationController::MarkAnimationsForDeletion( |
478 double monotonic_time, AnimationEventsVector* events) { | 541 double monotonic_time, AnimationEventsVector* events) { |
| 542 // Non-aborted animations are marked for deletion after a corresponding |
| 543 // AnimationEvent::Finished event is sent or received. This means that if |
| 544 // we don't have an events vector, we must ensure that non-aborted animations |
| 545 // have received a finished event before marking them for deletion. |
479 for (size_t i = 0; i < active_animations_.size(); i++) { | 546 for (size_t i = 0; i < active_animations_.size(); i++) { |
480 int group_id = active_animations_[i]->group(); | 547 int group_id = active_animations_[i]->group(); |
481 bool all_anims_with_same_id_are_finished = false; | 548 bool all_anims_with_same_id_are_finished = false; |
| 549 |
| 550 // Since deleting an animation on the main thread leads to its deletion |
| 551 // on the impl thread, we only mark a Finished main thread animation for |
| 552 // deletion once it has received a Finished event from the impl thread. |
| 553 bool animation_i_will_send_or_has_received_finish_event = |
| 554 events || active_animations_[i]->received_finished_event(); |
482 // If an animation is finished, and not already marked for deletion, | 555 // If an animation is finished, and not already marked for deletion, |
483 // Find out if all other animations in the same group are also finished. | 556 // find out if all other animations in the same group are also finished. |
484 if (active_animations_[i]->is_finished() && | 557 if (active_animations_[i]->run_state() == Animation::Aborted || |
485 active_animations_[i]->run_state() != Animation::WaitingForDeletion) { | 558 (active_animations_[i]->run_state() == Animation::Finished && |
| 559 animation_i_will_send_or_has_received_finish_event)) { |
486 all_anims_with_same_id_are_finished = true; | 560 all_anims_with_same_id_are_finished = true; |
487 for (size_t j = 0; j < active_animations_.size(); ++j) { | 561 for (size_t j = 0; j < active_animations_.size(); ++j) { |
| 562 bool animation_j_will_send_or_has_received_finish_event = |
| 563 events || active_animations_[j]->received_finished_event(); |
488 if (group_id == active_animations_[j]->group() && | 564 if (group_id == active_animations_[j]->group() && |
489 !active_animations_[j]->is_finished()) { | 565 (!active_animations_[j]->is_finished() || |
| 566 (active_animations_[j]->run_state() == Animation::Finished && |
| 567 !animation_j_will_send_or_has_received_finish_event))) { |
490 all_anims_with_same_id_are_finished = false; | 568 all_anims_with_same_id_are_finished = false; |
491 break; | 569 break; |
492 } | 570 } |
493 } | 571 } |
494 } | 572 } |
495 if (all_anims_with_same_id_are_finished) { | 573 if (all_anims_with_same_id_are_finished) { |
496 // We now need to remove all animations with the same group id as | 574 // We now need to remove all animations with the same group id as |
497 // group_id (and send along animation finished notifications, if | 575 // group_id (and send along animation finished notifications, if |
498 // necessary). | 576 // necessary). |
499 for (size_t j = i; j < active_animations_.size(); j++) { | 577 for (size_t j = i; j < active_animations_.size(); j++) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 if (!active_animations_.empty() && (!is_active_ || force)) | 678 if (!active_animations_.empty() && (!is_active_ || force)) |
601 registrar_->DidActivateAnimationController(this); | 679 registrar_->DidActivateAnimationController(this); |
602 else if (active_animations_.empty() && (is_active_ || force)) | 680 else if (active_animations_.empty() && (is_active_ || force)) |
603 registrar_->DidDeactivateAnimationController(this); | 681 registrar_->DidDeactivateAnimationController(this); |
604 is_active_ = !active_animations_.empty(); | 682 is_active_ = !active_animations_.empty(); |
605 } | 683 } |
606 } | 684 } |
607 | 685 |
608 void LayerAnimationController::NotifyObserversOpacityAnimated(float opacity) { | 686 void LayerAnimationController::NotifyObserversOpacityAnimated(float opacity) { |
609 FOR_EACH_OBSERVER(LayerAnimationValueObserver, | 687 FOR_EACH_OBSERVER(LayerAnimationValueObserver, |
610 observers_, | 688 value_observers_, |
611 OnOpacityAnimated(opacity)); | 689 OnOpacityAnimated(opacity)); |
612 } | 690 } |
613 | 691 |
614 void LayerAnimationController::NotifyObserversTransformAnimated( | 692 void LayerAnimationController::NotifyObserversTransformAnimated( |
615 const gfx::Transform& transform) { | 693 const gfx::Transform& transform) { |
616 FOR_EACH_OBSERVER(LayerAnimationValueObserver, | 694 FOR_EACH_OBSERVER(LayerAnimationValueObserver, |
617 observers_, | 695 value_observers_, |
618 OnTransformAnimated(transform)); | 696 OnTransformAnimated(transform)); |
619 } | 697 } |
620 | 698 |
621 bool LayerAnimationController::HasActiveObserver() { | 699 bool LayerAnimationController::HasActiveValueObserver() { |
622 if (observers_.might_have_observers()) { | 700 if (value_observers_.might_have_observers()) { |
623 ObserverListBase<LayerAnimationValueObserver>::Iterator it(observers_); | 701 ObserverListBase<LayerAnimationValueObserver>::Iterator it( |
| 702 value_observers_); |
624 LayerAnimationValueObserver* obs; | 703 LayerAnimationValueObserver* obs; |
625 while ((obs = it.GetNext()) != NULL) | 704 while ((obs = it.GetNext()) != NULL) |
626 if (obs->IsActive()) | 705 if (obs->IsActive()) |
627 return true; | 706 return true; |
628 } | 707 } |
629 return false; | 708 return false; |
630 } | 709 } |
631 | 710 |
632 } // namespace cc | 711 } // namespace cc |
OLD | NEW |