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