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

Side by Side Diff: Source/core/animation/ElementAnimations.h

Issue 1120003002: [Oilpan] Migrate most classes under core/animations to Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Build fix Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 26 matching lines...) Expand all
37 #include "wtf/HashMap.h" 37 #include "wtf/HashMap.h"
38 #include "wtf/RefPtr.h" 38 #include "wtf/RefPtr.h"
39 #include "wtf/Vector.h" 39 #include "wtf/Vector.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 class CSSAnimations; 43 class CSSAnimations;
44 44
45 using AnimationPlayerCountedSet = WillBeHeapHashCountedSet<RawPtrWillBeWeakMembe r<AnimationPlayer>>; 45 using AnimationPlayerCountedSet = WillBeHeapHashCountedSet<RawPtrWillBeWeakMembe r<AnimationPlayer>>;
46 46
47 class ElementAnimations : public NoBaseWillBeGarbageCollectedFinalized<ElementAn imations> { 47 class ElementAnimations : public GarbageCollectedFinalized<ElementAnimations> {
48 WTF_MAKE_NONCOPYABLE(ElementAnimations); 48 WTF_MAKE_NONCOPYABLE(ElementAnimations);
49 public: 49 public:
50 ElementAnimations(); 50 ElementAnimations();
51 ~ElementAnimations(); 51 ~ElementAnimations();
52 52
53 // Animations that are currently active for this element, their effects will be applied 53 // Animations that are currently active for this element, their effects will be applied
54 // during a style recalc. CSS Transitions are included in this stack. 54 // during a style recalc. CSS Transitions are included in this stack.
55 AnimationStack& defaultStack() { return m_defaultStack; } 55 AnimationStack& defaultStack() { return m_defaultStack; }
56 const AnimationStack& defaultStack() const { return m_defaultStack; } 56 const AnimationStack& defaultStack() const { return m_defaultStack; }
57 // Tracks the state of active CSS Animations and Transitions. The individual animations 57 // Tracks the state of active CSS Animations and Transitions. The individual animations
58 // will also be part of the default stack, but the mapping betwen animation name and 58 // will also be part of the default stack, but the mapping betwen animation name and
59 // player is kept here. 59 // player is kept here.
60 CSSAnimations& cssAnimations() { return m_cssAnimations; } 60 CSSAnimations& cssAnimations() { return m_cssAnimations; }
61 const CSSAnimations& cssAnimations() const { return m_cssAnimations; } 61 const CSSAnimations& cssAnimations() const { return m_cssAnimations; }
62 62
63 // AnimationPlayers which have animations targeting this element. 63 // AnimationPlayers which have animations targeting this element.
64 AnimationPlayerCountedSet& players() { return m_players; } 64 AnimationPlayerCountedSet& players() { return m_players; }
65 65
66 bool isEmpty() const { return m_defaultStack.isEmpty() && m_cssAnimations.is Empty() && m_players.isEmpty(); } 66 bool isEmpty() const { return m_defaultStack.isEmpty() && m_cssAnimations.is Empty() && m_players.isEmpty(); }
67 67
68 void restartAnimationOnCompositor(); 68 void restartAnimationOnCompositor();
69 69
70 void updateAnimationFlags(ComputedStyle&); 70 void updateAnimationFlags(ComputedStyle&);
71 void setAnimationStyleChange(bool animationStyleChange) { m_animationStyleCh ange = animationStyleChange; } 71 void setAnimationStyleChange(bool animationStyleChange) { m_animationStyleCh ange = animationStyleChange; }
72 72
73 const ComputedStyle* baseComputedStyle() const; 73 const ComputedStyle* baseComputedStyle() const;
74 void updateBaseComputedStyle(const ComputedStyle*); 74 void updateBaseComputedStyle(const ComputedStyle*);
75 void clearBaseComputedStyle(); 75 void clearBaseComputedStyle();
76 76
77 #if !ENABLE(OILPAN)
78 void addAnimation(Animation* animation) { m_animations.append(animation); }
79 void notifyAnimationDestroyed(Animation* animation) { m_animations.remove(m_ animations.find(animation)); }
haraken 2015/05/08 00:13:06 Ditto.
peria 2015/05/08 02:21:20 Acknowledged.
80 #endif
81
82 DECLARE_TRACE(); 77 DECLARE_TRACE();
83 78
84 private: 79 private:
85 bool isAnimationStyleChange() const; 80 bool isAnimationStyleChange() const;
86 81
87 AnimationStack m_defaultStack; 82 AnimationStack m_defaultStack;
88 CSSAnimations m_cssAnimations; 83 CSSAnimations m_cssAnimations;
89 AnimationPlayerCountedSet m_players; 84 AnimationPlayerCountedSet m_players;
90 bool m_animationStyleChange; 85 bool m_animationStyleChange;
91 RefPtr<ComputedStyle> m_baseComputedStyle; 86 RefPtr<ComputedStyle> m_baseComputedStyle;
92 87
93 #if !ENABLE(OILPAN)
94 // FIXME: Oilpan: This is to avoid a reference cycle that keeps Elements ali ve
95 // and won't be needed once the Node hierarchy becomes traceable.
96 Vector<Animation*> m_animations;
haraken 2015/05/08 00:13:06 Ditto.
peria 2015/05/08 02:21:20 Acknowledged.
97 #endif
98
99 // CSSAnimations and DeferredLegacyStyleInterpolation checks if a style chan ge is due to animation. 88 // CSSAnimations and DeferredLegacyStyleInterpolation checks if a style chan ge is due to animation.
100 friend class CSSAnimations; 89 friend class CSSAnimations;
101 friend class DeferredLegacyStyleInterpolation; 90 friend class DeferredLegacyStyleInterpolation;
102 }; 91 };
103 92
104 } // namespace blink 93 } // namespace blink
105 94
106 #endif // ElementAnimations_h 95 #endif // ElementAnimations_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698