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_registrar.h" | 5 #include "cc/animation_registrar.h" |
6 | 6 |
7 #include "cc/layer_animation_controller.h" | 7 #include "cc/layer_animation_controller.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
11 AnimationRegistrar::AnimationRegistrar() { } | 11 AnimationRegistrar::AnimationRegistrar() { } |
12 AnimationRegistrar::~AnimationRegistrar() | 12 AnimationRegistrar::~AnimationRegistrar() |
13 { | 13 { |
14 AnimationControllerMap copy = all_animation_controllers_; | 14 AnimationControllerMap copy = all_animation_controllers_; |
15 for (AnimationControllerMap::iterator iter = copy.begin(); iter != copy.end(
); ++iter) | 15 for (AnimationControllerMap::iterator iter = copy.begin(); iter != copy.end(
); ++iter) |
16 (*iter).second->setAnimationRegistrar(NULL); | 16 (*iter).second->SetAnimationRegistrar(NULL); |
17 } | 17 } |
18 | 18 |
19 scoped_refptr<LayerAnimationController> | 19 scoped_refptr<LayerAnimationController> |
20 AnimationRegistrar::GetAnimationControllerForId(int id) | 20 AnimationRegistrar::GetAnimationControllerForId(int id) |
21 { | 21 { |
22 scoped_refptr<LayerAnimationController> toReturn; | 22 scoped_refptr<LayerAnimationController> toReturn; |
23 if (!ContainsKey(all_animation_controllers_, id)) { | 23 if (!ContainsKey(all_animation_controllers_, id)) { |
24 toReturn = LayerAnimationController::create(id); | 24 toReturn = LayerAnimationController::Create(id); |
25 toReturn->setAnimationRegistrar(this); | 25 toReturn->SetAnimationRegistrar(this); |
26 all_animation_controllers_[id] = toReturn.get(); | 26 all_animation_controllers_[id] = toReturn.get(); |
27 } else | 27 } else |
28 toReturn = all_animation_controllers_[id]; | 28 toReturn = all_animation_controllers_[id]; |
29 return toReturn; | 29 return toReturn; |
30 } | 30 } |
31 | 31 |
32 void AnimationRegistrar::DidActivateAnimationController(LayerAnimationController
* controller) { | 32 void AnimationRegistrar::DidActivateAnimationController(LayerAnimationController
* controller) { |
33 active_animation_controllers_[controller->id()] = controller; | 33 active_animation_controllers_[controller->id()] = controller; |
34 } | 34 } |
35 | 35 |
36 void AnimationRegistrar::DidDeactivateAnimationController(LayerAnimationControll
er* controller) { | 36 void AnimationRegistrar::DidDeactivateAnimationController(LayerAnimationControll
er* controller) { |
37 if (ContainsKey(active_animation_controllers_, controller->id())) | 37 if (ContainsKey(active_animation_controllers_, controller->id())) |
38 active_animation_controllers_.erase(controller->id()); | 38 active_animation_controllers_.erase(controller->id()); |
39 } | 39 } |
40 | 40 |
41 void AnimationRegistrar::RegisterAnimationController(LayerAnimationController* c
ontroller) { | 41 void AnimationRegistrar::RegisterAnimationController(LayerAnimationController* c
ontroller) { |
42 all_animation_controllers_[controller->id()] = controller; | 42 all_animation_controllers_[controller->id()] = controller; |
43 } | 43 } |
44 | 44 |
45 void AnimationRegistrar::UnregisterAnimationController(LayerAnimationController*
controller) { | 45 void AnimationRegistrar::UnregisterAnimationController(LayerAnimationController*
controller) { |
46 if (ContainsKey(all_animation_controllers_, controller->id())) | 46 if (ContainsKey(all_animation_controllers_, controller->id())) |
47 all_animation_controllers_.erase(controller->id()); | 47 all_animation_controllers_.erase(controller->id()); |
48 DidDeactivateAnimationController(controller); | 48 DidDeactivateAnimationController(controller); |
49 } | 49 } |
50 | 50 |
51 } // namespace cc | 51 } // namespace cc |
OLD | NEW |