Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: cc/animation_registrar.cc

Issue 11598005: Ref count layer animation controllers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/animation_registrar.h ('k') | cc/cc.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 scoped_refptr<LayerAnimationController>
15 AnimationRegistrar::GetAnimationControllerForId(int id)
16 {
17 scoped_refptr<LayerAnimationController> toReturn;
18 if (!ContainsKey(all_animation_controllers_, id)) {
19 toReturn = LayerAnimationController::create(id);
20 toReturn->setAnimationRegistrar(this);
21 all_animation_controllers_[id] = toReturn.get();
22 } else
23 toReturn = all_animation_controllers_[id];
24 return toReturn;
25 }
26
27 void AnimationRegistrar::DidActivateAnimationController(LayerAnimationController * controller) {
28 active_animation_controllers_[controller->id()] = controller;
29 }
30
31 void AnimationRegistrar::DidDeactivateAnimationController(LayerAnimationControll er* controller) {
32 if (ContainsKey(active_animation_controllers_, controller->id()))
33 active_animation_controllers_.erase(controller->id());
34 }
35
36 void AnimationRegistrar::RegisterAnimationController(LayerAnimationController* c ontroller) {
37 all_animation_controllers_[controller->id()] = controller;
38 }
39
40 void AnimationRegistrar::UnregisterAnimationController(LayerAnimationController* controller) {
41 if (ContainsKey(all_animation_controllers_, controller->id()))
42 all_animation_controllers_.erase(controller->id());
43 DidDeactivateAnimationController(controller);
44 }
45
46 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation_registrar.h ('k') | cc/cc.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698