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 : public GarbageCollectedFinalized<InterpolationValue>
{ |
17 public: | 17 public: |
18 static PassOwnPtrWillBeRawPtr<InterpolationValue> create(const Interpolation
Type& type, PassOwnPtrWillBeRawPtr<InterpolableValue> interpolableValue, PassRef
PtrWillBeRawPtr<NonInterpolableValue> nonInterpolableValue = nullptr) | 18 static InterpolationValue* create(const InterpolationType& type, Interpolabl
eValue* interpolableValue, NonInterpolableValue* nonInterpolableValue = nullptr) |
19 { | 19 { |
20 return adoptPtrWillBeNoop(new InterpolationValue(type, interpolableValue
, nonInterpolableValue)); | 20 return new InterpolationValue(type, interpolableValue, nonInterpolableVa
lue); |
21 } | 21 } |
22 | 22 |
23 PassOwnPtrWillBeRawPtr<InterpolationValue> clone() const | 23 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() | 33 DEFINE_INLINE_TRACE() |
34 { | 34 { |
35 visitor->trace(m_interpolableValue); | 35 visitor->trace(m_interpolableValue); |
36 visitor->trace(m_nonInterpolableValue); | 36 visitor->trace(m_nonInterpolableValue); |
37 } | 37 } |
38 | 38 |
39 private: | 39 private: |
40 InterpolationValue(const InterpolationType& type, PassOwnPtrWillBeRawPtr<Int
erpolableValue> interpolableValue, PassRefPtrWillBeRawPtr<NonInterpolableValue>
nonInterpolableValue = nullptr) | 40 InterpolationValue(const InterpolationType& type, InterpolableValue* interpo
lableValue, NonInterpolableValue* nonInterpolableValue = nullptr) |
41 : m_type(type) | 41 : m_type(type) |
42 , m_interpolableValue(interpolableValue) | 42 , m_interpolableValue(interpolableValue) |
43 , m_nonInterpolableValue(nonInterpolableValue) | 43 , m_nonInterpolableValue(nonInterpolableValue) |
44 { | 44 { |
45 ASSERT(this->m_interpolableValue); | 45 ASSERT(this->m_interpolableValue); |
46 } | 46 } |
47 | 47 |
48 const InterpolationType& m_type; | 48 const InterpolationType& m_type; |
49 OwnPtrWillBeMember<InterpolableValue> m_interpolableValue; | 49 Member<InterpolableValue> m_interpolableValue; |
50 RefPtrWillBeMember<NonInterpolableValue> m_nonInterpolableValue; | 50 Member<NonInterpolableValue> m_nonInterpolableValue; |
51 | 51 |
52 friend class InterpolationType; | 52 friend class InterpolationType; |
53 }; | 53 }; |
54 | 54 |
55 } // namespace blink | 55 } // namespace blink |
56 | 56 |
57 #endif // InterpolationValue_h | 57 #endif // InterpolationValue_h |
OLD | NEW |