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

Unified Diff: cc/animation/element_animations.h

Issue 1894023002: CC Animation: Make ElementAnimations a ref-counted object. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/animation/animation_player.cc ('k') | cc/animation/element_animations.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/element_animations.h
diff --git a/cc/animation/element_animations.h b/cc/animation/element_animations.h
index bff3661b1eb50cfe6a5045bf40617d9c5ed822f6..4c69014f40383eb3bce2a76ce1d0d2ccf898dfe9 100644
--- a/cc/animation/element_animations.h
+++ b/cc/animation/element_animations.h
@@ -37,12 +37,12 @@ enum class LayerTreeType;
// of animation layers.
// This is a CC counterpart for blink::ElementAnimations (in 1:1 relationship).
// No pointer to/from respective blink::ElementAnimations object for now.
-class CC_EXPORT ElementAnimations : public AnimationDelegate,
+class CC_EXPORT ElementAnimations : public base::RefCounted<ElementAnimations>,
+ public AnimationDelegate,
public LayerAnimationValueObserver,
public LayerAnimationValueProvider {
public:
- static std::unique_ptr<ElementAnimations> Create(AnimationHost* host);
- ~ElementAnimations() override;
+ static scoped_refptr<ElementAnimations> Create(AnimationHost* host);
int layer_id() const {
return layer_animation_controller_ ? layer_animation_controller_->id() : 0;
@@ -73,7 +73,8 @@ class CC_EXPORT ElementAnimations : public AnimationDelegate,
typedef base::LinkNode<AnimationPlayer> PlayersListNode;
const PlayersList& players_list() const { return *players_list_.get(); }
- void PushPropertiesTo(ElementAnimations* element_animations_impl);
+ void PushPropertiesTo(
+ scoped_refptr<ElementAnimations> element_animations_impl);
void AddAnimation(std::unique_ptr<Animation> animation);
void PauseAnimation(int animation_id, base::TimeDelta time_offset);
@@ -93,10 +94,13 @@ class CC_EXPORT ElementAnimations : public AnimationDelegate,
void RemoveEventObserver(LayerAnimationEventObserver* observer);
private:
+ friend class base::RefCounted<ElementAnimations>;
+
// TODO(loyso): Erase this when LAC merged into ElementAnimations.
friend class AnimationHost;
explicit ElementAnimations(AnimationHost* host);
+ ~ElementAnimations() override;
// LayerAnimationValueObserver implementation.
void OnFilterAnimated(LayerTreeType tree_type,
« no previous file with comments | « cc/animation/animation_player.cc ('k') | cc/animation/element_animations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698