Commit 90ddc580 authored by tasak@google.com's avatar tasak@google.com

Added allocator matcros to blink classes and structures in core/svg.

BUG=523249

Review URL: https://codereview.chromium.org/1321453012

git-svn-id: svn://svn.chromium.org/blink/trunk@201464 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 366700c9
......@@ -20,11 +20,14 @@
#ifndef ColorDistance_h
#define ColorDistance_h
#include "wtf/Allocator.h"
namespace blink {
class Color;
class ColorDistance {
STATIC_ONLY(ColorDistance);
public:
static Color addColors(const Color&, const Color&);
static float distance(const Color& fromColor, const Color& toColor);
......
......@@ -21,10 +21,12 @@
#define GradientAttributes_h
#include "core/svg/SVGUnitTypes.h"
#include "wtf/Allocator.h"
namespace blink {
struct GradientAttributes {
DISALLOW_ALLOCATION();
GradientAttributes()
: m_spreadMethod(SVGSpreadMethodPad)
, m_gradientUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
......@@ -85,6 +87,7 @@ private:
};
struct SameSizeAsGradientAttributes {
DISALLOW_ALLOCATION();
AffineTransform a;
Vector<Gradient::ColorStop> b;
unsigned c : 8;
......
......@@ -46,7 +46,7 @@ public:
protected:
SVGAnimatedRect(SVGElement* contextElement, const QualifiedName& attributeName)
: SVGAnimatedProperty<SVGRect>(contextElement, attributeName, SVGRect::create(SVGRect::InvalidSVGRectTag()))
: SVGAnimatedProperty<SVGRect>(contextElement, attributeName, SVGRect::createInvalid())
{
}
};
......
......@@ -28,6 +28,7 @@
#include "core/svg/SVGParsingError.h"
#include "core/svg/properties/SVGPropertyInfo.h"
#include "platform/heap/Handle.h"
#include "wtf/Allocator.h"
#include "wtf/HashMap.h"
#include "wtf/OwnPtr.h"
......@@ -245,6 +246,7 @@ private:
};
struct SVGAttributeHashTranslator {
STATIC_ONLY(SVGAttributeHashTranslator);
static unsigned hash(const QualifiedName& key)
{
if (key.hasPrefix()) {
......
......@@ -24,6 +24,7 @@
#include "bindings/core/v8/ScriptWrappable.h"
#include "platform/geometry/FloatPoint.h"
#include "platform/heap/Handle.h"
#include "wtf/Allocator.h"
#include "wtf/RefCounted.h"
#include "wtf/text/WTFString.h"
......@@ -73,6 +74,7 @@ static inline bool isAbsolutePathSegType(const SVGPathSegType type)
}
struct PathSegmentData {
STACK_ALLOCATED();
PathSegmentData()
: command(PathSegUnknown)
, arcSweep(false)
......
......@@ -37,11 +37,6 @@ SVGRect::SVGRect()
{
}
SVGRect::SVGRect(InvalidSVGRectTag)
{
setInvalid();
}
SVGRect::SVGRect(const FloatRect& rect)
: m_isValid(true)
, m_value(rect)
......
......@@ -22,6 +22,7 @@
#include "core/svg/properties/SVGPropertyHelper.h"
#include "platform/geometry/FloatRect.h"
#include "wtf/Allocator.h"
namespace blink {
......@@ -31,16 +32,16 @@ class SVGRect : public SVGPropertyHelper<SVGRect> {
public:
typedef SVGRectTearOff TearOffType;
struct InvalidSVGRectTag { };
static PassRefPtrWillBeRawPtr<SVGRect> create()
{
return adoptRefWillBeNoop(new SVGRect());
}
static PassRefPtrWillBeRawPtr<SVGRect> create(InvalidSVGRectTag)
static PassRefPtrWillBeRawPtr<SVGRect> createInvalid()
{
return adoptRefWillBeNoop(new SVGRect(InvalidSVGRectTag()));
RefPtrWillBeRawPtr<SVGRect> rect = adoptRefWillBeNoop(new SVGRect());
rect->setInvalid();
return rect.release();
}
static PassRefPtrWillBeRawPtr<SVGRect> create(const FloatRect& rect)
......@@ -76,7 +77,6 @@ public:
private:
SVGRect();
SVGRect(InvalidSVGRectTag);
SVGRect(const FloatRect&);
template<typename CharType>
......
......@@ -21,12 +21,14 @@
#define SVGTransformDistance_h
#include "core/svg/SVGTransform.h"
#include "wtf/Allocator.h"
namespace blink {
class AffineTransform;
class SVGTransformDistance {
STACK_ALLOCATED();
public:
SVGTransformDistance();
SVGTransformDistance(PassRefPtrWillBeRawPtr<SVGTransform> fromTransform, PassRefPtrWillBeRawPtr<SVGTransform> toTransform);
......
......@@ -26,6 +26,7 @@
#ifndef SMILTime_h
#define SMILTime_h
#include "wtf/Allocator.h"
#include "wtf/Assertions.h"
#include "wtf/HashTraits.h"
#include "wtf/MathExtras.h"
......@@ -33,6 +34,7 @@
namespace blink {
class SMILTime {
ALLOW_ONLY_INLINE_ALLOCATION();
public:
SMILTime() : m_time(0) { }
SMILTime(double time) : m_time(time) { }
......@@ -51,6 +53,7 @@ private:
};
class SMILTimeWithOrigin {
ALLOW_ONLY_INLINE_ALLOCATION();
public:
enum Origin {
ParserOrigin,
......@@ -77,6 +80,7 @@ private:
};
struct SMILInterval {
DISALLOW_ALLOCATION();
SMILInterval() { }
SMILInterval(const SMILTime& begin, const SMILTime& end) : begin(begin), end(end) { }
......@@ -109,6 +113,7 @@ inline bool operator!=(const SMILInterval& a, const SMILInterval& b)
}
struct SMILTimeHash {
STATIC_ONLY(SMILTimeHash);
static unsigned hash(const SMILTime& key) { return WTF::FloatHash<double>::hash(key.value()); }
static bool equal(const SMILTime& a, const SMILTime& b) { return WTF::FloatHash<double>::equal(a.value(), b.value()); }
static const bool safeToCompareToEmptyOrDeleted = true;
......
......@@ -31,6 +31,7 @@
#include "platform/graphics/paint/DisplayItemClient.h"
#include "platform/heap/Handle.h"
#include "platform/weborigin/KURL.h"
#include "wtf/Allocator.h"
namespace blink {
......@@ -113,6 +114,7 @@ private:
DEFINE_IMAGE_TYPE_CASTS(SVGImage);
class ImageObserverDisabler {
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(ImageObserverDisabler);
public:
ImageObserverDisabler(Image* image)
......
......@@ -36,6 +36,7 @@
#include "core/dom/ExceptionCode.h"
#include "core/svg/SVGAnimationElement.h"
#include "core/svg/properties/SVGPropertyHelper.h"
#include "wtf/Allocator.h"
#include "wtf/PassRefPtr.h"
#include "wtf/Vector.h"
......@@ -74,6 +75,7 @@ public:
}
class ConstIterator {
STACK_ALLOCATED();
private:
typedef typename WillBeHeapVector<RefPtrWillBeMember<ItemPropertyType>>::const_iterator WrappedType;
......
......@@ -40,6 +40,7 @@ namespace blink {
template<typename ItemProperty>
class ListItemPropertyTraits {
STATIC_ONLY(ListItemPropertyTraits);
public:
typedef ItemProperty ItemPropertyType;
typedef typename ItemPropertyType::TearOffType ItemTearOffType;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment