Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: Source/core/animation/AnimationValue.h

Issue 1153943003: Add foundation for removing AnimatableValues from StyleInterpolation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add missing header file Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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)
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 {
41 other.type = nullptr;
42 }
43
44 void copy(const AnimationValue& other)
45 {
46 type = other.type;
47 interpolableValue = other.interpolableValue ? other.interpolableValue->c lone() : 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
48 nonInterpolableValue = other.nonInterpolableValue;
49 }
50
51 void clear()
52 {
53 type = nullptr;
54 interpolableValue = nullptr;
55 nonInterpolableValue = nullptr;
56 }
57
58 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
59 {
60 type = other.type;
61 other.type = nullptr;
62 interpolableValue = other.interpolableValue.release();
63 nonInterpolableValue = other.nonInterpolableValue.release();
64 }
65
66 DEFINE_INLINE_TRACE()
67 {
68 visitor->trace(interpolableValue);
69 visitor->trace(nonInterpolableValue);
70 }
71 private:
72 DISALLOW_ALLOCATION();
73 };
74
75 } // namespace blink
76
77 #endif // AnimationValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698