Ozone: Temporarily remove DCHECK in BufferFactory.
[chromium-blink-merge.git] / cc / animation / animation_registrar.cc
blob5327926b1cc9ee6b208d8b9d3e6cf3b0d1e26088
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() : supports_scroll_animations_(false) {
14 AnimationRegistrar::~AnimationRegistrar() {
15 AnimationControllerMap copy = all_animation_controllers_;
16 for (AnimationControllerMap::iterator iter = copy.begin();
17 iter != copy.end();
18 ++iter)
19 (*iter).second->SetAnimationRegistrar(nullptr);
22 scoped_refptr<LayerAnimationController>
23 AnimationRegistrar::GetAnimationControllerForId(int id) {
24 scoped_refptr<LayerAnimationController> to_return;
25 if (!ContainsKey(all_animation_controllers_, id)) {
26 to_return = LayerAnimationController::Create(id);
27 to_return->SetAnimationRegistrar(this);
28 all_animation_controllers_[id] = to_return.get();
29 } else {
30 to_return = all_animation_controllers_[id];
32 return to_return;
35 void AnimationRegistrar::DidActivateAnimationController(
36 LayerAnimationController* controller) {
37 active_animation_controllers_[controller->id()] = controller;
40 void AnimationRegistrar::DidDeactivateAnimationController(
41 LayerAnimationController* controller) {
42 if (ContainsKey(active_animation_controllers_, controller->id()))
43 active_animation_controllers_.erase(controller->id());
46 void AnimationRegistrar::RegisterAnimationController(
47 LayerAnimationController* controller) {
48 all_animation_controllers_[controller->id()] = controller;
51 void AnimationRegistrar::UnregisterAnimationController(
52 LayerAnimationController* controller) {
53 if (ContainsKey(all_animation_controllers_, controller->id()))
54 all_animation_controllers_.erase(controller->id());
55 DidDeactivateAnimationController(controller);
58 } // namespace cc