OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 InterpolationValue_h | 5 #ifndef InterpolationValue_h |
6 #define InterpolationValue_h | 6 #define InterpolationValue_h |
7 | 7 |
8 #include "core/animation/InterpolableValue.h" | 8 #include "core/animation/InterpolableValue.h" |
9 #include "core/animation/NonInterpolableValue.h" | 9 #include "core/animation/NonInterpolableValue.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class InterpolationType; | 14 class InterpolationType; |
15 | 15 |
16 class InterpolationValue : public NoBaseWillBeGarbageCollectedFinalized<Interpol
ationValue> { | 16 class InterpolationValue { |
17 public: | 17 public: |
18 static PassOwnPtrWillBeRawPtr<InterpolationValue> create(const Interpolation
Type& type, PassOwnPtrWillBeRawPtr<InterpolableValue> interpolableValue, PassRef
PtrWillBeRawPtr<NonInterpolableValue> nonInterpolableValue = nullptr) | 18 static PassOwnPtr<InterpolationValue> create(const InterpolationType& type,
PassOwnPtr<InterpolableValue> interpolableValue, PassRefPtrWillBeRawPtr<NonInter
polableValue> nonInterpolableValue = nullptr) |
19 { | 19 { |
20 return adoptPtrWillBeNoop(new InterpolationValue(type, interpolableValue
, nonInterpolableValue)); | 20 return adoptPtr(new InterpolationValue(type, interpolableValue, nonInter
polableValue)); |
21 } | 21 } |
22 | 22 |
23 PassOwnPtrWillBeRawPtr<InterpolationValue> clone() const | 23 PassOwnPtr<InterpolationValue> clone() const |
24 { | 24 { |
25 return create(m_type, m_interpolableValue->clone(), m_nonInterpolableVal
ue); | 25 return create(m_type, m_interpolableValue->clone(), m_nonInterpolableVal
ue); |
26 } | 26 } |
27 | 27 |
28 const InterpolationType& type() const { return m_type; } | 28 const InterpolationType& type() const { return m_type; } |
29 const InterpolableValue& interpolableValue() const { return *m_interpolableV
alue; } | 29 const InterpolableValue& interpolableValue() const { return *m_interpolableV
alue; } |
30 InterpolableValue& interpolableValue() { return *m_interpolableValue; } | 30 InterpolableValue& interpolableValue() { return *m_interpolableValue; } |
31 const NonInterpolableValue* nonInterpolableValue() const { return m_nonInter
polableValue.get(); } | 31 const NonInterpolableValue* nonInterpolableValue() const { return m_nonInter
polableValue.get(); } |
32 | 32 |
33 DEFINE_INLINE_TRACE() | |
34 { | |
35 visitor->trace(m_interpolableValue); | |
36 visitor->trace(m_nonInterpolableValue); | |
37 } | |
38 | |
39 private: | 33 private: |
40 InterpolationValue(const InterpolationType& type, PassOwnPtrWillBeRawPtr<Int
erpolableValue> interpolableValue, PassRefPtrWillBeRawPtr<NonInterpolableValue>
nonInterpolableValue = nullptr) | 34 InterpolationValue(const InterpolationType& type, PassOwnPtr<InterpolableVal
ue> interpolableValue, PassRefPtrWillBeRawPtr<NonInterpolableValue> nonInterpola
bleValue = nullptr) |
41 : m_type(type) | 35 : m_type(type) |
42 , m_interpolableValue(interpolableValue) | 36 , m_interpolableValue(interpolableValue) |
43 , m_nonInterpolableValue(nonInterpolableValue) | 37 , m_nonInterpolableValue(nonInterpolableValue) |
44 { | 38 { |
45 ASSERT(this->m_interpolableValue); | 39 ASSERT(this->m_interpolableValue); |
46 } | 40 } |
47 | 41 |
48 const InterpolationType& m_type; | 42 const InterpolationType& m_type; |
49 OwnPtrWillBeMember<InterpolableValue> m_interpolableValue; | 43 OwnPtr<InterpolableValue> m_interpolableValue; |
50 RefPtrWillBeMember<NonInterpolableValue> m_nonInterpolableValue; | 44 RefPtrWillBePersistent<NonInterpolableValue> m_nonInterpolableValue; |
51 | 45 |
52 friend class InterpolationType; | 46 friend class InterpolationType; |
53 }; | 47 }; |
54 | 48 |
55 } // namespace blink | 49 } // namespace blink |
56 | 50 |
57 #endif // InterpolationValue_h | 51 #endif // InterpolationValue_h |
OLD | NEW |