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

Side by Side Diff: Source/core/svg/SVGEnumeration.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
« no previous file with comments | « Source/core/svg/SVGEllipseElement.cpp ('k') | Source/core/svg/SVGEnumeration.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // SVGEnumeration does not have a tear-off type. 45 // SVGEnumeration does not have a tear-off type.
46 typedef void TearOffType; 46 typedef void TearOffType;
47 typedef unsigned short PrimitiveType; 47 typedef unsigned short PrimitiveType;
48 48
49 virtual ~SVGEnumerationBase(); 49 virtual ~SVGEnumerationBase();
50 50
51 unsigned short value() const { return m_value <= maxExposedEnumValue() ? m_v alue : 0; } 51 unsigned short value() const { return m_value <= maxExposedEnumValue() ? m_v alue : 0; }
52 void setValue(unsigned short, ExceptionState&); 52 void setValue(unsigned short, ExceptionState&);
53 53
54 // SVGPropertyBase: 54 // SVGPropertyBase:
55 virtual PassRefPtr<SVGEnumerationBase> clone() const = 0; 55 virtual PassRefPtrWillBeRawPtr<SVGEnumerationBase> clone() const = 0;
56 virtual PassRefPtr<SVGPropertyBase> cloneForAnimation(const String&) const o verride; 56 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const Stri ng&) const override;
57 57
58 virtual String valueAsString() const override; 58 virtual String valueAsString() const override;
59 void setValueAsString(const String&, ExceptionState&); 59 void setValueAsString(const String&, ExceptionState&);
60 60
61 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) overr ide; 61 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) overr ide;
62 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRefPtr<SVGPropertyBa se> to, PassRefPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement*) overrid e; 62 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> from, PassRefPtrWi llBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndO fDurationValue, SVGElement*) override;
63 virtual float calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement*) override; 63 virtual float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGElement*) override;
64 64
65 static AnimatedPropertyType classType() { return AnimatedEnumeration; } 65 static AnimatedPropertyType classType() { return AnimatedEnumeration; }
66 66
67 // Ensure that |SVGAnimatedEnumerationBase::setBaseVal| is used instead of | SVGAnimatedProperty<SVGEnumerationBase>::setBaseVal|. 67 // Ensure that |SVGAnimatedEnumerationBase::setBaseVal| is used instead of | SVGAnimatedProperty<SVGEnumerationBase>::setBaseVal|.
68 void setValue(unsigned short) { ASSERT_NOT_REACHED(); } 68 void setValue(unsigned short) { ASSERT_NOT_REACHED(); }
69 69
70 static unsigned short valueOfLastEnum(const StringEntries& entries) { return entries.last().first; } 70 static unsigned short valueOfLastEnum(const StringEntries& entries) { return entries.last().first; }
71 71
72 protected: 72 protected:
73 SVGEnumerationBase(unsigned short value, const StringEntries& entries, unsig ned short maxExposed) 73 SVGEnumerationBase(unsigned short value, const StringEntries& entries, unsig ned short maxExposed)
(...skipping 22 matching lines...) Expand all
96 96
97 template<typename Enum> const SVGEnumerationStringEntries& getStaticStringEntrie s(); 97 template<typename Enum> const SVGEnumerationStringEntries& getStaticStringEntrie s();
98 template<typename Enum> unsigned short getMaxExposedEnumValue() 98 template<typename Enum> unsigned short getMaxExposedEnumValue()
99 { 99 {
100 return SVGEnumerationBase::valueOfLastEnum(getStaticStringEntries<Enum>()); 100 return SVGEnumerationBase::valueOfLastEnum(getStaticStringEntries<Enum>());
101 } 101 }
102 102
103 template<typename Enum> 103 template<typename Enum>
104 class SVGEnumeration : public SVGEnumerationBase { 104 class SVGEnumeration : public SVGEnumerationBase {
105 public: 105 public:
106 static PassRefPtr<SVGEnumeration<Enum> > create(Enum newValue) 106 static PassRefPtrWillBeRawPtr<SVGEnumeration<Enum> > create(Enum newValue)
107 { 107 {
108 return adoptRef(new SVGEnumeration<Enum>(newValue)); 108 return adoptRefWillBeNoop(new SVGEnumeration<Enum>(newValue));
109 } 109 }
110 110
111 virtual ~SVGEnumeration() 111 virtual ~SVGEnumeration()
112 { 112 {
113 } 113 }
114 114
115 virtual PassRefPtr<SVGEnumerationBase> clone() const override 115 virtual PassRefPtrWillBeRawPtr<SVGEnumerationBase> clone() const override
116 { 116 {
117 return create(enumValue()); 117 return create(enumValue());
118 } 118 }
119 119
120 Enum enumValue() const 120 Enum enumValue() const
121 { 121 {
122 ASSERT(m_value <= maxInternalEnumValue()); 122 ASSERT(m_value <= maxInternalEnumValue());
123 return static_cast<Enum>(m_value); 123 return static_cast<Enum>(m_value);
124 } 124 }
125 125
126 void setEnumValue(Enum value) 126 void setEnumValue(Enum value)
127 { 127 {
128 m_value = value; 128 m_value = value;
129 notifyChange(); 129 notifyChange();
130 } 130 }
131 131
132 protected: 132 protected:
133 explicit SVGEnumeration(Enum newValue) 133 explicit SVGEnumeration(Enum newValue)
134 : SVGEnumerationBase(newValue, getStaticStringEntries<Enum>(), getMaxExp osedEnumValue<Enum>()) 134 : SVGEnumerationBase(newValue, getStaticStringEntries<Enum>(), getMaxExp osedEnumValue<Enum>())
135 { 135 {
136 } 136 }
137 }; 137 };
138 138
139 } // namespace blink 139 } // namespace blink
140 140
141 #endif // SVGEnumeration_h 141 #endif // SVGEnumeration_h
OLDNEW
« no previous file with comments | « Source/core/svg/SVGEllipseElement.cpp ('k') | Source/core/svg/SVGEnumeration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698