blob: 5eb7a8191e5b08be4dae7d3f5d2716714bb1b2c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/animation_registrar.h"
#include "cc/layer_animation_controller.h"
namespace cc {
AnimationRegistrar::AnimationRegistrar() { }
AnimationRegistrar::~AnimationRegistrar() { }
scoped_refptr<LayerAnimationController>
AnimationRegistrar::GetAnimationControllerForId(int id)
{
scoped_refptr<LayerAnimationController> toReturn;
if (!ContainsKey(all_animation_controllers_, id)) {
toReturn = LayerAnimationController::create(id);
toReturn->setAnimationRegistrar(this);
all_animation_controllers_[id] = toReturn.get();
} else
toReturn = all_animation_controllers_[id];
return toReturn;
}
void AnimationRegistrar::DidActivateAnimationController(LayerAnimationController* controller) {
active_animation_controllers_[controller->id()] = controller;
}
void AnimationRegistrar::DidDeactivateAnimationController(LayerAnimationController* controller) {
if (ContainsKey(active_animation_controllers_, controller->id()))
active_animation_controllers_.erase(controller->id());
}
void AnimationRegistrar::RegisterAnimationController(LayerAnimationController* controller) {
all_animation_controllers_[controller->id()] = controller;
}
void AnimationRegistrar::UnregisterAnimationController(LayerAnimationController* controller) {
if (ContainsKey(all_animation_controllers_, controller->id()))
all_animation_controllers_.erase(controller->id());
DidDeactivateAnimationController(controller);
}
} // namespace cc
|