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

Side by Side Diff: Source/core/animation/KeyframeEffectModel.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: Resize expect size of Persistent 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 namespace blink { 50 namespace blink {
51 51
52 class Element; 52 class Element;
53 class KeyframeEffectModelTest; 53 class KeyframeEffectModelTest;
54 54
55 class CORE_EXPORT KeyframeEffectModelBase : public EffectModel { 55 class CORE_EXPORT KeyframeEffectModelBase : public EffectModel {
56 public: 56 public:
57 // FIXME: Implement accumulation. 57 // FIXME: Implement accumulation.
58 58
59 using PropertySpecificKeyframeVector = WillBeHeapVector<OwnPtrWillBeMember<K eyframe::PropertySpecificKeyframe>>; 59 using PropertySpecificKeyframeVector = HeapVector<Member<Keyframe::PropertyS pecificKeyframe>>;
60 class PropertySpecificKeyframeGroup : public NoBaseWillBeGarbageCollected<Pr opertySpecificKeyframeGroup> { 60 class PropertySpecificKeyframeGroup : public GarbageCollected<PropertySpecif icKeyframeGroup> {
61 public: 61 public:
62 void appendKeyframe(PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKey frame>); 62 void appendKeyframe(Keyframe::PropertySpecificKeyframe*);
63 const PropertySpecificKeyframeVector& keyframes() const { return m_keyfr ames; } 63 const PropertySpecificKeyframeVector& keyframes() const { return m_keyfr ames; }
64 64
65 DECLARE_TRACE(); 65 DECLARE_TRACE();
66 66
67 private: 67 private:
68 void removeRedundantKeyframes(); 68 void removeRedundantKeyframes();
69 bool addSyntheticKeyframeIfRequired(PassRefPtr<TimingFunction> neutralKe yframeEasing); 69 bool addSyntheticKeyframeIfRequired(PassRefPtr<TimingFunction> neutralKe yframeEasing);
70 70
71 PropertySpecificKeyframeVector m_keyframes; 71 PropertySpecificKeyframeVector m_keyframes;
72 72
73 friend class KeyframeEffectModelBase; 73 friend class KeyframeEffectModelBase;
74 }; 74 };
75 75
76 bool isReplaceOnly(); 76 bool isReplaceOnly();
77 77
78 PropertyHandleSet properties() const; 78 PropertyHandleSet properties() const;
79 79
80 using KeyframeVector = WillBeHeapVector<RefPtrWillBeMember<Keyframe>>; 80 using KeyframeVector = HeapVector<Member<Keyframe>>;
81 const KeyframeVector& getFrames() const { return m_keyframes; } 81 const KeyframeVector& getFrames() const { return m_keyframes; }
82 void setFrames(KeyframeVector& keyframes); 82 void setFrames(KeyframeVector& keyframes);
83 83
84 const PropertySpecificKeyframeVector& getPropertySpecificKeyframes(PropertyH andle property) const 84 const PropertySpecificKeyframeVector& getPropertySpecificKeyframes(PropertyH andle property) const
85 { 85 {
86 ensureKeyframeGroups(); 86 ensureKeyframeGroups();
87 return m_keyframeGroups->get(property)->keyframes(); 87 return m_keyframeGroups->get(property)->keyframes();
88 } 88 }
89 89
90 // EffectModel implementation. 90 // EffectModel implementation.
91 virtual void sample(int iteration, double fraction, double iterationDuration , OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>>&) cons t override; 91 virtual void sample(int iteration, double fraction, double iterationDuration , HeapVector<Member<Interpolation>>*&) const override;
92 92
93 virtual bool isKeyframeEffectModel() const override { return true; } 93 virtual bool isKeyframeEffectModel() const override { return true; }
94 94
95 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; } 95 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; }
96 virtual bool isStringKeyframeEffectModel() const { return false; } 96 virtual bool isStringKeyframeEffectModel() const { return false; }
97 97
98 bool hasSyntheticKeyframes() const 98 bool hasSyntheticKeyframes() const
99 { 99 {
100 ensureKeyframeGroups(); 100 ensureKeyframeGroups();
101 return m_hasSyntheticKeyframes; 101 return m_hasSyntheticKeyframes;
102 } 102 }
103 103
104 DECLARE_VIRTUAL_TRACE(); 104 DECLARE_VIRTUAL_TRACE();
105 105
106 // FIXME: This is a hack used to resolve CSSValues to AnimatableValues while we have a valid handle on an element. 106 // FIXME: This is a hack used to resolve CSSValues to AnimatableValues while we have a valid handle on an element.
107 // This should be removed once AnimatableValues are obsolete. 107 // This should be removed once AnimatableValues are obsolete.
108 void forceConversionsToAnimatableValues(Element&, const ComputedStyle* baseS tyle); 108 void forceConversionsToAnimatableValues(Element&, const ComputedStyle* baseS tyle);
109 bool updateNeutralKeyframeAnimatableValues(CSSPropertyID, PassRefPtrWillBeRa wPtr<AnimatableValue>); 109 bool updateNeutralKeyframeAnimatableValues(CSSPropertyID, AnimatableValue*);
110 110
111 template<typename T> 111 template<typename T>
112 inline void forEachInterpolation(const T& callback) { m_interpolationEffect- >forEachInterpolation(callback); } 112 inline void forEachInterpolation(const T& callback) { m_interpolationEffect- >forEachInterpolation(callback); }
113 113
114 static KeyframeVector normalizedKeyframesForInspector(const KeyframeVector& keyframes) { return normalizedKeyframes(keyframes); } 114 static KeyframeVector normalizedKeyframesForInspector(const KeyframeVector& keyframes) { return normalizedKeyframes(keyframes); }
115 115
116 bool affects(PropertyHandle property) const override 116 bool affects(PropertyHandle property) const override
117 { 117 {
118 ensureKeyframeGroups(); 118 ensureKeyframeGroups();
119 return m_keyframeGroups->contains(property); 119 return m_keyframeGroups->contains(property);
120 } 120 }
121 121
122 protected: 122 protected:
123 KeyframeEffectModelBase(PassRefPtrWillBeRawPtr<TimingFunction> neutralKeyfra meEasing) 123 KeyframeEffectModelBase(PassRefPtrWillBeRawPtr<TimingFunction> neutralKeyfra meEasing)
124 : m_neutralKeyframeEasing(neutralKeyframeEasing) 124 : m_neutralKeyframeEasing(neutralKeyframeEasing)
125 { 125 {
126 } 126 }
127 127
128 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); 128 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes);
129 129
130 // Lazily computes the groups of property-specific keyframes. 130 // Lazily computes the groups of property-specific keyframes.
131 void ensureKeyframeGroups() const; 131 void ensureKeyframeGroups() const;
132 void ensureInterpolationEffect(Element* = nullptr, const ComputedStyle* base Style = nullptr) const; 132 void ensureInterpolationEffect(Element* = nullptr, const ComputedStyle* base Style = nullptr) const;
133 void snapshotCompositableProperties(Element&, const ComputedStyle* baseStyle ); 133 void snapshotCompositableProperties(Element&, const ComputedStyle* baseStyle );
134 134
135 KeyframeVector m_keyframes; 135 KeyframeVector m_keyframes;
136 // The spec describes filtering the normalized keyframes at sampling time 136 // The spec describes filtering the normalized keyframes at sampling time
137 // to get the 'property-specific keyframes'. For efficiency, we cache the 137 // to get the 'property-specific keyframes'. For efficiency, we cache the
138 // property-specific lists. 138 // property-specific lists.
139 using KeyframeGroupMap = WillBeHeapHashMap<PropertyHandle, OwnPtrWillBeMembe r<PropertySpecificKeyframeGroup>>; 139 using KeyframeGroupMap = HeapHashMap<PropertyHandle, Member<PropertySpecific KeyframeGroup>>;
140 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups; 140 mutable Member<KeyframeGroupMap> m_keyframeGroups;
141 mutable RefPtrWillBeMember<InterpolationEffect> m_interpolationEffect; 141 mutable Member<InterpolationEffect> m_interpolationEffect;
142 RefPtr<TimingFunction> m_neutralKeyframeEasing; 142 RefPtr<TimingFunction> m_neutralKeyframeEasing;
143 143
144 mutable bool m_hasSyntheticKeyframes; 144 mutable bool m_hasSyntheticKeyframes;
145 145
146 friend class KeyframeEffectModelTest; 146 friend class KeyframeEffectModelTest;
147 }; 147 };
148 148
149 template <class Keyframe> 149 template <class Keyframe>
150 class KeyframeEffectModel final : public KeyframeEffectModelBase { 150 class KeyframeEffectModel final : public KeyframeEffectModelBase {
151 public: 151 public:
152 using KeyframeVector = WillBeHeapVector<RefPtrWillBeMember<Keyframe>>; 152 using KeyframeVector = HeapVector<Member<Keyframe>>;
153 static PassRefPtrWillBeRawPtr<KeyframeEffectModel<Keyframe>> create(const Ke yframeVector& keyframes, PassRefPtrWillBeRawPtr<TimingFunction> neutralKeyframeE asing = nullptr) 153 static KeyframeEffectModel<Keyframe>* create(const KeyframeVector& keyframes , PassRefPtrWillBeRawPtr<TimingFunction> neutralKeyframeEasing = nullptr)
154 { 154 {
155 return adoptRefWillBeNoop(new KeyframeEffectModel(keyframes, neutralKeyf rameEasing)); 155 return new KeyframeEffectModel(keyframes, neutralKeyframeEasing);
156 } 156 }
157 157
158 private: 158 private:
159 KeyframeEffectModel(const KeyframeVector& keyframes, PassRefPtrWillBeRawPtr< TimingFunction> neutralKeyframeEasing) 159 KeyframeEffectModel(const KeyframeVector& keyframes, PassRefPtrWillBeRawPtr< TimingFunction> neutralKeyframeEasing)
160 : KeyframeEffectModelBase(neutralKeyframeEasing) 160 : KeyframeEffectModelBase(neutralKeyframeEasing)
161 { 161 {
162 m_keyframes.appendVector(keyframes); 162 m_keyframes.appendVector(keyframes);
163 } 163 }
164 164
165 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; } 165 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 template <> 204 template <>
205 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; } 205 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; }
206 206
207 template <> 207 template <>
208 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; } 208 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; }
209 209
210 } // namespace blink 210 } // namespace blink
211 211
212 #endif // KeyframeEffectModel_h 212 #endif // KeyframeEffectModel_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698