OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef InterpolationEffect_h | 5 #ifndef InterpolationEffect_h |
6 #define InterpolationEffect_h | 6 #define InterpolationEffect_h |
7 | 7 |
8 #include "core/animation/Interpolation.h" | 8 #include "core/animation/Interpolation.h" |
9 #include "platform/animation/TimingFunction.h" | 9 #include "platform/animation/TimingFunction.h" |
10 #include "wtf/PassOwnPtr.h" | 10 #include "wtf/PassOwnPtr.h" |
11 #include "wtf/RefCounted.h" | 11 #include "wtf/RefCounted.h" |
12 | 12 |
13 namespace WebCore { | 13 namespace WebCore { |
14 | 14 |
15 class InterpolationEffect : public RefCounted<InterpolationEffect> { | 15 class InterpolationEffect : public RefCounted<InterpolationEffect> { |
16 | |
17 public: | 16 public: |
18 static PassRefPtr<InterpolationEffect> create() { return adoptRef(new Interp
olationEffect()); } | 17 static PassRefPtr<InterpolationEffect> create() { return adoptRef(new Interp
olationEffect()); } |
19 | 18 |
20 PassOwnPtr<Vector<RefPtr<Interpolation> > > getActiveInterpolations(double f
raction, double iterationDuration) const; | 19 PassOwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation> >
> getActiveInterpolations(double fraction, double iterationDuration) const; |
21 | 20 |
22 void addInterpolation(PassRefPtr<Interpolation> interpolation, PassRefPtr<Ti
mingFunction> easing, double start, double end, double applyFrom, double applyTo
) | 21 void addInterpolation(PassRefPtrWillBeRawPtr<Interpolation> interpolation, P
assRefPtr<TimingFunction> easing, double start, double end, double applyFrom, do
uble applyTo) |
23 { | 22 { |
24 m_interpolations.append(InterpolationRecord::create(interpolation, easin
g, start, end, applyFrom, applyTo)); | 23 m_interpolations.append(InterpolationRecord::create(interpolation, easin
g, start, end, applyFrom, applyTo)); |
25 } | 24 } |
26 | 25 |
27 private: | 26 private: |
28 InterpolationEffect() | 27 InterpolationEffect() |
29 { } | 28 { |
| 29 } |
30 | 30 |
31 class InterpolationRecord { | 31 class InterpolationRecord : public NoBaseWillBeGarbageCollected<Interpolatio
nRecord> { |
32 public: | 32 public: |
33 RefPtr<Interpolation> m_interpolation; | 33 RefPtrWillBeMember<Interpolation> m_interpolation; |
34 RefPtr<TimingFunction> m_easing; | 34 RefPtr<TimingFunction> m_easing; |
35 double m_start; | 35 double m_start; |
36 double m_end; | 36 double m_end; |
37 double m_applyFrom; | 37 double m_applyFrom; |
38 double m_applyTo; | 38 double m_applyTo; |
39 static PassOwnPtr<InterpolationRecord> create(PassRefPtr<Interpolation>
interpolation, PassRefPtr<TimingFunction> easing, double start, double end, doub
le applyFrom, double applyTo) | 39 |
| 40 static PassOwnPtrWillBeRawPtr<InterpolationRecord> create(PassRefPtrWill
BeRawPtr<Interpolation> interpolation, PassRefPtr<TimingFunction> easing, double
start, double end, double applyFrom, double applyTo) |
40 { | 41 { |
41 return adoptPtr(new InterpolationRecord(interpolation, easing, start
, end, applyFrom, applyTo)); | 42 return adoptPtrWillBeNoop(new InterpolationRecord(interpolation, eas
ing, start, end, applyFrom, applyTo)); |
42 } | 43 } |
| 44 |
| 45 void trace(Visitor*); |
| 46 |
43 private: | 47 private: |
44 InterpolationRecord(PassRefPtr<Interpolation> interpolation, PassRefPtr<
TimingFunction> easing, double start, double end, double applyFrom, double apply
To) | 48 InterpolationRecord(PassRefPtrWillBeRawPtr<Interpolation> interpolation,
PassRefPtr<TimingFunction> easing, double start, double end, double applyFrom,
double applyTo) |
45 : m_interpolation(interpolation) | 49 : m_interpolation(interpolation) |
46 , m_easing(easing) | 50 , m_easing(easing) |
47 , m_start(start) | 51 , m_start(start) |
48 , m_end(end) | 52 , m_end(end) |
49 , m_applyFrom(applyFrom) | 53 , m_applyFrom(applyFrom) |
50 , m_applyTo(applyTo) | 54 , m_applyTo(applyTo) |
51 { } | 55 { |
| 56 } |
52 }; | 57 }; |
53 | 58 |
54 Vector<OwnPtr<InterpolationRecord> > m_interpolations; | 59 WillBePersistentHeapVector<OwnPtrWillBeMember<InterpolationRecord> > m_inter
polations; |
55 }; | 60 }; |
56 | 61 |
57 } | 62 } |
58 | 63 |
59 #endif | 64 #endif |
OLD | NEW |