IndexedDB: fsync after transactions.
[chromium-blink-merge.git] / cc / animation / animation_registrar.cc
blob05f522cbdce8c6e21bd8ae07991be8bf5206a6d0
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.
5 #include "cc/animation/animation_registrar.h"
7 #include "cc/animation/layer_animation_controller.h"
9 namespace cc {
11 AnimationRegistrar::AnimationRegistrar() {}
13 AnimationRegistrar::~AnimationRegistrar() {
14 AnimationControllerMap copy = all_animation_controllers_;
15 for (AnimationControllerMap::iterator iter = copy.begin();
16 iter != copy.end();
17 ++iter)
18 (*iter).second->SetAnimationRegistrar(NULL);
21 scoped_refptr<LayerAnimationController>
22 AnimationRegistrar::GetAnimationControllerForId(int id) {
23 scoped_refptr<LayerAnimationController> to_return;
24 if (!ContainsKey(all_animation_controllers_, id)) {
25 to_return = LayerAnimationController::Create(id);
26 to_return->SetAnimationRegistrar(this);
27 all_animation_controllers_[id] = to_return.get();
28 } else {
29 to_return = all_animation_controllers_[id];
31 return to_return;
34 void AnimationRegistrar::DidActivateAnimationController(
35 LayerAnimationController* controller) {
36 active_animation_controllers_[controller->id()] = controller;
39 void AnimationRegistrar::DidDeactivateAnimationController(
40 LayerAnimationController* controller) {
41 if (ContainsKey(active_animation_controllers_, controller->id()))
42 active_animation_controllers_.erase(controller->id());
45 void AnimationRegistrar::RegisterAnimationController(
46 LayerAnimationController* controller) {
47 all_animation_controllers_[controller->id()] = controller;
50 void AnimationRegistrar::UnregisterAnimationController(
51 LayerAnimationController* controller) {
52 if (ContainsKey(all_animation_controllers_, controller->id()))
53 all_animation_controllers_.erase(controller->id());
54 DidDeactivateAnimationController(controller);
57 } // namespace cc