Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef AnimationValue_h | |
| 6 #define AnimationValue_h | |
| 7 | |
| 8 #include "core/animation/InterpolableValue.h" | |
| 9 #include "core/animation/NonInterpolableValue.h" | |
| 10 #include "platform/heap/Handle.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class InterpolableValue; | |
| 15 | |
| 16 struct AnimationValue { | |
| 17 const AnimationType* type; | |
| 18 OwnPtrWillBeMember<InterpolableValue> interpolableValue; | |
| 19 RefPtrWillBeMember<NonInterpolableValue> nonInterpolableValue; | |
| 20 | |
| 21 operator bool() const { return bool(type); } | |
| 22 | |
| 23 AnimationValue() | |
| 24 : type(nullptr) | |
|
Eric Willigers
2015/05/27 04:26:35
Can these initializations be indented. Also for ot
alancutter (OOO until 2018)
2015/05/27 08:27:47
Done.
| |
| 25 , interpolableValue(nullptr) | |
| 26 , nonInterpolableValue(nullptr) | |
| 27 { } | |
| 28 | |
| 29 AnimationValue(const AnimationType* type, PassOwnPtrWillBeRawPtr<Interpolabl eValue> interpolableValue, RefPtrWillBeRawPtr<NonInterpolableValue> nonInterpola bleValue) | |
| 30 : type(type) | |
| 31 , interpolableValue(interpolableValue) | |
| 32 , nonInterpolableValue(nonInterpolableValue) | |
| 33 { } | |
| 34 | |
| 35 AnimationValue(const AnimationValue&) = delete; | |
| 36 AnimationValue(AnimationValue&& other) | |
| 37 : type(other.type) | |
| 38 , interpolableValue(other.interpolableValue.release()) | |
| 39 , nonInterpolableValue(other.nonInterpolableValue.release()) | |
| 40 { } | |
|
Eric Willigers
2015/05/27 04:26:34
other.type = nullptr; ?
alancutter (OOO until 2018)
2015/05/27 08:27:47
Done.
| |
| 41 | |
| 42 void copy(const AnimationValue& other) | |
| 43 { | |
| 44 type = other.type; | |
| 45 interpolableValue = other.interpolableValue ? other.interpolableValue->c lone() : nullptr; | |
| 46 nonInterpolableValue = other.nonInterpolableValue; | |
| 47 } | |
| 48 | |
| 49 void clear() | |
| 50 { | |
| 51 type = nullptr; | |
| 52 interpolableValue = nullptr; | |
| 53 nonInterpolableValue = nullptr; | |
| 54 } | |
| 55 | |
| 56 void consume(AnimationValue& other) | |
| 57 { | |
| 58 type = other.type; | |
| 59 other.type = nullptr; | |
| 60 interpolableValue = other.interpolableValue.release(); | |
| 61 nonInterpolableValue = other.nonInterpolableValue.release(); | |
| 62 } | |
| 63 | |
| 64 DEFINE_INLINE_TRACE() | |
| 65 { | |
| 66 visitor->trace(interpolableValue); | |
| 67 visitor->trace(nonInterpolableValue); | |
| 68 } | |
| 69 private: | |
| 70 DISALLOW_ALLOCATION(); | |
| 71 }; | |
| 72 | |
| 73 } // namespace blink | |
| 74 | |
| 75 #endif // AnimationValue_h | |
| OLD | NEW |