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 #include <memory> |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 // Represents a (non-strict) subset of a PropertySpecificKeyframe's value broken
down into interpolable and non-interpolable parts. | 15 // Represents a (non-strict) subset of a PropertySpecificKeyframe's value broken
down into interpolable and non-interpolable parts. |
15 // InterpolationValues can be composed together to represent a whole PropertySpe
cificKeyframe value. | 16 // InterpolationValues can be composed together to represent a whole PropertySpe
cificKeyframe value. |
16 struct InterpolationValue { | 17 struct InterpolationValue { |
17 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 18 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
18 | 19 |
19 explicit InterpolationValue(PassOwnPtr<InterpolableValue> interpolableValue,
PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) | 20 explicit InterpolationValue(std::unique_ptr<InterpolableValue> interpolableV
alue, PassRefPtr<NonInterpolableValue> nonInterpolableValue = nullptr) |
20 : interpolableValue(std::move(interpolableValue)) | 21 : interpolableValue(std::move(interpolableValue)) |
21 , nonInterpolableValue(nonInterpolableValue) | 22 , nonInterpolableValue(nonInterpolableValue) |
22 { } | 23 { } |
23 | 24 |
24 InterpolationValue(std::nullptr_t) { } | 25 InterpolationValue(std::nullptr_t) { } |
25 | 26 |
26 InterpolationValue(InterpolationValue&& other) | 27 InterpolationValue(InterpolationValue&& other) |
27 : interpolableValue(std::move(other.interpolableValue)) | 28 : interpolableValue(std::move(other.interpolableValue)) |
28 , nonInterpolableValue(other.nonInterpolableValue.release()) | 29 , nonInterpolableValue(other.nonInterpolableValue.release()) |
29 { } | 30 { } |
(...skipping 10 matching lines...) Expand all Loading... |
40 { | 41 { |
41 return InterpolationValue(interpolableValue ? interpolableValue->clone()
: nullptr, nonInterpolableValue); | 42 return InterpolationValue(interpolableValue ? interpolableValue->clone()
: nullptr, nonInterpolableValue); |
42 } | 43 } |
43 | 44 |
44 void clear() | 45 void clear() |
45 { | 46 { |
46 interpolableValue.reset(); | 47 interpolableValue.reset(); |
47 nonInterpolableValue.clear(); | 48 nonInterpolableValue.clear(); |
48 } | 49 } |
49 | 50 |
50 OwnPtr<InterpolableValue> interpolableValue; | 51 std::unique_ptr<InterpolableValue> interpolableValue; |
51 RefPtr<NonInterpolableValue> nonInterpolableValue; | 52 RefPtr<NonInterpolableValue> nonInterpolableValue; |
52 }; | 53 }; |
53 | 54 |
54 } // namespace blink | 55 } // namespace blink |
55 | 56 |
56 #endif // InterpolationValue_h | 57 #endif // InterpolationValue_h |
OLD | NEW |