Title: [159516] trunk/Source/WebCore
Revision
159516
Author
commit-qu...@webkit.org
Date
2013-11-19 13:14:25 -0800 (Tue, 19 Nov 2013)

Log Message

Get rid of bare new in SVGAnimatedColorAnimator::constructFromString()
https://bugs.webkit.org/show_bug.cgi?id=124595

Patch by Sergio Correia <sergio.corr...@openbossa.org> on 2013-11-19
Reviewed by Darin Adler.

Use std::unique_ptr instead, to manage the arguments passed to the create
methods of SVGAnimatedType.

No new tests, covered by existing tests.

* svg/SVGAnimatedAngle.cpp:
(WebCore::SVGAnimatedAngleAnimator::constructFromString): Replace bare
pointer with std::unique_ptr.
* svg/SVGAnimatedBoolean.cpp:
(WebCore::SVGAnimatedBooleanAnimator::constructFromString): Ditto.
* svg/SVGAnimatedColor.cpp:
(WebCore::SVGAnimatedColorAnimator::constructFromString): Ditto.
* svg/SVGAnimatedEnumeration.cpp:
(WebCore::SVGAnimatedEnumerationAnimator::constructFromString): Ditto.
* svg/SVGAnimatedInteger.cpp:
(WebCore::SVGAnimatedIntegerAnimator::constructFromString): Ditto.
* svg/SVGAnimatedIntegerOptionalInteger.cpp:
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString):
Ditto.
* svg/SVGAnimatedLength.cpp:
(WebCore::SVGAnimatedLengthAnimator::constructFromString): Ditto.
* svg/SVGAnimatedLengthList.cpp:
(WebCore::SVGAnimatedLengthListAnimator::constructFromString): Ditto.
* svg/SVGAnimatedNumber.cpp:
(WebCore::SVGAnimatedNumberAnimator::constructFromString): Ditto.
* svg/SVGAnimatedNumberList.cpp:
(WebCore::SVGAnimatedNumberListAnimator::constructFromString): Ditto.
* svg/SVGAnimatedNumberOptionalNumber.cpp:
(WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString):
Ditto.
* svg/SVGAnimatedPointList.cpp:
(WebCore::SVGAnimatedPointListAnimator::constructFromString): Ditto.
* svg/SVGAnimatedPreserveAspectRatio.cpp:
(WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString):
Ditto.
* svg/SVGAnimatedRect.cpp:
(WebCore::SVGAnimatedRectAnimator::constructFromString): Ditto.
* svg/SVGAnimatedString.cpp:
(WebCore::SVGAnimatedStringAnimator::constructFromString): Ditto.
* svg/SVGAnimatedTransformList.cpp:
(WebCore::SVGAnimatedTransformListAnimator::constructFromString):
Ditto.
* svg/SVGAnimatedType.cpp:
(WebCore::SVGAnimatedType::createAngleAndEnumeration): Use
std::unique_ptr instead of bare pointer as parameter.
(WebCore::SVGAnimatedType::createBoolean): Ditto.
(WebCore::SVGAnimatedType::createColor): Ditto.
(WebCore::SVGAnimatedType::createEnumeration): Ditto.
(WebCore::SVGAnimatedType::createInteger): Ditto.
(WebCore::SVGAnimatedType::createIntegerOptionalInteger): Ditto.
(WebCore::SVGAnimatedType::createLength): Ditto.
(WebCore::SVGAnimatedType::createLengthList): Ditto.
(WebCore::SVGAnimatedType::createNumber): Ditto.
(WebCore::SVGAnimatedType::createNumberList): Ditto.
(WebCore::SVGAnimatedType::createNumberOptionalNumber): Ditto.
(WebCore::SVGAnimatedType::createPointList): Ditto.
(WebCore::SVGAnimatedType::createPreserveAspectRatio): Ditto.
(WebCore::SVGAnimatedType::createRect): Ditto.
(WebCore::SVGAnimatedType::createString): Ditto.
(WebCore::SVGAnimatedType::createTransformList): Ditto.
* svg/SVGAnimatedType.h: Use std::unique_ptr as parameter in the
create methods.
* svg/SVGAnimatedTypeAnimator.h:
(WebCore::SVGAnimatedTypeAnimator::constructFromBaseValue): Make
helper return std::unique_ptr instead of bare pointer.
(WebCore::SVGAnimatedTypeAnimator::constructFromBaseValues): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (159515 => 159516)


--- trunk/Source/WebCore/ChangeLog	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/ChangeLog	2013-11-19 21:14:25 UTC (rev 159516)
@@ -1,3 +1,77 @@
+2013-11-19  Sergio Correia  <sergio.corr...@openbossa.org>
+
+        Get rid of bare new in SVGAnimatedColorAnimator::constructFromString()
+        https://bugs.webkit.org/show_bug.cgi?id=124595
+
+        Reviewed by Darin Adler.
+
+        Use std::unique_ptr instead, to manage the arguments passed to the create
+        methods of SVGAnimatedType.
+
+        No new tests, covered by existing tests.
+
+        * svg/SVGAnimatedAngle.cpp:
+        (WebCore::SVGAnimatedAngleAnimator::constructFromString): Replace bare
+        pointer with std::unique_ptr.
+        * svg/SVGAnimatedBoolean.cpp:
+        (WebCore::SVGAnimatedBooleanAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedColor.cpp:
+        (WebCore::SVGAnimatedColorAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedEnumeration.cpp:
+        (WebCore::SVGAnimatedEnumerationAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedInteger.cpp:
+        (WebCore::SVGAnimatedIntegerAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedIntegerOptionalInteger.cpp:
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString):
+        Ditto.
+        * svg/SVGAnimatedLength.cpp:
+        (WebCore::SVGAnimatedLengthAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedLengthList.cpp:
+        (WebCore::SVGAnimatedLengthListAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedNumber.cpp:
+        (WebCore::SVGAnimatedNumberAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedNumberList.cpp:
+        (WebCore::SVGAnimatedNumberListAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedNumberOptionalNumber.cpp:
+        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString):
+        Ditto.
+        * svg/SVGAnimatedPointList.cpp:
+        (WebCore::SVGAnimatedPointListAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedPreserveAspectRatio.cpp:
+        (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString):
+        Ditto.
+        * svg/SVGAnimatedRect.cpp:
+        (WebCore::SVGAnimatedRectAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedString.cpp:
+        (WebCore::SVGAnimatedStringAnimator::constructFromString): Ditto.
+        * svg/SVGAnimatedTransformList.cpp:
+        (WebCore::SVGAnimatedTransformListAnimator::constructFromString):
+        Ditto.
+        * svg/SVGAnimatedType.cpp:
+        (WebCore::SVGAnimatedType::createAngleAndEnumeration): Use
+        std::unique_ptr instead of bare pointer as parameter.
+        (WebCore::SVGAnimatedType::createBoolean): Ditto.
+        (WebCore::SVGAnimatedType::createColor): Ditto.
+        (WebCore::SVGAnimatedType::createEnumeration): Ditto.
+        (WebCore::SVGAnimatedType::createInteger): Ditto.
+        (WebCore::SVGAnimatedType::createIntegerOptionalInteger): Ditto.
+        (WebCore::SVGAnimatedType::createLength): Ditto.
+        (WebCore::SVGAnimatedType::createLengthList): Ditto.
+        (WebCore::SVGAnimatedType::createNumber): Ditto.
+        (WebCore::SVGAnimatedType::createNumberList): Ditto.
+        (WebCore::SVGAnimatedType::createNumberOptionalNumber): Ditto.
+        (WebCore::SVGAnimatedType::createPointList): Ditto.
+        (WebCore::SVGAnimatedType::createPreserveAspectRatio): Ditto.
+        (WebCore::SVGAnimatedType::createRect): Ditto.
+        (WebCore::SVGAnimatedType::createString): Ditto.
+        (WebCore::SVGAnimatedType::createTransformList): Ditto.
+        * svg/SVGAnimatedType.h: Use std::unique_ptr as parameter in the
+        create methods.
+        * svg/SVGAnimatedTypeAnimator.h:
+        (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValue): Make
+        helper return std::unique_ptr instead of bare pointer.
+        (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValues): Ditto.
+
 2013-11-19  Hans Muller  <hmul...@adobe.com>
 
         [CSS Shapes] Refactor RectangleShape

Modified: trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -34,7 +34,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedAngleAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createAngleAndEnumeration(new pair<SVGAngle, unsigned>);
+    auto animatedType = SVGAnimatedType::createAngleAndEnumeration(std::make_unique<pair<SVGAngle, unsigned>>());
     pair<SVGAngle, unsigned>& animatedPair = animatedType->angleAndEnumeration();
 
     SVGAngle angle;

Modified: trunk/Source/WebCore/svg/SVGAnimatedBoolean.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedBoolean.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedBoolean.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -33,7 +33,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedBooleanAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createBoolean(new bool);
+    auto animatedType = SVGAnimatedType::createBoolean(std::make_unique<bool>());
     animatedType->boolean() = (string == "true"); // wat?
     return animatedType;
 }

Modified: trunk/Source/WebCore/svg/SVGAnimatedColor.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedColor.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedColor.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -36,7 +36,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedColorAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createColor(new Color);
+    auto animatedType = SVGAnimatedType::createColor(std::make_unique<Color>());
     animatedType->color() = string.isEmpty() ? Color() : SVGColor::colorFromRGBColorString(string);
     return animatedType;
 }

Modified: trunk/Source/WebCore/svg/SVGAnimatedEnumeration.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedEnumeration.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedEnumeration.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -110,7 +110,7 @@
 std::unique_ptr<SVGAnimatedType> SVGAnimatedEnumerationAnimator::constructFromString(const String& string)
 {
     ASSERT(m_animationElement);
-    auto animatedType = SVGAnimatedType::createEnumeration(new unsigned);
+    auto animatedType = SVGAnimatedType::createEnumeration(std::make_unique<unsigned>());
     animatedType->enumeration() = enumerationValueForTargetAttribute(m_animationElement->targetElement(), m_animationElement->attributeName(), string);
     return animatedType;
 }

Modified: trunk/Source/WebCore/svg/SVGAnimatedInteger.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedInteger.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedInteger.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -35,7 +35,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createInteger(new int);
+    auto animatedType = SVGAnimatedType::createInteger(std::make_unique<int>());
     animatedType->integer() = string.toIntStrict();
     return animatedType;
 }

Modified: trunk/Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -35,7 +35,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createIntegerOptionalInteger(new pair<int, int>);
+    auto animatedType = SVGAnimatedType::createIntegerOptionalInteger(std::make_unique<pair<int, int>>());
     pair<int, int>& animatedInteger = animatedType->integerOptionalInteger();
     float firstNumber = 0;
     float secondNumber = 0;

Modified: trunk/Source/WebCore/svg/SVGAnimatedLength.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedLength.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedLength.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -42,7 +42,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::constructFromString(const String& string)
 {
-    return SVGAnimatedType::createLength(new SVGLength(m_lengthMode, string));
+    return SVGAnimatedType::createLength(std::make_unique<SVGLength>(m_lengthMode, string));
 }
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthAnimator::startAnimValAnimation(const SVGElementAnimatedPropertyList& animatedTypes)

Modified: trunk/Source/WebCore/svg/SVGAnimatedLengthList.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedLengthList.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedLengthList.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -35,7 +35,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedLengthListAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createLengthList(new SVGLengthList);
+    auto animatedType = SVGAnimatedType::createLengthList(std::make_unique<SVGLengthList>());
     animatedType->lengthList().parse(string, m_lengthMode);
     return animatedType;
 }

Modified: trunk/Source/WebCore/svg/SVGAnimatedNumber.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedNumber.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedNumber.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -34,7 +34,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createNumber(new float);
+    auto animatedType = SVGAnimatedType::createNumber(std::make_unique<float>());
     float& animatedNumber = animatedType->number();
     if (!parseNumberFromString(string, animatedNumber))
         animatedNumber = 0;

Modified: trunk/Source/WebCore/svg/SVGAnimatedNumberList.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedNumberList.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedNumberList.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -34,7 +34,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberListAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createNumberList(new SVGNumberList);
+    auto animatedType = SVGAnimatedType::createNumberList(std::make_unique<SVGNumberList>());
     animatedType->numberList().parse(string);
     return animatedType;
 }

Modified: trunk/Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedNumberOptionalNumber.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -35,7 +35,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedNumberOptionalNumberAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createNumberOptionalNumber(new pair<float, float>);
+    auto animatedType = SVGAnimatedType::createNumberOptionalNumber(std::make_unique<pair<float, float>>());
     pair<float, float>& animatedNumber = animatedType->numberOptionalNumber();
     if (!parseNumberOptionalNumber(string, animatedNumber.first, animatedNumber.second)) {
         animatedNumber.first = 0;

Modified: trunk/Source/WebCore/svg/SVGAnimatedPointList.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedPointList.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedPointList.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -35,7 +35,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedPointListAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createPointList(new SVGPointList);
+    auto animatedType = SVGAnimatedType::createPointList(std::make_unique<SVGPointList>());
     pointsListFromSVGData(animatedType->pointList(), string);
     return animatedType;
 }

Modified: trunk/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -33,7 +33,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedPreserveAspectRatioAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createPreserveAspectRatio(new SVGPreserveAspectRatio);
+    auto animatedType = SVGAnimatedType::createPreserveAspectRatio(std::make_unique<SVGPreserveAspectRatio>());
     animatedType->preserveAspectRatio().parse(string);
     return animatedType;
 }

Modified: trunk/Source/WebCore/svg/SVGAnimatedRect.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedRect.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedRect.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -34,7 +34,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedRectAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createRect(new FloatRect);
+    auto animatedType = SVGAnimatedType::createRect(std::make_unique<FloatRect>());
     parseRect(string, animatedType->rect());
     return animatedType;
 }

Modified: trunk/Source/WebCore/svg/SVGAnimatedString.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedString.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedString.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -33,7 +33,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedStringAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createString(new String);
+    auto animatedType = SVGAnimatedType::createString(std::make_unique<String>());
     animatedType->string() = string;
     return animatedType;
 }

Modified: trunk/Source/WebCore/svg/SVGAnimatedTransformList.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedTransformList.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedTransformList.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -43,7 +43,7 @@
 
 std::unique_ptr<SVGAnimatedType> SVGAnimatedTransformListAnimator::constructFromString(const String& string)
 {
-    auto animatedType = SVGAnimatedType::createTransformList(new SVGTransformList);
+    auto animatedType = SVGAnimatedType::createTransformList(std::make_unique<SVGTransformList>());
     animatedType->transformList().parse(m_transformTypeString + string + ')');
     ASSERT(animatedType->transformList().size() <= 1);
     return animatedType;

Modified: trunk/Source/WebCore/svg/SVGAnimatedType.cpp (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedType.cpp	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedType.cpp	2013-11-19 21:14:25 UTC (rev 159516)
@@ -92,91 +92,91 @@
     }
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createAngleAndEnumeration(std::pair<SVGAngle, unsigned>* angleAndEnumeration)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createAngleAndEnumeration(std::unique_ptr<std::pair<SVGAngle, unsigned>> angleAndEnumeration)
 {
     ASSERT(angleAndEnumeration);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedAngle);
-    animatedType->m_data.angleAndEnumeration = angleAndEnumeration;
+    animatedType->m_data.angleAndEnumeration = angleAndEnumeration.release();
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createBoolean(bool* boolean)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createBoolean(std::unique_ptr<bool> boolean)
 {
     ASSERT(boolean);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedBoolean);
-    animatedType->m_data.boolean = boolean;
+    animatedType->m_data.boolean = boolean.release();
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createColor(Color* color)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createColor(std::unique_ptr<Color> color)
 {
     ASSERT(color);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedColor);
-    animatedType->m_data.color = color;
+    animatedType->m_data.color = color.release();
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createEnumeration(unsigned* enumeration)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createEnumeration(std::unique_ptr<unsigned> enumeration)
 {
     ASSERT(enumeration);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedEnumeration);
-    animatedType->m_data.enumeration = enumeration;
+    animatedType->m_data.enumeration = enumeration.release();
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createInteger(int* integer)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createInteger(std::unique_ptr<int> integer)
 {
     ASSERT(integer);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedInteger);
-    animatedType->m_data.integer = integer;
+    animatedType->m_data.integer = integer.release();
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createIntegerOptionalInteger(pair<int, int>* integerOptionalInteger)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createIntegerOptionalInteger(std::unique_ptr<pair<int, int>> integerOptionalInteger)
 {
     ASSERT(integerOptionalInteger);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedIntegerOptionalInteger);
-    animatedType->m_data.integerOptionalInteger = integerOptionalInteger;
+    animatedType->m_data.integerOptionalInteger = integerOptionalInteger.release();
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createLength(SVGLength* length)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createLength(std::unique_ptr<SVGLength> length)
 {
     ASSERT(length);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedLength);
-    animatedType->m_data.length = length;
+    animatedType->m_data.length = length.release();
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createLengthList(SVGLengthList* lengthList)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createLengthList(std::unique_ptr<SVGLengthList> lengthList)
 {
     ASSERT(lengthList);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedLengthList);
-    animatedType->m_data.lengthList = lengthList;
+    animatedType->m_data.lengthList = lengthList.release();
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createNumber(float* number)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createNumber(std::unique_ptr<float> number)
 {
     ASSERT(number);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedNumber);
-    animatedType->m_data.number = number;
+    animatedType->m_data.number = number.release();
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createNumberList(SVGNumberList* numberList)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createNumberList(std::unique_ptr<SVGNumberList> numberList)
 {
     ASSERT(numberList);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedNumberList);
-    animatedType->m_data.numberList = numberList;
+    animatedType->m_data.numberList = numberList.release();
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createNumberOptionalNumber(pair<float, float>* numberOptionalNumber)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createNumberOptionalNumber(std::unique_ptr<pair<float, float>> numberOptionalNumber)
 {
     ASSERT(numberOptionalNumber);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedNumberOptionalNumber);
-    animatedType->m_data.numberOptionalNumber = numberOptionalNumber;
+    animatedType->m_data.numberOptionalNumber = numberOptionalNumber.release();
     return animatedType;
 }
 
@@ -188,43 +188,43 @@
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createPointList(SVGPointList* pointList)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createPointList(std::unique_ptr<SVGPointList> pointList)
 {
     ASSERT(pointList);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedPoints);
-    animatedType->m_data.pointList = pointList;
+    animatedType->m_data.pointList = pointList.release();
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createPreserveAspectRatio(SVGPreserveAspectRatio* preserveAspectRatio)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createPreserveAspectRatio(std::unique_ptr<SVGPreserveAspectRatio> preserveAspectRatio)
 {
     ASSERT(preserveAspectRatio);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedPreserveAspectRatio);
-    animatedType->m_data.preserveAspectRatio = preserveAspectRatio;
+    animatedType->m_data.preserveAspectRatio = preserveAspectRatio.release();
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createRect(FloatRect* rect)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createRect(std::unique_ptr<FloatRect> rect)
 {
     ASSERT(rect);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedRect);
-    animatedType->m_data.rect = rect;
+    animatedType->m_data.rect = rect.release();
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createString(String* string)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createString(std::unique_ptr<String> string)
 {
     ASSERT(string);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedString);
-    animatedType->m_data.string = string;
+    animatedType->m_data.string = string.release();
     return animatedType;
 }
 
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createTransformList(SVGTransformList* transformList)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createTransformList(std::unique_ptr<SVGTransformList> transformList)
 {
     ASSERT(transformList);
     auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedTransformList);
-    animatedType->m_data.transformList = transformList;
+    animatedType->m_data.transformList = transformList.release();
     return animatedType;
 }
 

Modified: trunk/Source/WebCore/svg/SVGAnimatedType.h (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedType.h	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedType.h	2013-11-19 21:14:25 UTC (rev 159516)
@@ -42,24 +42,23 @@
     SVGAnimatedType(AnimatedPropertyType);
     virtual ~SVGAnimatedType();
 
-    // FIXME: These functions should all take std::unique_ptr arguments instead of bare pointers.
-    static std::unique_ptr<SVGAnimatedType> createAngleAndEnumeration(std::pair<SVGAngle, unsigned>*);
-    static std::unique_ptr<SVGAnimatedType> createBoolean(bool*);
-    static std::unique_ptr<SVGAnimatedType> createColor(Color*);
-    static std::unique_ptr<SVGAnimatedType> createEnumeration(unsigned*);
-    static std::unique_ptr<SVGAnimatedType> createInteger(int*);
-    static std::unique_ptr<SVGAnimatedType> createIntegerOptionalInteger(std::pair<int, int>*);
-    static std::unique_ptr<SVGAnimatedType> createLength(SVGLength*);
-    static std::unique_ptr<SVGAnimatedType> createLengthList(SVGLengthList*);
-    static std::unique_ptr<SVGAnimatedType> createNumber(float*);
-    static std::unique_ptr<SVGAnimatedType> createNumberList(SVGNumberList*);
-    static std::unique_ptr<SVGAnimatedType> createNumberOptionalNumber(std::pair<float, float>*);
+    static std::unique_ptr<SVGAnimatedType> createAngleAndEnumeration(std::unique_ptr<std::pair<SVGAngle, unsigned>>);
+    static std::unique_ptr<SVGAnimatedType> createBoolean(std::unique_ptr<bool>);
+    static std::unique_ptr<SVGAnimatedType> createColor(std::unique_ptr<Color>);
+    static std::unique_ptr<SVGAnimatedType> createEnumeration(std::unique_ptr<unsigned>);
+    static std::unique_ptr<SVGAnimatedType> createInteger(std::unique_ptr<int>);
+    static std::unique_ptr<SVGAnimatedType> createIntegerOptionalInteger(std::unique_ptr<std::pair<int, int>>);
+    static std::unique_ptr<SVGAnimatedType> createLength(std::unique_ptr<SVGLength>);
+    static std::unique_ptr<SVGAnimatedType> createLengthList(std::unique_ptr<SVGLengthList>);
+    static std::unique_ptr<SVGAnimatedType> createNumber(std::unique_ptr<float>);
+    static std::unique_ptr<SVGAnimatedType> createNumberList(std::unique_ptr<SVGNumberList>);
+    static std::unique_ptr<SVGAnimatedType> createNumberOptionalNumber(std::unique_ptr<std::pair<float, float>>);
     static std::unique_ptr<SVGAnimatedType> createPath(std::unique_ptr<SVGPathByteStream>);
-    static std::unique_ptr<SVGAnimatedType> createPointList(SVGPointList*);
-    static std::unique_ptr<SVGAnimatedType> createPreserveAspectRatio(SVGPreserveAspectRatio*);
-    static std::unique_ptr<SVGAnimatedType> createRect(FloatRect*);
-    static std::unique_ptr<SVGAnimatedType> createString(String*);
-    static std::unique_ptr<SVGAnimatedType> createTransformList(SVGTransformList*);
+    static std::unique_ptr<SVGAnimatedType> createPointList(std::unique_ptr<SVGPointList>);
+    static std::unique_ptr<SVGAnimatedType> createPreserveAspectRatio(std::unique_ptr<SVGPreserveAspectRatio>);
+    static std::unique_ptr<SVGAnimatedType> createRect(std::unique_ptr<FloatRect>);
+    static std::unique_ptr<SVGAnimatedType> createString(std::unique_ptr<String>);
+    static std::unique_ptr<SVGAnimatedType> createTransformList(std::unique_ptr<SVGTransformList>);
     static bool supportsAnimVal(AnimatedPropertyType);
 
     AnimatedPropertyType type() const { return m_type; }

Modified: trunk/Source/WebCore/svg/SVGAnimatedTypeAnimator.h (159515 => 159516)


--- trunk/Source/WebCore/svg/SVGAnimatedTypeAnimator.h	2013-11-19 20:59:27 UTC (rev 159515)
+++ trunk/Source/WebCore/svg/SVGAnimatedTypeAnimator.h	2013-11-19 21:14:25 UTC (rev 159516)
@@ -70,13 +70,13 @@
 
     // Helpers for animators that operate on single types, eg. just one SVGAnimatedInteger.
     template<typename AnimValType>
-    typename AnimValType::ContentType* constructFromBaseValue(const SVGElementAnimatedPropertyList& animatedTypes)
+    std::unique_ptr<typename AnimValType::ContentType> constructFromBaseValue(const SVGElementAnimatedPropertyList& animatedTypes)
     {
         ASSERT(animatedTypes[0].properties.size() == 1);
         const typename AnimValType::ContentType& animatedType = castAnimatedPropertyToActualType<AnimValType>(animatedTypes[0].properties[0].get())->currentBaseValue();
 
-        typename AnimValType::ContentType* copy = new typename AnimValType::ContentType(animatedType);
-        executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, copy);
+        auto copy = std::make_unique<typename AnimValType::ContentType>(animatedType);
+        executeAction<AnimValType>(StartAnimationAction, animatedTypes, 0, copy.get());
         return copy;
     }
 
@@ -115,13 +115,13 @@
 
     // Helpers for animators that operate on pair types, eg. a pair of SVGAnimatedIntegers.
     template<typename AnimValType1, typename AnimValType2>
-    pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>* constructFromBaseValues(const SVGElementAnimatedPropertyList& animatedTypes)
+    std::unique_ptr<pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>> constructFromBaseValues(const SVGElementAnimatedPropertyList& animatedTypes)
     {
         ASSERT(animatedTypes[0].properties.size() == 2);
         const typename AnimValType1::ContentType& firstType = castAnimatedPropertyToActualType<AnimValType1>(animatedTypes[0].properties[0].get())->currentBaseValue();
         const typename AnimValType2::ContentType& secondType = castAnimatedPropertyToActualType<AnimValType2>(animatedTypes[0].properties[1].get())->currentBaseValue();
 
-        pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>* copy = new pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>(firstType, secondType);
+        auto copy = std::make_unique<pair<typename AnimValType1::ContentType, typename AnimValType2::ContentType>>(firstType, secondType);
         executeAction<AnimValType1>(StartAnimationAction, animatedTypes, 0, &copy->first);
         executeAction<AnimValType2>(StartAnimationAction, animatedTypes, 1, &copy->second);
         return copy;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to