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

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: Rebase Created 5 years, 4 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
« no previous file with comments | « Source/core/animation/KeyframeEffect.cpp ('k') | Source/core/animation/KeyframeEffectModel.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 void sample(int iteration, double fraction, double iterationDuration, OwnPtr WillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>>&) const overri de; 91 void sample(int iteration, double fraction, double iterationDuration, HeapVe ctor<Member<Interpolation>>*&) const override;
92 92
93 bool isKeyframeEffectModel() const override { return true; } 93 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);
(...skipping 11 matching lines...) Expand all
131 131
132 // Lazily computes the groups of property-specific keyframes. 132 // Lazily computes the groups of property-specific keyframes.
133 void ensureKeyframeGroups() const; 133 void ensureKeyframeGroups() const;
134 void ensureInterpolationEffect(Element* = nullptr, const ComputedStyle* base Style = nullptr) const; 134 void ensureInterpolationEffect(Element* = nullptr, const ComputedStyle* base Style = nullptr) const;
135 void snapshotCompositableProperties(Element&, const ComputedStyle* baseStyle ); 135 void snapshotCompositableProperties(Element&, const ComputedStyle* baseStyle );
136 136
137 KeyframeVector m_keyframes; 137 KeyframeVector m_keyframes;
138 // The spec describes filtering the normalized keyframes at sampling time 138 // The spec describes filtering the normalized keyframes at sampling time
139 // to get the 'property-specific keyframes'. For efficiency, we cache the 139 // to get the 'property-specific keyframes'. For efficiency, we cache the
140 // property-specific lists. 140 // property-specific lists.
141 using KeyframeGroupMap = WillBeHeapHashMap<PropertyHandle, OwnPtrWillBeMembe r<PropertySpecificKeyframeGroup>>; 141 using KeyframeGroupMap = HeapHashMap<PropertyHandle, Member<PropertySpecific KeyframeGroup>>;
142 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups; 142 mutable Member<KeyframeGroupMap> m_keyframeGroups;
143 mutable RefPtrWillBeMember<InterpolationEffect> m_interpolationEffect; 143 mutable Member<InterpolationEffect> m_interpolationEffect;
144 RefPtr<TimingFunction> m_neutralKeyframeEasing; 144 RefPtr<TimingFunction> m_neutralKeyframeEasing;
145 145
146 mutable bool m_hasSyntheticKeyframes; 146 mutable bool m_hasSyntheticKeyframes;
147 147
148 friend class KeyframeEffectModelTest; 148 friend class KeyframeEffectModelTest;
149 }; 149 };
150 150
151 template <class Keyframe> 151 template <class Keyframe>
152 class KeyframeEffectModel final : public KeyframeEffectModelBase { 152 class KeyframeEffectModel final : public KeyframeEffectModelBase {
153 public: 153 public:
154 using KeyframeVector = WillBeHeapVector<RefPtrWillBeMember<Keyframe>>; 154 using KeyframeVector = HeapVector<Member<Keyframe>>;
155 static PassRefPtrWillBeRawPtr<KeyframeEffectModel<Keyframe>> create(const Ke yframeVector& keyframes, PassRefPtrWillBeRawPtr<TimingFunction> neutralKeyframeE asing = nullptr) 155 static KeyframeEffectModel<Keyframe>* create(const KeyframeVector& keyframes , PassRefPtrWillBeRawPtr<TimingFunction> neutralKeyframeEasing = nullptr)
156 { 156 {
157 return adoptRefWillBeNoop(new KeyframeEffectModel(keyframes, neutralKeyf rameEasing)); 157 return new KeyframeEffectModel(keyframes, neutralKeyframeEasing);
158 } 158 }
159 159
160 private: 160 private:
161 KeyframeEffectModel(const KeyframeVector& keyframes, PassRefPtrWillBeRawPtr< TimingFunction> neutralKeyframeEasing) 161 KeyframeEffectModel(const KeyframeVector& keyframes, PassRefPtrWillBeRawPtr< TimingFunction> neutralKeyframeEasing)
162 : KeyframeEffectModelBase(neutralKeyframeEasing) 162 : KeyframeEffectModelBase(neutralKeyframeEasing)
163 { 163 {
164 m_keyframes.appendVector(keyframes); 164 m_keyframes.appendVector(keyframes);
165 } 165 }
166 166
167 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; } 167 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 template <> 206 template <>
207 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; } 207 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; }
208 208
209 template <> 209 template <>
210 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; } 210 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; }
211 211
212 } // namespace blink 212 } // namespace blink
213 213
214 #endif // KeyframeEffectModel_h 214 #endif // KeyframeEffectModel_h
OLDNEW
« no previous file with comments | « Source/core/animation/KeyframeEffect.cpp ('k') | Source/core/animation/KeyframeEffectModel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698