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..0f57498643cdad969e38cbd36227350f3492bc30 |
| --- /dev/null |
| +++ b/Source/core/animation/AnimationValue.h |
| @@ -0,0 +1,77 @@ |
| +// 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) |
| + , 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()) |
| + { |
| + other.type = nullptr; |
| + } |
| + |
| + void copy(const AnimationValue& other) |
| + { |
| + type = other.type; |
| + interpolableValue = other.interpolableValue ? other.interpolableValue->clone() : nullptr; |
|
shans
2015/05/28 05:48:13
Are AnimationValues mutable? I can't think of a st
alancutter (OOO until 2018)
2015/06/01 07:35:28
They are mutable as a consequence of InterpolableV
|
| + nonInterpolableValue = other.nonInterpolableValue; |
| + } |
| + |
| + void clear() |
| + { |
| + type = nullptr; |
| + interpolableValue = nullptr; |
| + nonInterpolableValue = nullptr; |
| + } |
| + |
| + void consume(AnimationValue& other) |
|
shans
2015/05/28 05:48:13
what is consume?
alancutter (OOO until 2018)
2015/06/01 07:35:28
Renamed to swap() to match Vector::swap() and adde
|
| + { |
| + 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 |