Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/animation_host.h" | 5 #include "cc/animation/animation_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "cc/animation/animation_player.h" | 9 #include "cc/animation/animation_player.h" |
| 10 #include "cc/animation/animation_registrar.h" | 10 #include "cc/animation/animation_registrar.h" |
| 11 #include "cc/animation/animation_timeline.h" | 11 #include "cc/animation/animation_timeline.h" |
| 12 #include "cc/animation/element_animations.h" | 12 #include "cc/animation/element_animations.h" |
| 13 #include "ui/gfx/geometry/box_f.h" | 13 #include "ui/gfx/geometry/box_f.h" |
| 14 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 | 16 |
| 17 scoped_ptr<AnimationHost> AnimationHost::Create( | 17 scoped_ptr<AnimationHost> AnimationHost::Create() { |
| 18 ThreadInstance thread_instance) { | 18 return make_scoped_ptr(new AnimationHost); |
| 19 return make_scoped_ptr(new AnimationHost(thread_instance)); | |
| 20 } | 19 } |
| 21 | 20 |
| 22 AnimationHost::AnimationHost(ThreadInstance thread_instance) | 21 AnimationHost::AnimationHost() |
| 23 : animation_registrar_(AnimationRegistrar::Create()), | 22 : animation_registrar_(AnimationRegistrar::Create()), |
| 24 mutator_host_client_(), | 23 mutator_host_client_() { |
|
vmpstr
2015/07/06 20:00:41
nit: Can you put nullptr in here while you're here
mlamouri (slow - plz ping)
2015/07/06 20:10:55
Done.
| |
| 25 thread_instance_(thread_instance) { | |
| 26 } | 24 } |
| 27 | 25 |
| 28 AnimationHost::~AnimationHost() { | 26 AnimationHost::~AnimationHost() { |
| 29 ClearTimelines(); | 27 ClearTimelines(); |
| 30 DCHECK(!mutator_host_client()); | 28 DCHECK(!mutator_host_client()); |
| 31 DCHECK(layer_to_element_animations_map_.empty()); | 29 DCHECK(layer_to_element_animations_map_.empty()); |
| 32 } | 30 } |
| 33 | 31 |
| 34 AnimationTimeline* AnimationHost::GetTimelineById(int timeline_id) const { | 32 AnimationTimeline* AnimationHost::GetTimelineById(int timeline_id) const { |
| 35 for (auto& timeline : timelines_) | 33 for (auto& timeline : timelines_) |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 LayerAnimationController* controller = GetControllerForLayerId(layer_id); | 370 LayerAnimationController* controller = GetControllerForLayerId(layer_id); |
| 373 return controller ? controller->has_any_animation() : false; | 371 return controller ? controller->has_any_animation() : false; |
| 374 } | 372 } |
| 375 | 373 |
| 376 bool AnimationHost::HasActiveAnimation(int layer_id) const { | 374 bool AnimationHost::HasActiveAnimation(int layer_id) const { |
| 377 LayerAnimationController* controller = GetControllerForLayerId(layer_id); | 375 LayerAnimationController* controller = GetControllerForLayerId(layer_id); |
| 378 return controller ? controller->HasActiveAnimation() : false; | 376 return controller ? controller->HasActiveAnimation() : false; |
| 379 } | 377 } |
| 380 | 378 |
| 381 } // namespace cc | 379 } // namespace cc |
| OLD | NEW |