OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 25 matching lines...) Expand all Loading... | |
36 #include "wtf/Noncopyable.h" | 36 #include "wtf/Noncopyable.h" |
37 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
38 #include "wtf/RefCounted.h" | 38 #include "wtf/RefCounted.h" |
39 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class SVGElement; | 43 class SVGElement; |
44 class SVGAnimationElement; | 44 class SVGAnimationElement; |
45 | 45 |
46 class SVGPropertyBase : public RefCounted<SVGPropertyBase> { | 46 class SVGPropertyBase : public RefCountedWillBeGarbageCollectedFinalized<SVGProp ertyBase> { |
47 WTF_MAKE_NONCOPYABLE(SVGPropertyBase); | 47 WTF_MAKE_NONCOPYABLE(SVGPropertyBase); |
48 | 48 |
49 public: | 49 public: |
50 // Properties do not have a primitive type by default | 50 // Properties do not have a primitive type by default |
51 typedef void PrimitiveType; | 51 typedef void PrimitiveType; |
52 | 52 |
53 virtual ~SVGPropertyBase() | 53 virtual ~SVGPropertyBase() |
54 { | 54 { |
55 #if !ENABLE(OILPAN) | |
56 // Oilpan: a property can legitimately be swept out along with its list, | |
57 // hence this cannot be made to hold. | |
55 ASSERT(!m_ownerList); | 58 ASSERT(!m_ownerList); |
59 #endif | |
56 } | 60 } |
57 | 61 |
58 // FIXME: remove this in WebAnimations transition. | 62 // FIXME: remove this in WebAnimations transition. |
59 // This is used from SVGAnimatedNewPropertyAnimator for its animate-by-strin g implementation. | 63 // This is used from SVGAnimatedNewPropertyAnimator for its animate-by-strin g implementation. |
60 virtual PassRefPtr<SVGPropertyBase> cloneForAnimation(const String&) const = 0; | 64 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const Stri ng&) const = 0; |
61 | 65 |
62 virtual String valueAsString() const = 0; | 66 virtual String valueAsString() const = 0; |
63 | 67 |
64 // FIXME: remove below and just have this inherit AnimatableValue in WebAnim ations transition. | 68 // FIXME: remove below and just have this inherit AnimatableValue in WebAnim ations transition. |
65 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) = 0; | 69 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) = 0; |
66 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRefPtr<SVGPropertyBa se> to, PassRefPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement*) = 0; | 70 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> from, PassRefPtrWi llBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndO fDurationValue, SVGElement*) = 0; |
67 virtual float calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement*) = 0; | 71 virtual float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGElement*) = 0; |
68 | 72 |
69 AnimatedPropertyType type() | 73 AnimatedPropertyType type() |
70 { | 74 { |
71 return m_type; | 75 return m_type; |
72 } | 76 } |
73 | 77 |
74 SVGPropertyBase* ownerList() const | 78 SVGPropertyBase* ownerList() const |
75 { | 79 { |
76 return m_ownerList; | 80 return m_ownerList; |
77 } | 81 } |
78 | 82 |
79 void setOwnerList(SVGPropertyBase* ownerList) | 83 void setOwnerList(SVGPropertyBase* ownerList) |
haraken
2014/11/11 05:22:46
Just to confirm: Isn't it possible that setOwnerLi
sof
2014/11/12 13:45:08
It doesn't currently happen. We can't statically c
| |
80 { | 84 { |
81 // Previous owner list must be cleared before setting new owner list. | 85 // Previous owner list must be cleared before setting new owner list. |
82 ASSERT((!ownerList && m_ownerList) || (ownerList && !m_ownerList)); | 86 ASSERT((!ownerList && m_ownerList) || (ownerList && !m_ownerList)); |
83 | 87 |
84 m_ownerList = ownerList; | 88 m_ownerList = ownerList; |
85 } | 89 } |
86 | 90 |
91 virtual void trace(Visitor* visitor) | |
92 { | |
93 visitor->trace(m_ownerList); | |
94 } | |
95 | |
87 protected: | 96 protected: |
88 explicit SVGPropertyBase(AnimatedPropertyType type) | 97 explicit SVGPropertyBase(AnimatedPropertyType type) |
89 : m_type(type) | 98 : m_type(type) |
90 , m_ownerList(nullptr) | 99 , m_ownerList(nullptr) |
91 { | 100 { |
92 } | 101 } |
93 | 102 |
94 private: | 103 private: |
95 const AnimatedPropertyType m_type; | 104 const AnimatedPropertyType m_type; |
96 | 105 |
97 SVGPropertyBase* m_ownerList; | 106 RawPtrWillBeMember<SVGPropertyBase> m_ownerList; |
98 }; | 107 }; |
99 | 108 |
100 } | 109 } |
101 | 110 |
102 #endif // SVGProperty_h | 111 #endif // SVGProperty_h |
OLD | NEW |