Chromium Code Reviews| Index: Source/core/animation/AnimationValue.h |
| diff --git a/Source/core/animation/AnimationValue.h b/Source/core/animation/AnimationValue.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7009770cf1740082f419584d8ae9c6a5601cf9e6 |
| --- /dev/null |
| +++ b/Source/core/animation/AnimationValue.h |
| @@ -0,0 +1,75 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef AnimationValue_h |
| +#define AnimationValue_h |
| + |
| +#include "core/animation/InterpolableValue.h" |
| +#include "core/animation/NonInterpolableValue.h" |
| +#include "platform/heap/Handle.h" |
| + |
| +namespace blink { |
| + |
| +class InterpolableValue; |
| + |
| +struct AnimationValue { |
| + const AnimationType* type; |
| + OwnPtrWillBeMember<InterpolableValue> interpolableValue; |
| + RefPtrWillBeMember<NonInterpolableValue> nonInterpolableValue; |
| + |
| + operator bool() const { return bool(type); } |
| + |
| + AnimationValue() |
| + : 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.
|
| + , interpolableValue(nullptr) |
| + , nonInterpolableValue(nullptr) |
| + { } |
| + |
| + AnimationValue(const AnimationType* type, PassOwnPtrWillBeRawPtr<InterpolableValue> interpolableValue, RefPtrWillBeRawPtr<NonInterpolableValue> nonInterpolableValue) |
| + : type(type) |
| + , interpolableValue(interpolableValue) |
| + , nonInterpolableValue(nonInterpolableValue) |
| + { } |
| + |
| + AnimationValue(const AnimationValue&) = delete; |
| + AnimationValue(AnimationValue&& other) |
| + : type(other.type) |
| + , interpolableValue(other.interpolableValue.release()) |
| + , nonInterpolableValue(other.nonInterpolableValue.release()) |
| + { } |
|
Eric Willigers
2015/05/27 04:26:34
other.type = nullptr; ?
alancutter (OOO until 2018)
2015/05/27 08:27:47
Done.
|
| + |
| + void copy(const AnimationValue& other) |
| + { |
| + type = other.type; |
| + interpolableValue = other.interpolableValue ? other.interpolableValue->clone() : nullptr; |
| + nonInterpolableValue = other.nonInterpolableValue; |
| + } |
| + |
| + void clear() |
| + { |
| + type = nullptr; |
| + interpolableValue = nullptr; |
| + nonInterpolableValue = nullptr; |
| + } |
| + |
| + void consume(AnimationValue& other) |
| + { |
| + type = other.type; |
| + other.type = nullptr; |
| + interpolableValue = other.interpolableValue.release(); |
| + nonInterpolableValue = other.nonInterpolableValue.release(); |
| + } |
| + |
| + DEFINE_INLINE_TRACE() |
| + { |
| + visitor->trace(interpolableValue); |
| + visitor->trace(nonInterpolableValue); |
| + } |
| +private: |
| + DISALLOW_ALLOCATION(); |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // AnimationValue_h |