OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/compositor/layer_animator.h" | 5 #include "ui/compositor/layer_animator.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/animation_id_provider.h" | 10 #include "cc/animation_id_provider.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // Remove the observer from all sequences as well. | 312 // Remove the observer from all sequences as well. |
313 for (AnimationQueue::iterator queue_iter = animation_queue_.begin(); | 313 for (AnimationQueue::iterator queue_iter = animation_queue_.begin(); |
314 queue_iter != animation_queue_.end(); ++queue_iter) { | 314 queue_iter != animation_queue_.end(); ++queue_iter) { |
315 (*queue_iter)->RemoveObserver(observer); | 315 (*queue_iter)->RemoveObserver(observer); |
316 } | 316 } |
317 } | 317 } |
318 | 318 |
319 void LayerAnimator::OnThreadedAnimationStarted( | 319 void LayerAnimator::OnThreadedAnimationStarted( |
320 const cc::AnimationEvent& event) { | 320 const cc::AnimationEvent& event) { |
321 LayerAnimationElement::AnimatableProperty property = | 321 LayerAnimationElement::AnimatableProperty property = |
322 LayerAnimationElement::ToAnimatableProperty(event.targetProperty); | 322 LayerAnimationElement::ToAnimatableProperty(event.target_property); |
323 | 323 |
324 RunningAnimation* running = GetRunningAnimation(property); | 324 RunningAnimation* running = GetRunningAnimation(property); |
325 if (!running) | 325 if (!running) |
326 return; | 326 return; |
327 DCHECK(running->is_sequence_alive()); | 327 DCHECK(running->is_sequence_alive()); |
328 | 328 |
329 if (running->sequence()->animation_group_id() != event.groupId) | 329 if (running->sequence()->animation_group_id() != event.group_id) |
330 return; | 330 return; |
331 | 331 |
332 running->sequence()->OnThreadedAnimationStarted(event); | 332 running->sequence()->OnThreadedAnimationStarted(event); |
333 if (!running->sequence()->waiting_for_group_start()) | 333 if (!running->sequence()->waiting_for_group_start()) |
334 return; | 334 return; |
335 | 335 |
336 base::TimeTicks start_time = base::TimeTicks::FromInternalValue( | 336 base::TimeTicks start_time = base::TimeTicks::FromInternalValue( |
337 event.monotonicTime * base::Time::kMicrosecondsPerSecond); | 337 event.monotonic_time * base::Time::kMicrosecondsPerSecond); |
338 | 338 |
339 running->sequence()->set_waiting_for_group_start(false); | 339 running->sequence()->set_waiting_for_group_start(false); |
340 | 340 |
341 // The call to GetRunningAnimation made above already purged deleted | 341 // The call to GetRunningAnimation made above already purged deleted |
342 // animations, so we are guaranteed that all the animations we iterate | 342 // animations, so we are guaranteed that all the animations we iterate |
343 // over now are alive. | 343 // over now are alive. |
344 for (RunningAnimations::iterator iter = running_animations_.begin(); | 344 for (RunningAnimations::iterator iter = running_animations_.begin(); |
345 iter != running_animations_.end(); ++iter) { | 345 iter != running_animations_.end(); ++iter) { |
346 // Ensure that each sequence is only Started once, regardless of the | 346 // Ensure that each sequence is only Started once, regardless of the |
347 // number of sequences in the group that have threaded first elements. | 347 // number of sequences in the group that have threaded first elements. |
348 if (((*iter).sequence()->animation_group_id() == event.groupId) && | 348 if (((*iter).sequence()->animation_group_id() == event.group_id) && |
349 !(*iter).sequence()->IsFirstElementThreaded() && | 349 !(*iter).sequence()->IsFirstElementThreaded() && |
350 (*iter).sequence()->waiting_for_group_start()) { | 350 (*iter).sequence()->waiting_for_group_start()) { |
351 (*iter).sequence()->set_start_time(start_time); | 351 (*iter).sequence()->set_start_time(start_time); |
352 (*iter).sequence()->set_waiting_for_group_start(false); | 352 (*iter).sequence()->set_waiting_for_group_start(false); |
353 (*iter).sequence()->Start(delegate()); | 353 (*iter).sequence()->Start(delegate()); |
354 } | 354 } |
355 } | 355 } |
356 } | 356 } |
357 | 357 |
358 // LayerAnimator protected ----------------------------------------------------- | 358 // LayerAnimator protected ----------------------------------------------------- |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 } | 850 } |
851 | 851 |
852 LayerAnimator::RunningAnimation::RunningAnimation( | 852 LayerAnimator::RunningAnimation::RunningAnimation( |
853 const base::WeakPtr<LayerAnimationSequence>& sequence) | 853 const base::WeakPtr<LayerAnimationSequence>& sequence) |
854 : sequence_(sequence) { | 854 : sequence_(sequence) { |
855 } | 855 } |
856 | 856 |
857 LayerAnimator::RunningAnimation::~RunningAnimation() { } | 857 LayerAnimator::RunningAnimation::~RunningAnimation() { } |
858 | 858 |
859 } // namespace ui | 859 } // namespace ui |
OLD | NEW |