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

Side by Side Diff: Source/core/svg/properties/SVGPropertyTearOff.h

Issue 678163002: Oilpan: move SVG property hierarchy to the heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased upto r185213 Created 6 years, 1 month 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
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 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef SVGPropertyTearOff_h 31 #ifndef SVGPropertyTearOff_h
32 #define SVGPropertyTearOff_h 32 #define SVGPropertyTearOff_h
33 33
34 #include "core/dom/QualifiedName.h" 34 #include "core/dom/QualifiedName.h"
35 #include "core/svg/properties/SVGProperty.h" 35 #include "core/svg/properties/SVGProperty.h"
36 #include "platform/heap/Handle.h"
36 #include "wtf/RefCounted.h" 37 #include "wtf/RefCounted.h"
37 38
38 namespace blink { 39 namespace blink {
39 40
40 enum PropertyIsAnimValType { 41 enum PropertyIsAnimValType {
41 PropertyIsNotAnimVal, 42 PropertyIsNotAnimVal,
42 PropertyIsAnimVal 43 PropertyIsAnimVal
43 }; 44 };
44 45
45 class SVGPropertyTearOffBase : public RefCounted<SVGPropertyTearOffBase> { 46 class SVGPropertyTearOffBase : public RefCountedWillBeGarbageCollectedFinalized< SVGPropertyTearOffBase> {
46 public: 47 public:
47 virtual ~SVGPropertyTearOffBase() { } 48 virtual ~SVGPropertyTearOffBase() { }
48 49
49 PropertyIsAnimValType propertyIsAnimVal() const 50 PropertyIsAnimValType propertyIsAnimVal() const
50 { 51 {
51 return m_propertyIsAnimVal; 52 return m_propertyIsAnimVal;
52 } 53 }
53 54
54 bool isAnimVal() const 55 bool isAnimVal() const
55 { 56 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 { 88 {
88 ASSERT(!isImmutable()); 89 ASSERT(!isImmutable());
89 ASSERT(contextElement); 90 ASSERT(contextElement);
90 ASSERT(attributeName != QualifiedName::null()); 91 ASSERT(attributeName != QualifiedName::null());
91 m_contextElement = contextElement; 92 m_contextElement = contextElement;
92 m_attributeName = attributeName; 93 m_attributeName = attributeName;
93 } 94 }
94 95
95 virtual AnimatedPropertyType type() const = 0; 96 virtual AnimatedPropertyType type() const = 0;
96 97
98 virtual void trace(Visitor* visitor)
99 {
100 visitor->trace(m_contextElement);
101 }
102
97 protected: 103 protected:
98 SVGPropertyTearOffBase(SVGElement* contextElement, PropertyIsAnimValType pro pertyIsAnimVal, const QualifiedName& attributeName = QualifiedName::null()) 104 SVGPropertyTearOffBase(SVGElement* contextElement, PropertyIsAnimValType pro pertyIsAnimVal, const QualifiedName& attributeName = QualifiedName::null())
99 : m_contextElement(contextElement) 105 : m_contextElement(contextElement)
100 , m_propertyIsAnimVal(propertyIsAnimVal) 106 , m_propertyIsAnimVal(propertyIsAnimVal)
101 , m_isReadOnlyProperty(false) 107 , m_isReadOnlyProperty(false)
102 , m_attributeName(attributeName) 108 , m_attributeName(attributeName)
103 { 109 {
104 } 110 }
105 111
106 private: 112 private:
107 // These references are kept alive from V8 wrapper to prevent reference cycl es 113 // These references are kept alive from V8 wrapper to prevent reference cycl es
108 SVGElement* m_contextElement; 114 RawPtrWillBeMember<SVGElement> m_contextElement;
109 115
110 PropertyIsAnimValType m_propertyIsAnimVal; 116 PropertyIsAnimValType m_propertyIsAnimVal;
111 bool m_isReadOnlyProperty; 117 bool m_isReadOnlyProperty;
112 QualifiedName m_attributeName; 118 QualifiedName m_attributeName;
113 }; 119 };
114 120
115 template <typename Property> 121 template <typename Property>
116 class SVGPropertyTearOff : public SVGPropertyTearOffBase { 122 class SVGPropertyTearOff : public SVGPropertyTearOffBase {
117 public: 123 public:
118 Property* target() 124 Property* target()
119 { 125 {
120 return m_target.get(); 126 return m_target.get();
121 } 127 }
122 128
123 void setTarget(PassRefPtr<Property> target) 129 void setTarget(PassRefPtrWillBeRawPtr<Property> target)
124 { 130 {
125 m_target = target; 131 m_target = target;
126 } 132 }
127 133
128 virtual AnimatedPropertyType type() const override 134 virtual AnimatedPropertyType type() const override
129 { 135 {
130 return Property::classType(); 136 return Property::classType();
131 } 137 }
132 138
139 virtual void trace(Visitor* visitor) override
140 {
141 visitor->trace(m_target);
142 SVGPropertyTearOffBase::trace(visitor);
143 }
144
133 protected: 145 protected:
134 SVGPropertyTearOff(PassRefPtr<Property> target, SVGElement* contextElement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeName = Qu alifiedName::null()) 146 SVGPropertyTearOff(PassRefPtrWillBeRawPtr<Property> target, SVGElement* cont extElement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attrib uteName = QualifiedName::null())
135 : SVGPropertyTearOffBase(contextElement, propertyIsAnimVal, attributeNam e) 147 : SVGPropertyTearOffBase(contextElement, propertyIsAnimVal, attributeNam e)
136 , m_target(target) 148 , m_target(target)
137 { 149 {
138 ASSERT(m_target); 150 ASSERT(m_target);
139 } 151 }
140 152
141 private: 153 private:
142 RefPtr<Property> m_target; 154 RefPtrWillBeMember<Property> m_target;
143 }; 155 };
144 156
145 } 157 }
146 158
147 #endif // SVGPropertyTearOff_h 159 #endif // SVGPropertyTearOff_h
OLDNEW
« no previous file with comments | « Source/core/svg/properties/SVGPropertyHelper.h ('k') | Source/platform/animation/AnimationValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698