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

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

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 "core/animation/InterpolationEffect.h" 37 #include "core/animation/InterpolationEffect.h"
38 #include "core/animation/PropertyHandle.h" 38 #include "core/animation/PropertyHandle.h"
39 #include "core/animation/StringKeyframe.h" 39 #include "core/animation/StringKeyframe.h"
40 #include "core/animation/animatable/AnimatableValueKeyframe.h" 40 #include "core/animation/animatable/AnimatableValueKeyframe.h"
41 #include "platform/animation/TimingFunction.h" 41 #include "platform/animation/TimingFunction.h"
42 #include "platform/heap/Handle.h" 42 #include "platform/heap/Handle.h"
43 #include "wtf/HashMap.h" 43 #include "wtf/HashMap.h"
44 #include "wtf/HashSet.h" 44 #include "wtf/HashSet.h"
45 #include "wtf/PassRefPtr.h" 45 #include "wtf/PassRefPtr.h"
46 #include "wtf/Vector.h" 46 #include "wtf/Vector.h"
47 #include <memory>
47 48
48 namespace blink { 49 namespace blink {
49 50
50 class Element; 51 class Element;
51 class KeyframeEffectModelTest; 52 class KeyframeEffectModelTest;
52 53
53 class CORE_EXPORT KeyframeEffectModelBase : public EffectModel { 54 class CORE_EXPORT KeyframeEffectModelBase : public EffectModel {
54 public: 55 public:
55 // FIXME: Implement accumulation. 56 // FIXME: Implement accumulation.
56 57
(...skipping 19 matching lines...) Expand all
76 using KeyframeVector = Vector<RefPtr<Keyframe>>; 77 using KeyframeVector = Vector<RefPtr<Keyframe>>;
77 const KeyframeVector& getFrames() const { return m_keyframes; } 78 const KeyframeVector& getFrames() const { return m_keyframes; }
78 void setFrames(KeyframeVector& keyframes); 79 void setFrames(KeyframeVector& keyframes);
79 80
80 const PropertySpecificKeyframeVector& getPropertySpecificKeyframes(PropertyH andle property) const 81 const PropertySpecificKeyframeVector& getPropertySpecificKeyframes(PropertyH andle property) const
81 { 82 {
82 ensureKeyframeGroups(); 83 ensureKeyframeGroups();
83 return m_keyframeGroups->get(property)->keyframes(); 84 return m_keyframeGroups->get(property)->keyframes();
84 } 85 }
85 86
86 using KeyframeGroupMap = HashMap<PropertyHandle, OwnPtr<PropertySpecificKeyf rameGroup>>; 87 using KeyframeGroupMap = HashMap<PropertyHandle, std::unique_ptr<PropertySpe cificKeyframeGroup>>;
87 const KeyframeGroupMap& getPropertySpecificKeyframeGroups() const 88 const KeyframeGroupMap& getPropertySpecificKeyframeGroups() const
88 { 89 {
89 ensureKeyframeGroups(); 90 ensureKeyframeGroups();
90 return *m_keyframeGroups; 91 return *m_keyframeGroups;
91 } 92 }
92 93
93 // EffectModel implementation. 94 // EffectModel implementation.
94 bool sample(int iteration, double fraction, double iterationDuration, Vector <RefPtr<Interpolation>>&) const override; 95 bool sample(int iteration, double fraction, double iterationDuration, Vector <RefPtr<Interpolation>>&) const override;
95 96
96 bool isKeyframeEffectModel() const override { return true; } 97 bool isKeyframeEffectModel() const override { return true; }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); 134 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes);
134 135
135 // Lazily computes the groups of property-specific keyframes. 136 // Lazily computes the groups of property-specific keyframes.
136 void ensureKeyframeGroups() const; 137 void ensureKeyframeGroups() const;
137 void ensureInterpolationEffectPopulated() const; 138 void ensureInterpolationEffectPopulated() const;
138 139
139 KeyframeVector m_keyframes; 140 KeyframeVector m_keyframes;
140 // The spec describes filtering the normalized keyframes at sampling time 141 // The spec describes filtering the normalized keyframes at sampling time
141 // to get the 'property-specific keyframes'. For efficiency, we cache the 142 // to get the 'property-specific keyframes'. For efficiency, we cache the
142 // property-specific lists. 143 // property-specific lists.
143 mutable OwnPtr<KeyframeGroupMap> m_keyframeGroups; 144 mutable std::unique_ptr<KeyframeGroupMap> m_keyframeGroups;
144 mutable InterpolationEffect m_interpolationEffect; 145 mutable InterpolationEffect m_interpolationEffect;
145 mutable int m_lastIteration; 146 mutable int m_lastIteration;
146 mutable double m_lastFraction; 147 mutable double m_lastFraction;
147 mutable double m_lastIterationDuration; 148 mutable double m_lastIterationDuration;
148 RefPtr<TimingFunction> m_defaultKeyframeEasing; 149 RefPtr<TimingFunction> m_defaultKeyframeEasing;
149 150
150 mutable bool m_hasSyntheticKeyframes; 151 mutable bool m_hasSyntheticKeyframes;
151 152
152 friend class KeyframeEffectModelTest; 153 friend class KeyframeEffectModelTest;
153 }; 154 };
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 211
211 template <> 212 template <>
212 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; } 213 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; }
213 214
214 template <> 215 template <>
215 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; } 216 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; }
216 217
217 } // namespace blink 218 } // namespace blink
218 219
219 #endif // KeyframeEffectModel_h 220 #endif // KeyframeEffectModel_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698