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

Unified Diff: Source/core/svg/properties/SVGAnimatedProperty.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 side-by-side diff with in-line comments
Download patch
Index: Source/core/svg/properties/SVGAnimatedProperty.h
diff --git a/Source/core/svg/properties/SVGAnimatedProperty.h b/Source/core/svg/properties/SVGAnimatedProperty.h
index 93e6438f98cedda611bcf20057b71a6905b15241..4e75c3b543946c3b9d49dee2a5bba7aaaa561155 100644
--- a/Source/core/svg/properties/SVGAnimatedProperty.h
+++ b/Source/core/svg/properties/SVGAnimatedProperty.h
@@ -37,6 +37,7 @@ G* * Redistributions in binary form must reproduce the above
#include "core/svg/SVGParsingError.h"
#include "core/svg/properties/SVGPropertyInfo.h"
#include "core/svg/properties/SVGPropertyTearOff.h"
+#include "platform/heap/Handle.h"
#include "wtf/Noncopyable.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
@@ -45,15 +46,16 @@ namespace blink {
class SVGElement;
-class SVGAnimatedPropertyBase : public RefCounted<SVGAnimatedPropertyBase>, public ScriptWrappableBase {
+class SVGAnimatedPropertyBase : public RefCountedWillBeGarbageCollectedFinalized<SVGAnimatedPropertyBase>, public ScriptWrappableBase {
+ WTF_MAKE_NONCOPYABLE(SVGAnimatedPropertyBase);
public:
virtual ~SVGAnimatedPropertyBase();
virtual SVGPropertyBase* currentValueBase() = 0;
virtual bool isAnimating() const = 0;
- virtual PassRefPtr<SVGPropertyBase> createAnimatedValue() = 0;
- virtual void setAnimatedValue(PassRefPtr<SVGPropertyBase>) = 0;
+ virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> createAnimatedValue() = 0;
+ virtual void setAnimatedValue(PassRefPtrWillBeRawPtr<SVGPropertyBase>) = 0;
virtual void animationEnded();
virtual void setBaseValueAsString(const String& value, SVGParsingError& parseError) = 0;
@@ -87,6 +89,11 @@ public:
bool isSpecified() const;
+ virtual void trace(Visitor* visitor)
+ {
+ visitor->trace(m_contextElement);
+ }
+
protected:
SVGAnimatedPropertyBase(AnimatedPropertyType, SVGElement*, const QualifiedName& attributeName);
@@ -95,11 +102,9 @@ private:
bool m_isReadOnly;
// This reference is kept alive from V8 wrapper
- SVGElement* m_contextElement;
+ RawPtrWillBeMember<SVGElement> m_contextElement;
const QualifiedName& m_attributeName;
-
- WTF_MAKE_NONCOPYABLE(SVGAnimatedPropertyBase);
};
template <typename Property>
@@ -140,14 +145,14 @@ public:
parseError = ParsingAttributeFailedError;
}
- virtual PassRefPtr<SVGPropertyBase> createAnimatedValue() override
+ virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> createAnimatedValue() override
{
return m_baseValue->clone();
}
- virtual void setAnimatedValue(PassRefPtr<SVGPropertyBase> passValue) override
+ virtual void setAnimatedValue(PassRefPtrWillBeRawPtr<SVGPropertyBase> passValue) override
{
- RefPtr<SVGPropertyBase> value = passValue;
+ RefPtrWillBeRawPtr<SVGPropertyBase> value = passValue;
ASSERT(value->type() == Property::classType());
m_currentValue = static_pointer_cast<Property>(value.release());
}
@@ -159,16 +164,23 @@ public:
SVGAnimatedPropertyBase::animationEnded();
}
+ virtual void trace(Visitor* visitor) override
+ {
+ visitor->trace(m_baseValue);
+ visitor->trace(m_currentValue);
+ SVGAnimatedPropertyBase::trace(visitor);
+ }
+
protected:
- SVGAnimatedPropertyCommon(SVGElement* contextElement, const QualifiedName& attributeName, PassRefPtr<Property> initialValue)
+ SVGAnimatedPropertyCommon(SVGElement* contextElement, const QualifiedName& attributeName, PassRefPtrWillBeRawPtr<Property> initialValue)
: SVGAnimatedPropertyBase(Property::classType(), contextElement, attributeName)
, m_baseValue(initialValue)
{
}
private:
- RefPtr<Property> m_baseValue;
- RefPtr<Property> m_currentValue;
+ RefPtrWillBeMember<Property> m_baseValue;
+ RefPtrWillBeMember<Property> m_currentValue;
};
// Implementation of SVGAnimatedProperty which uses primitive types.
@@ -220,7 +232,7 @@ public:
}
protected:
- SVGAnimatedProperty(SVGElement* contextElement, const QualifiedName& attributeName, PassRefPtr<Property> initialValue)
+ SVGAnimatedProperty(SVGElement* contextElement, const QualifiedName& attributeName, PassRefPtrWillBeRawPtr<Property> initialValue)
: SVGAnimatedPropertyCommon<Property>(contextElement, attributeName, initialValue)
, m_baseValueUpdated(false)
{
@@ -236,12 +248,12 @@ protected:
template <typename Property, typename TearOffType>
class SVGAnimatedProperty<Property, TearOffType, void> : public SVGAnimatedPropertyCommon<Property> {
public:
- static PassRefPtr<SVGAnimatedProperty<Property> > create(SVGElement* contextElement, const QualifiedName& attributeName, PassRefPtr<Property> initialValue)
+ static PassRefPtrWillBeRawPtr<SVGAnimatedProperty<Property> > create(SVGElement* contextElement, const QualifiedName& attributeName, PassRefPtrWillBeRawPtr<Property> initialValue)
{
- return adoptRef(new SVGAnimatedProperty<Property>(contextElement, attributeName, initialValue));
+ return adoptRefWillBeNoop(new SVGAnimatedProperty<Property>(contextElement, attributeName, initialValue));
}
- virtual void setAnimatedValue(PassRefPtr<SVGPropertyBase> value) override
+ virtual void setAnimatedValue(PassRefPtrWillBeRawPtr<SVGPropertyBase> value) override
{
SVGAnimatedPropertyCommon<Property>::setAnimatedValue(value);
updateAnimValTearOffIfNeeded();
@@ -283,8 +295,15 @@ public:
return m_animValTearOff.get();
}
+ virtual void trace(Visitor* visitor) override
+ {
+ visitor->trace(m_baseValTearOff);
+ visitor->trace(m_animValTearOff);
+ SVGAnimatedPropertyCommon<Property>::trace(visitor);
+ }
+
protected:
- SVGAnimatedProperty(SVGElement* contextElement, const QualifiedName& attributeName, PassRefPtr<Property> initialValue)
+ SVGAnimatedProperty(SVGElement* contextElement, const QualifiedName& attributeName, PassRefPtrWillBeRawPtr<Property> initialValue)
: SVGAnimatedPropertyCommon<Property>(contextElement, attributeName, initialValue)
{
}
@@ -301,10 +320,10 @@ private:
// When animated:
// m_animValTearOff targets m_currentValue.
// m_baseValTearOff targets m_baseValue.
- RefPtr<TearOffType> m_baseValTearOff;
- RefPtr<TearOffType> m_animValTearOff;
+ RefPtrWillBeMember<TearOffType> m_baseValTearOff;
+ RefPtrWillBeMember<TearOffType> m_animValTearOff;
};
-}
+} // namespace blink
#endif // SVGAnimatedProperty_h
« no previous file with comments | « Source/core/svg/graphics/filters/SVGFilterBuilder.cpp ('k') | Source/core/svg/properties/SVGListPropertyHelper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698