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

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

Issue 204743002: Oilpan: Move AnimatableValue's hierarchy to oilpan's heap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/animation/Interpolation.h ('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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 AnimationEffect::CompositeOperation composite() const { return m_composite; } 66 AnimationEffect::CompositeOperation composite() const { return m_composite; }
67 void setEasing(PassRefPtr<TimingFunction>); 67 void setEasing(PassRefPtr<TimingFunction>);
68 TimingFunction* easing() const { return m_easing.get(); } 68 TimingFunction* easing() const { return m_easing.get(); }
69 void setPropertyValue(CSSPropertyID, const AnimatableValue*); 69 void setPropertyValue(CSSPropertyID, const AnimatableValue*);
70 void clearPropertyValue(CSSPropertyID); 70 void clearPropertyValue(CSSPropertyID);
71 const AnimatableValue* propertyValue(CSSPropertyID) const; 71 const AnimatableValue* propertyValue(CSSPropertyID) const;
72 PropertySet properties() const; 72 PropertySet properties() const;
73 PassRefPtrWillBeRawPtr<Keyframe> clone() const { return adoptRefWillBeNoop(n ew Keyframe(*this)); } 73 PassRefPtrWillBeRawPtr<Keyframe> clone() const { return adoptRefWillBeNoop(n ew Keyframe(*this)); }
74 PassRefPtrWillBeRawPtr<Keyframe> cloneWithOffset(double offset) const; 74 PassRefPtrWillBeRawPtr<Keyframe> cloneWithOffset(double offset) const;
75 75
76 void trace(Visitor*) { } 76 void trace(Visitor*);
77
77 private: 78 private:
78 Keyframe(); 79 Keyframe();
79 Keyframe(const Keyframe&); 80 Keyframe(const Keyframe&);
80 double m_offset; 81 double m_offset;
81 AnimationEffect::CompositeOperation m_composite; 82 AnimationEffect::CompositeOperation m_composite;
82 RefPtr<TimingFunction> m_easing; 83 RefPtr<TimingFunction> m_easing;
83 typedef HashMap<CSSPropertyID, RefPtr<AnimatableValue> > PropertyValueMap; 84 typedef WillBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<AnimatableValue> > PropertyValueMap;
84 PropertyValueMap m_propertyValues; 85 PropertyValueMap m_propertyValues;
85 }; 86 };
86 87
87 class KeyframeEffectModel FINAL : public AnimationEffect { 88 class KeyframeEffectModel FINAL : public AnimationEffect {
88 public: 89 public:
89 class PropertySpecificKeyframe; 90 class PropertySpecificKeyframe;
90 typedef WillBeHeapVector<RefPtrWillBeMember<Keyframe> > KeyframeVector; 91 typedef WillBeHeapVector<RefPtrWillBeMember<Keyframe> > KeyframeVector;
91 typedef Vector<OwnPtr<PropertySpecificKeyframe> > PropertySpecificKeyframeVe ctor; 92 typedef WillBeHeapVector<OwnPtrWillBeMember<PropertySpecificKeyframe> > Prop ertySpecificKeyframeVector;
92 // FIXME: Implement accumulation. 93 // FIXME: Implement accumulation.
93 static PassRefPtrWillBeRawPtr<KeyframeEffectModel> create(const KeyframeVect or& keyframes) 94 static PassRefPtrWillBeRawPtr<KeyframeEffectModel> create(const KeyframeVect or& keyframes)
94 { 95 {
95 return adoptRefWillBeNoop(new KeyframeEffectModel(keyframes)); 96 return adoptRefWillBeNoop(new KeyframeEffectModel(keyframes));
96 } 97 }
97 98
98 virtual bool affects(CSSPropertyID property) OVERRIDE 99 virtual bool affects(CSSPropertyID property) OVERRIDE
99 { 100 {
100 ensureKeyframeGroups(); 101 ensureKeyframeGroups();
101 return m_keyframeGroups->contains(property); 102 return m_keyframeGroups->contains(property);
102 } 103 }
103 104
104 // AnimationEffect implementation. 105 // AnimationEffect implementation.
105 virtual PassOwnPtr<Vector<RefPtr<Interpolation> > > sample(int iteration, do uble fraction) const OVERRIDE; 106 virtual PassOwnPtr<Vector<RefPtr<Interpolation> > > sample(int iteration, do uble fraction) const OVERRIDE;
106 107
107 // FIXME: Implement setFrames() 108 // FIXME: Implement setFrames()
108 const KeyframeVector& getFrames() const { return m_keyframes; } 109 const KeyframeVector& getFrames() const { return m_keyframes; }
109 110
110 virtual bool isKeyframeEffectModel() const OVERRIDE { return true; } 111 virtual bool isKeyframeEffectModel() const OVERRIDE { return true; }
111 112
112 bool isReplaceOnly(); 113 bool isReplaceOnly();
113 114
114 PropertySet properties() const; 115 PropertySet properties() const;
115 116
116 class PropertySpecificKeyframe { 117 class PropertySpecificKeyframe : public NoBaseWillBeGarbageCollectedFinalize d<PropertySpecificKeyframe> {
117 public: 118 public:
118 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, const AnimatableValue*, CompositeOperation); 119 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, const AnimatableValue*, CompositeOperation);
119 double offset() const { return m_offset; } 120 double offset() const { return m_offset; }
120 TimingFunction* easing() const { return m_easing.get(); } 121 TimingFunction* easing() const { return m_easing.get(); }
121 const AnimatableValue* value() const { return m_value.get(); } 122 const AnimatableValue* value() const { return m_value.get(); }
122 AnimationEffect::CompositeOperation composite() const { return m_composi te; } 123 AnimationEffect::CompositeOperation composite() const { return m_composi te; }
123 PassOwnPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) cons t; 124 PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe> cloneWithOffset(double offset) const;
125
126 void trace(Visitor*);
127
124 private: 128 private:
125 // Used by cloneWithOffset(). 129 // Used by cloneWithOffset().
126 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, PassRefPtr<AnimatableValue>, CompositeOperation); 130 PropertySpecificKeyframe(double offset, PassRefPtr<TimingFunction> easin g, PassRefPtrWillBeRawPtr<AnimatableValue>, CompositeOperation);
127 double m_offset; 131 double m_offset;
128 RefPtr<TimingFunction> m_easing; 132 RefPtr<TimingFunction> m_easing;
129 RefPtr<AnimatableValue> m_value; 133 RefPtrWillBeMember<AnimatableValue> m_value;
130 AnimationEffect::CompositeOperation m_composite; 134 AnimationEffect::CompositeOperation m_composite;
131 }; 135 };
132 136
133 class PropertySpecificKeyframeGroup { 137 class PropertySpecificKeyframeGroup : public NoBaseWillBeGarbageCollectedFin alized<PropertySpecificKeyframeGroup> {
134 public: 138 public:
135 void appendKeyframe(PassOwnPtr<PropertySpecificKeyframe>); 139 void appendKeyframe(PassOwnPtrWillBeRawPtr<PropertySpecificKeyframe>);
136 const PropertySpecificKeyframeVector& keyframes() const { return m_keyfr ames; } 140 const PropertySpecificKeyframeVector& keyframes() const { return m_keyfr ames; }
141
142 void trace(Visitor*);
143
137 private: 144 private:
138 PropertySpecificKeyframeVector m_keyframes; 145 PropertySpecificKeyframeVector m_keyframes;
139 void removeRedundantKeyframes(); 146 void removeRedundantKeyframes();
140 void addSyntheticKeyframeIfRequired(); 147 void addSyntheticKeyframeIfRequired();
141 148
142 friend class KeyframeEffectModel; 149 friend class KeyframeEffectModel;
143 }; 150 };
144 151
145 const PropertySpecificKeyframeVector& getPropertySpecificKeyframes(CSSProper tyID id) const 152 const PropertySpecificKeyframeVector& getPropertySpecificKeyframes(CSSProper tyID id) const
146 { 153 {
147 ensureKeyframeGroups(); 154 ensureKeyframeGroups();
148 return m_keyframeGroups->get(id)->keyframes(); 155 return m_keyframeGroups->get(id)->keyframes();
149 } 156 }
150 157
151 virtual void trace(Visitor*) OVERRIDE; 158 virtual void trace(Visitor*) OVERRIDE;
152 159
153 private: 160 private:
154 KeyframeEffectModel(const KeyframeVector& keyframes); 161 KeyframeEffectModel(const KeyframeVector& keyframes);
155 162
156 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); 163 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes);
157 164
158 // Lazily computes the groups of property-specific keyframes. 165 // Lazily computes the groups of property-specific keyframes.
159 void ensureKeyframeGroups() const; 166 void ensureKeyframeGroups() const;
160 void ensureInterpolationEffect() const; 167 void ensureInterpolationEffect() const;
161 168
162 KeyframeVector m_keyframes; 169 KeyframeVector m_keyframes;
163 // The spec describes filtering the normalized keyframes at sampling time 170 // The spec describes filtering the normalized keyframes at sampling time
164 // to get the 'property-specific keyframes'. For efficiency, we cache the 171 // to get the 'property-specific keyframes'. For efficiency, we cache the
165 // property-specific lists. 172 // property-specific lists.
166 typedef HashMap<CSSPropertyID, OwnPtr<PropertySpecificKeyframeGroup> > Keyfr ameGroupMap; 173 typedef WillBeHeapHashMap<CSSPropertyID, OwnPtrWillBeMember<PropertySpecific KeyframeGroup> > KeyframeGroupMap;
167 mutable OwnPtr<KeyframeGroupMap> m_keyframeGroups; 174 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups;
168 175
169 mutable RefPtr<InterpolationEffect> m_interpolationEffect; 176 mutable RefPtr<InterpolationEffect> m_interpolationEffect;
170 177
171 friend class KeyframeEffectModelTest; 178 friend class KeyframeEffectModelTest;
172 }; 179 };
173 180
174 DEFINE_TYPE_CASTS(KeyframeEffectModel, AnimationEffect, value, value->isKeyframe EffectModel(), value.isKeyframeEffectModel()); 181 DEFINE_TYPE_CASTS(KeyframeEffectModel, AnimationEffect, value, value->isKeyframe EffectModel(), value.isKeyframeEffectModel());
175 182
176 } // namespace WebCore 183 } // namespace WebCore
177 184
178 #endif // KeyframeEffectModel_h 185 #endif // KeyframeEffectModel_h
OLDNEW
« no previous file with comments | « Source/core/animation/Interpolation.h ('k') | Source/core/animation/KeyframeEffectModel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698