<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[190844] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/190844">190844</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2015-10-10 23:16:18 -0700 (Sat, 10 Oct 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use references and more const in SVGPathUtilities
https://bugs.webkit.org/show_bug.cgi?id=150007

Reviewed by Zalan Bujtas.

SVGPathUtilities had lots of pointers whose non-nullness was asserted,
little const, and was very trigger-happy with stack allocations. Clean
that all up.

* svg/SVGAnimatedPath.cpp:
(WebCore::SVGAnimatedPathAnimator::constructFromString):
(WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
(WebCore::SVGAnimatedPathAnimator::addAnimatedTypes):
(WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue):
* svg/SVGPathByteStream.h:
(WebCore::SVGPathByteStream::begin):
(WebCore::SVGPathByteStream::end):
(WebCore::SVGPathByteStream::append):
* svg/SVGPathByteStreamSource.cpp:
(WebCore::SVGPathByteStreamSource::SVGPathByteStreamSource):
* svg/SVGPathByteStreamSource.h:
* svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::getTotalLength):
(WebCore::SVGPathElement::getPointAtLength):
(WebCore::SVGPathElement::getPathSegAtLength):
(WebCore::SVGPathElement::parseAttribute):
(WebCore::SVGPathElement::svgAttributeChanged):
(WebCore::SVGPathElement::pathByteStream):
(WebCore::SVGPathElement::lookupOrCreateDWrapper):
(WebCore::SVGPathElement::pathSegListChanged):
(WebCore::SVGPathElement::SVGPathElement): Deleted.
* svg/SVGPathElement.h:
* svg/SVGPathUtilities.cpp:
(WebCore::globalSVGPathBuilder):
(WebCore::globalSVGPathSegListBuilder):
(WebCore::globalSVGPathByteStreamBuilder):
(WebCore::globalSVGPathStringBuilder):
(WebCore::globalSVGPathTraversalStateBuilder):
(WebCore::globalSVGPathParser):
(WebCore::globalSVGPathBlender):
(WebCore::buildPathFromString):
(WebCore::buildSVGPathByteStreamFromSVGPathSegList):
(WebCore::appendSVGPathByteStreamFromSVGPathSeg):
(WebCore::buildPathFromByteStream):
(WebCore::buildSVGPathSegListFromByteStream):
(WebCore::buildStringFromByteStream):
(WebCore::buildStringFromSVGPathSegList):
(WebCore::buildSVGPathByteStreamFromString):
(WebCore::buildAnimatedSVGPathByteStream):
(WebCore::addToSVGPathByteStream):
(WebCore::getSVGPathSegAtLengthFromSVGPathByteStream):
(WebCore::getTotalLengthOfSVGPathByteStream):
(WebCore::getPointAtLengthOfSVGPathByteStream):
(WebCore::buildStringFromPath):
* svg/SVGPathUtilities.h:
* svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
(WebCore::SVGAnimatedPathSegListPropertyTearOff::animValDidChange):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoresvgSVGAnimatedPathcpp">trunk/Source/WebCore/svg/SVGAnimatedPath.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGPathByteStreamh">trunk/Source/WebCore/svg/SVGPathByteStream.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGPathByteStreamSourcecpp">trunk/Source/WebCore/svg/SVGPathByteStreamSource.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGPathByteStreamSourceh">trunk/Source/WebCore/svg/SVGPathByteStreamSource.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGPathElementcpp">trunk/Source/WebCore/svg/SVGPathElement.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGPathElementh">trunk/Source/WebCore/svg/SVGPathElement.h</a></li>
<li><a href="#trunkSourceWebCoresvgSVGPathUtilitiescpp">trunk/Source/WebCore/svg/SVGPathUtilities.cpp</a></li>
<li><a href="#trunkSourceWebCoresvgSVGPathUtilitiesh">trunk/Source/WebCore/svg/SVGPathUtilities.h</a></li>
<li><a href="#trunkSourceWebCoresvgpropertiesSVGAnimatedPathSegListPropertyTearOffh">trunk/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (190843 => 190844)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-10-10 21:14:56 UTC (rev 190843)
+++ trunk/Source/WebCore/ChangeLog        2015-10-11 06:16:18 UTC (rev 190844)
</span><span class="lines">@@ -1,3 +1,63 @@
</span><ins>+2015-10-10  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Use references and more const in SVGPathUtilities
+        https://bugs.webkit.org/show_bug.cgi?id=150007
+
+        Reviewed by Zalan Bujtas.
+        
+        SVGPathUtilities had lots of pointers whose non-nullness was asserted,
+        little const, and was very trigger-happy with stack allocations. Clean
+        that all up.
+
+        * svg/SVGAnimatedPath.cpp:
+        (WebCore::SVGAnimatedPathAnimator::constructFromString):
+        (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
+        (WebCore::SVGAnimatedPathAnimator::addAnimatedTypes):
+        (WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue):
+        * svg/SVGPathByteStream.h:
+        (WebCore::SVGPathByteStream::begin):
+        (WebCore::SVGPathByteStream::end):
+        (WebCore::SVGPathByteStream::append):
+        * svg/SVGPathByteStreamSource.cpp:
+        (WebCore::SVGPathByteStreamSource::SVGPathByteStreamSource):
+        * svg/SVGPathByteStreamSource.h:
+        * svg/SVGPathElement.cpp:
+        (WebCore::SVGPathElement::getTotalLength):
+        (WebCore::SVGPathElement::getPointAtLength):
+        (WebCore::SVGPathElement::getPathSegAtLength):
+        (WebCore::SVGPathElement::parseAttribute):
+        (WebCore::SVGPathElement::svgAttributeChanged):
+        (WebCore::SVGPathElement::pathByteStream):
+        (WebCore::SVGPathElement::lookupOrCreateDWrapper):
+        (WebCore::SVGPathElement::pathSegListChanged):
+        (WebCore::SVGPathElement::SVGPathElement): Deleted.
+        * svg/SVGPathElement.h:
+        * svg/SVGPathUtilities.cpp:
+        (WebCore::globalSVGPathBuilder):
+        (WebCore::globalSVGPathSegListBuilder):
+        (WebCore::globalSVGPathByteStreamBuilder):
+        (WebCore::globalSVGPathStringBuilder):
+        (WebCore::globalSVGPathTraversalStateBuilder):
+        (WebCore::globalSVGPathParser):
+        (WebCore::globalSVGPathBlender):
+        (WebCore::buildPathFromString):
+        (WebCore::buildSVGPathByteStreamFromSVGPathSegList):
+        (WebCore::appendSVGPathByteStreamFromSVGPathSeg):
+        (WebCore::buildPathFromByteStream):
+        (WebCore::buildSVGPathSegListFromByteStream):
+        (WebCore::buildStringFromByteStream):
+        (WebCore::buildStringFromSVGPathSegList):
+        (WebCore::buildSVGPathByteStreamFromString):
+        (WebCore::buildAnimatedSVGPathByteStream):
+        (WebCore::addToSVGPathByteStream):
+        (WebCore::getSVGPathSegAtLengthFromSVGPathByteStream):
+        (WebCore::getTotalLengthOfSVGPathByteStream):
+        (WebCore::getPointAtLengthOfSVGPathByteStream):
+        (WebCore::buildStringFromPath):
+        * svg/SVGPathUtilities.h:
+        * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
+        (WebCore::SVGAnimatedPathSegListPropertyTearOff::animValDidChange):
+
</ins><span class="cx"> 2015-10-10  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reduce pointless malloc traffic in ElementRuleCollector.
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGAnimatedPathcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGAnimatedPath.cpp (190843 => 190844)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGAnimatedPath.cpp        2015-10-10 21:14:56 UTC (rev 190843)
+++ trunk/Source/WebCore/svg/SVGAnimatedPath.cpp        2015-10-11 06:16:18 UTC (rev 190844)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> std::unique_ptr&lt;SVGAnimatedType&gt; SVGAnimatedPathAnimator::constructFromString(const String&amp; string)
</span><span class="cx"> {
</span><span class="cx">     auto byteStream = std::make_unique&lt;SVGPathByteStream&gt;();
</span><del>-    buildSVGPathByteStreamFromString(string, byteStream.get(), UnalteredParsing);
</del><ins>+    buildSVGPathByteStreamFromString(string, *byteStream, UnalteredParsing);
</ins><span class="cx">     return SVGAnimatedType::createPath(WTF::move(byteStream));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">     SVGAnimatedPathSegListPropertyTearOff* property = castAnimatedPropertyToActualType&lt;SVGAnimatedPathSegListPropertyTearOff&gt;(animatedTypes[0].properties[0].get());
</span><span class="cx">     const SVGPathSegList&amp; baseValue = property-&gt;currentBaseValue();
</span><span class="cx"> 
</span><del>-    buildSVGPathByteStreamFromSVGPathSegList(baseValue, byteStream, UnalteredParsing);
</del><ins>+    buildSVGPathByteStreamFromSVGPathSegList(baseValue, *byteStream, UnalteredParsing);
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;RefPtr&lt;SVGAnimatedPathSegListPropertyTearOff&gt;&gt; result;
</span><span class="cx"> 
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">     unsigned fromPathSize = fromPath-&gt;size();
</span><span class="cx">     if (!fromPathSize || fromPathSize != toPath-&gt;size())
</span><span class="cx">         return;
</span><del>-    addToSVGPathByteStream(toPath, fromPath);
</del><ins>+    addToSVGPathByteStream(*toPath, *fromPath);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SVGAnimatedPathAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGAnimatedType* from, SVGAnimatedType* to, SVGAnimatedType* toAtEndOfDuration, SVGAnimatedType* animated)
</span><span class="lines">@@ -133,15 +133,15 @@
</span><span class="cx">     if (!m_animationElement-&gt;adjustFromToListValues&lt;SVGPathByteStream&gt;(*fromPath, *toPath, *animatedPath, percentage, false))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    buildAnimatedSVGPathByteStream(fromPath, toPath, animatedPath, percentage);
</del><ins>+    buildAnimatedSVGPathByteStream(*fromPath, *toPath, *animatedPath, percentage);
</ins><span class="cx"> 
</span><span class="cx">     // Handle additive='sum'.
</span><span class="cx">     if (lastAnimatedPath)
</span><del>-        addToSVGPathByteStream(animatedPath, lastAnimatedPath.get());
</del><ins>+        addToSVGPathByteStream(*animatedPath, *lastAnimatedPath);
</ins><span class="cx"> 
</span><span class="cx">     // Handle accumulate='sum'.
</span><span class="cx">     if (m_animationElement-&gt;isAccumulated() &amp;&amp; repeatCount)
</span><del>-        addToSVGPathByteStream(animatedPath, toAtEndOfDurationPath, repeatCount);
</del><ins>+        addToSVGPathByteStream(*animatedPath, *toAtEndOfDurationPath, repeatCount);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> float SVGAnimatedPathAnimator::calculateDistance(const String&amp;, const String&amp;)
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGPathByteStreamh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGPathByteStream.h (190843 => 190844)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGPathByteStream.h        2015-10-10 21:14:56 UTC (rev 190843)
+++ trunk/Source/WebCore/svg/SVGPathByteStream.h        2015-10-11 06:16:18 UTC (rev 190844)
</span><span class="lines">@@ -55,10 +55,11 @@
</span><span class="cx">         return std::make_unique&lt;SVGPathByteStream&gt;(m_data);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    DataIterator begin() { return m_data.begin(); }
-    DataIterator end() { return m_data.end(); }
</del><ins>+    DataIterator begin() const { return m_data.begin(); }
+    DataIterator end() const { return m_data.end(); }
+
</ins><span class="cx">     void append(unsigned char byte) { m_data.append(byte); }
</span><del>-    void append(SVGPathByteStream&amp; other)
</del><ins>+    void append(const SVGPathByteStream&amp; other)
</ins><span class="cx">     {
</span><span class="cx">         for (auto stream : other)
</span><span class="cx">             append(stream);
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGPathByteStreamSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGPathByteStreamSource.cpp (190843 => 190844)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGPathByteStreamSource.cpp        2015-10-10 21:14:56 UTC (rev 190843)
+++ trunk/Source/WebCore/svg/SVGPathByteStreamSource.cpp        2015-10-11 06:16:18 UTC (rev 190844)
</span><span class="lines">@@ -22,11 +22,10 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-SVGPathByteStreamSource::SVGPathByteStreamSource(SVGPathByteStream* stream)
</del><ins>+SVGPathByteStreamSource::SVGPathByteStreamSource(const SVGPathByteStream&amp; stream)
</ins><span class="cx"> {
</span><del>-    ASSERT(stream);
-    m_streamCurrent = stream-&gt;begin();
-    m_streamEnd = stream-&gt;end();
</del><ins>+    m_streamCurrent = stream.begin();
+    m_streamEnd = stream.end();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool SVGPathByteStreamSource::hasMoreData() const
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGPathByteStreamSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGPathByteStreamSource.h (190843 => 190844)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGPathByteStreamSource.h        2015-10-10 21:14:56 UTC (rev 190843)
+++ trunk/Source/WebCore/svg/SVGPathByteStreamSource.h        2015-10-11 06:16:18 UTC (rev 190844)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> class SVGPathByteStreamSource : public SVGPathSource {
</span><span class="cx"> public:
</span><del>-    explicit SVGPathByteStreamSource(SVGPathByteStream*);
</del><ins>+    explicit SVGPathByteStreamSource(const SVGPathByteStream&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     virtual bool hasMoreData() const override;
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGPathElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGPathElement.cpp (190843 => 190844)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGPathElement.cpp        2015-10-10 21:14:56 UTC (rev 190843)
+++ trunk/Source/WebCore/svg/SVGPathElement.cpp        2015-10-11 06:16:18 UTC (rev 190844)
</span><span class="lines">@@ -80,7 +80,6 @@
</span><span class="cx"> 
</span><span class="cx"> inline SVGPathElement::SVGPathElement(const QualifiedName&amp; tagName, Document&amp; document)
</span><span class="cx">     : SVGGraphicsElement(tagName, document)
</span><del>-    , m_pathByteStream(std::make_unique&lt;SVGPathByteStream&gt;())
</del><span class="cx">     , m_pathSegList(PathSegUnalteredRole)
</span><span class="cx">     , m_isAnimValObserved(false)
</span><span class="cx"> {
</span><span class="lines">@@ -93,21 +92,21 @@
</span><span class="cx">     return adoptRef(*new SVGPathElement(tagName, document));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-float SVGPathElement::getTotalLength()
</del><ins>+float SVGPathElement::getTotalLength() const
</ins><span class="cx"> {
</span><span class="cx">     float totalLength = 0;
</span><span class="cx">     getTotalLengthOfSVGPathByteStream(pathByteStream(), totalLength);
</span><span class="cx">     return totalLength;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SVGPoint SVGPathElement::getPointAtLength(float length)
</del><ins>+SVGPoint SVGPathElement::getPointAtLength(float length) const
</ins><span class="cx"> {
</span><span class="cx">     SVGPoint point;
</span><span class="cx">     getPointAtLengthOfSVGPathByteStream(pathByteStream(), length, point);
</span><span class="cx">     return point;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-unsigned SVGPathElement::getPathSegAtLength(float length)
</del><ins>+unsigned SVGPathElement::getPathSegAtLength(float length) const
</ins><span class="cx"> {
</span><span class="cx">     unsigned pathSeg = 0;
</span><span class="cx">     getSVGPathSegAtLengthFromSVGPathByteStream(pathByteStream(), length, pathSeg);
</span><span class="lines">@@ -224,7 +223,7 @@
</span><span class="cx"> void SVGPathElement::parseAttribute(const QualifiedName&amp; name, const AtomicString&amp; value)
</span><span class="cx"> {
</span><span class="cx">     if (name == SVGNames::dAttr) {
</span><del>-        if (!buildSVGPathByteStreamFromString(value, m_pathByteStream.get(), UnalteredParsing))
</del><ins>+        if (!buildSVGPathByteStreamFromString(value, m_pathByteStream, UnalteredParsing))
</ins><span class="cx">             document().accessSVGExtensions().reportError(&quot;Problem parsing d=\&quot;&quot; + value + &quot;\&quot;&quot;);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -254,7 +253,7 @@
</span><span class="cx">     if (attrName == SVGNames::dAttr) {
</span><span class="cx">         if (m_pathSegList.shouldSynchronize &amp;&amp; !SVGAnimatedProperty::lookupWrapper&lt;SVGPathElement, SVGAnimatedPathSegListPropertyTearOff&gt;(this, dPropertyInfo())-&gt;isAnimating()) {
</span><span class="cx">             SVGPathSegList newList(PathSegUnalteredRole);
</span><del>-            buildSVGPathSegListFromByteStream(m_pathByteStream.get(), this, newList, UnalteredParsing);
</del><ins>+            buildSVGPathSegListFromByteStream(m_pathByteStream, *this, newList, UnalteredParsing);
</ins><span class="cx">             m_pathSegList.value = newList;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -293,12 +292,17 @@
</span><span class="cx">     invalidateMPathDependencies();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SVGPathByteStream* SVGPathElement::pathByteStream() const
</del><ins>+const SVGPathByteStream&amp; SVGPathElement::pathByteStream() const
</ins><span class="cx"> {
</span><span class="cx">     SVGAnimatedProperty* property = SVGAnimatedProperty::lookupWrapper&lt;SVGPathElement, SVGAnimatedPathSegListPropertyTearOff&gt;(this, dPropertyInfo());
</span><span class="cx">     if (!property || !property-&gt;isAnimating())
</span><del>-        return m_pathByteStream.get();
-    return static_cast&lt;SVGAnimatedPathSegListPropertyTearOff*&gt;(property)-&gt;animatedPathByteStream();
</del><ins>+        return m_pathByteStream;
+    
+    SVGPathByteStream* animatedPathByteStream = static_cast&lt;SVGAnimatedPathSegListPropertyTearOff*&gt;(property)-&gt;animatedPathByteStream();
+    if (!animatedPathByteStream)
+        return m_pathByteStream;
+
+    return *animatedPathByteStream;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;SVGAnimatedProperty&gt; SVGPathElement::lookupOrCreateDWrapper(SVGElement* contextElement)
</span><span class="lines">@@ -310,7 +314,7 @@
</span><span class="cx">         return *property;
</span><span class="cx"> 
</span><span class="cx">     // Build initial SVGPathSegList.
</span><del>-    buildSVGPathSegListFromByteStream(ownerType.m_pathByteStream.get(), &amp;ownerType, ownerType.m_pathSegList.value, UnalteredParsing);
</del><ins>+    buildSVGPathSegListFromByteStream(ownerType.m_pathByteStream, ownerType, ownerType.m_pathSegList.value, UnalteredParsing);
</ins><span class="cx"> 
</span><span class="cx">     return SVGAnimatedProperty::lookupOrCreateWrapper&lt;SVGPathElement, SVGAnimatedPathSegListPropertyTearOff, SVGPathSegList&gt;
</span><span class="cx">         (&amp;ownerType, dPropertyInfo(), ownerType.m_pathSegList.value);
</span><span class="lines">@@ -359,9 +363,9 @@
</span><span class="cx">     case PathSegUnalteredRole:
</span><span class="cx">         if (listModification == ListModificationAppend) {
</span><span class="cx">             ASSERT(!m_pathSegList.value.isEmpty());
</span><del>-            appendSVGPathByteStreamFromSVGPathSeg(m_pathSegList.value.last().copyRef(), m_pathByteStream.get(), UnalteredParsing);
</del><ins>+            appendSVGPathByteStreamFromSVGPathSeg(m_pathSegList.value.last().copyRef(), m_pathByteStream, UnalteredParsing);
</ins><span class="cx">         } else
</span><del>-            buildSVGPathByteStreamFromSVGPathSegList(m_pathSegList.value, m_pathByteStream.get(), UnalteredParsing);
</del><ins>+            buildSVGPathByteStreamFromSVGPathSegList(m_pathSegList.value, m_pathByteStream, UnalteredParsing);
</ins><span class="cx">         break;
</span><span class="cx">     case PathSegUndefinedRole:
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGPathElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGPathElement.h (190843 => 190844)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGPathElement.h        2015-10-10 21:14:56 UTC (rev 190843)
+++ trunk/Source/WebCore/svg/SVGPathElement.h        2015-10-11 06:16:18 UTC (rev 190844)
</span><span class="lines">@@ -57,9 +57,9 @@
</span><span class="cx"> public:
</span><span class="cx">     static Ref&lt;SVGPathElement&gt; create(const QualifiedName&amp;, Document&amp;);
</span><span class="cx">     
</span><del>-    float getTotalLength();
-    SVGPoint getPointAtLength(float distance);
-    unsigned getPathSegAtLength(float distance);
</del><ins>+    float getTotalLength() const;
+    SVGPoint getPointAtLength(float distance) const;
+    unsigned getPathSegAtLength(float distance) const;
</ins><span class="cx"> 
</span><span class="cx">     Ref&lt;SVGPathSegClosePath&gt; createSVGPathSegClosePath(SVGPathSegRole = PathSegUndefinedRole);
</span><span class="cx">     Ref&lt;SVGPathSegMovetoAbs&gt; createSVGPathSegMovetoAbs(float x, float y, SVGPathSegRole = PathSegUndefinedRole);
</span><span class="lines">@@ -87,7 +87,7 @@
</span><span class="cx">     SVGPathSegListPropertyTearOff* normalizedPathSegList();
</span><span class="cx">     SVGPathSegListPropertyTearOff* animatedNormalizedPathSegList();
</span><span class="cx"> 
</span><del>-    SVGPathByteStream* pathByteStream() const;
</del><ins>+    const SVGPathByteStream&amp; pathByteStream() const;
</ins><span class="cx"> 
</span><span class="cx">     void pathSegListChanged(SVGPathSegRole, ListModification = ListModificationUnknown);
</span><span class="cx"> 
</span><span class="lines">@@ -124,7 +124,7 @@
</span><span class="cx">     void invalidateMPathDependencies();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    std::unique_ptr&lt;SVGPathByteStream&gt; m_pathByteStream;
</del><ins>+    SVGPathByteStream m_pathByteStream;
</ins><span class="cx">     mutable SVGSynchronizableAnimatedProperty&lt;SVGPathSegList&gt; m_pathSegList;
</span><span class="cx">     bool m_isAnimValObserved;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGPathUtilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGPathUtilities.cpp (190843 => 190844)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGPathUtilities.cpp        2015-10-10 21:14:56 UTC (rev 190843)
+++ trunk/Source/WebCore/svg/SVGPathUtilities.cpp        2015-10-11 06:16:18 UTC (rev 190844)
</span><span class="lines">@@ -37,76 +37,60 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static SVGPathBuilder* globalSVGPathBuilder(Path&amp; result)
</del><ins>+// FIXME: are all these globals warranted? Why not just make them on the stack?
+static SVGPathBuilder&amp; globalSVGPathBuilder(Path&amp; result)
</ins><span class="cx"> {
</span><del>-    static SVGPathBuilder* s_builder = nullptr;
-    if (!s_builder)
-        s_builder = new SVGPathBuilder;
-
-    s_builder-&gt;setCurrentPath(&amp;result);
-    return s_builder;
</del><ins>+    static NeverDestroyed&lt;SVGPathBuilder&gt; s_builder;
+    s_builder.get().setCurrentPath(&amp;result);
+    return s_builder.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static SVGPathSegListBuilder* globalSVGPathSegListBuilder(SVGPathElement* element, SVGPathSegRole role, SVGPathSegList&amp; result)
</del><ins>+static SVGPathSegListBuilder&amp; globalSVGPathSegListBuilder(SVGPathElement&amp; element, SVGPathSegRole role, SVGPathSegList&amp; result)
</ins><span class="cx"> {
</span><del>-    static SVGPathSegListBuilder* s_builder = nullptr;
-    if (!s_builder)
-        s_builder = new SVGPathSegListBuilder;
</del><ins>+    static NeverDestroyed&lt;SVGPathSegListBuilder&gt; s_builder;
</ins><span class="cx"> 
</span><del>-    s_builder-&gt;setCurrentSVGPathElement(element);
-    s_builder-&gt;setCurrentSVGPathSegList(result);
-    s_builder-&gt;setCurrentSVGPathSegRole(role);
-    return s_builder;
</del><ins>+    s_builder.get().setCurrentSVGPathElement(&amp;element);
+    s_builder.get().setCurrentSVGPathSegList(result);
+    s_builder.get().setCurrentSVGPathSegRole(role);
+    return s_builder.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static SVGPathByteStreamBuilder* globalSVGPathByteStreamBuilder(SVGPathByteStream* result)
</del><ins>+static SVGPathByteStreamBuilder&amp; globalSVGPathByteStreamBuilder(SVGPathByteStream&amp; result)
</ins><span class="cx"> {
</span><del>-    static SVGPathByteStreamBuilder* s_builder = nullptr;
-    if (!s_builder)
-        s_builder = new SVGPathByteStreamBuilder;
-
-    s_builder-&gt;setCurrentByteStream(result);
-    return s_builder;
</del><ins>+    static NeverDestroyed&lt;SVGPathByteStreamBuilder&gt; s_builder;
+    s_builder.get().setCurrentByteStream(&amp;result);
+    return s_builder.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static SVGPathStringBuilder* globalSVGPathStringBuilder()
</del><ins>+static SVGPathStringBuilder&amp; globalSVGPathStringBuilder()
</ins><span class="cx"> {
</span><del>-    static SVGPathStringBuilder* s_builder = nullptr;
-    if (!s_builder)
-        s_builder = new SVGPathStringBuilder;
-
-    return s_builder;
</del><ins>+    static NeverDestroyed&lt;SVGPathStringBuilder&gt; s_builder;
+    return s_builder.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static SVGPathTraversalStateBuilder* globalSVGPathTraversalStateBuilder(PathTraversalState&amp; traversalState, float length)
</del><ins>+static SVGPathTraversalStateBuilder&amp; globalSVGPathTraversalStateBuilder(PathTraversalState&amp; traversalState, float length)
</ins><span class="cx"> {
</span><del>-    static SVGPathTraversalStateBuilder* s_builder = nullptr;
-    if (!s_builder)
-        s_builder = new SVGPathTraversalStateBuilder;
</del><ins>+    static NeverDestroyed&lt;SVGPathTraversalStateBuilder&gt; s_parser;
</ins><span class="cx"> 
</span><del>-    s_builder-&gt;setCurrentTraversalState(&amp;traversalState);
-    s_builder-&gt;setDesiredLength(length);
-    return s_builder;
</del><ins>+    s_parser.get().setCurrentTraversalState(&amp;traversalState);
+    s_parser.get().setDesiredLength(length);
+    return s_parser.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static SVGPathParser* globalSVGPathParser(SVGPathSource* source, SVGPathConsumer* consumer)
</del><ins>+// FIXME: why bother keeping a singleton around? Is it slow to allocate?
+static SVGPathParser&amp; globalSVGPathParser(SVGPathSource&amp; source, SVGPathConsumer&amp; consumer)
</ins><span class="cx"> {
</span><del>-    static SVGPathParser* s_parser = nullptr;
-    if (!s_parser)
-        s_parser = new SVGPathParser;
</del><ins>+    static NeverDestroyed&lt;SVGPathParser&gt; s_parser;
</ins><span class="cx"> 
</span><del>-    s_parser-&gt;setCurrentSource(source);
-    s_parser-&gt;setCurrentConsumer(consumer);
-    return s_parser;
</del><ins>+    s_parser.get().setCurrentSource(&amp;source);
+    s_parser.get().setCurrentConsumer(&amp;consumer);
+    return s_parser.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static SVGPathBlender* globalSVGPathBlender()
</del><ins>+static SVGPathBlender&amp; globalSVGPathBlender()
</ins><span class="cx"> {
</span><del>-    static SVGPathBlender* s_blender = nullptr;
-    if (!s_blender)
-        s_blender = new SVGPathBlender;
-
-    return s_blender;
</del><ins>+    static NeverDestroyed&lt;SVGPathBlender&gt; s_blender;
+    return s_blender.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool buildPathFromString(const String&amp; d, Path&amp; result)
</span><span class="lines">@@ -114,96 +98,91 @@
</span><span class="cx">     if (d.isEmpty())
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    SVGPathBuilder* builder = globalSVGPathBuilder(result);
</del><ins>+    SVGPathBuilder&amp; builder = globalSVGPathBuilder(result);
</ins><span class="cx"> 
</span><del>-    auto source = std::make_unique&lt;SVGPathStringSource&gt;(d);
-    SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
-    bool ok = parser-&gt;parsePathDataFromSource(NormalizedParsing);
-    parser-&gt;cleanup();
</del><ins>+    SVGPathStringSource source(d);
+    SVGPathParser&amp; parser = globalSVGPathParser(source, builder);
+    bool ok = parser.parsePathDataFromSource(NormalizedParsing);
+    parser.cleanup();
</ins><span class="cx">     return ok;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool buildSVGPathByteStreamFromSVGPathSegList(const SVGPathSegList&amp; list, SVGPathByteStream* result, PathParsingMode parsingMode)
</del><ins>+bool buildSVGPathByteStreamFromSVGPathSegList(const SVGPathSegList&amp; list, SVGPathByteStream&amp; result, PathParsingMode parsingMode)
</ins><span class="cx"> {
</span><del>-    ASSERT(result);
-    result-&gt;clear();
</del><ins>+    result.clear();
</ins><span class="cx">     if (list.isEmpty())
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(result);
</del><ins>+    SVGPathByteStreamBuilder&amp; builder = globalSVGPathByteStreamBuilder(result);
</ins><span class="cx"> 
</span><del>-    auto source = std::make_unique&lt;SVGPathSegListSource&gt;(list);
-    SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
-    bool ok = parser-&gt;parsePathDataFromSource(parsingMode);
-    parser-&gt;cleanup();
</del><ins>+    SVGPathSegListSource source(list);
+    SVGPathParser&amp; parser = globalSVGPathParser(source, builder);
+    bool ok = parser.parsePathDataFromSource(parsingMode);
+    parser.cleanup();
</ins><span class="cx">     return ok;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool appendSVGPathByteStreamFromSVGPathSeg(RefPtr&lt;SVGPathSeg&gt;&amp;&amp; pathSeg, SVGPathByteStream* result, PathParsingMode parsingMode)
</del><ins>+bool appendSVGPathByteStreamFromSVGPathSeg(RefPtr&lt;SVGPathSeg&gt;&amp;&amp; pathSeg, SVGPathByteStream&amp; result, PathParsingMode parsingMode)
</ins><span class="cx"> {
</span><del>-    ASSERT(result);
</del><span class="cx">     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists!
</span><span class="cx">     ASSERT(parsingMode == UnalteredParsing);
</span><span class="cx"> 
</span><span class="cx">     SVGPathSegList appendedItemList(PathSegUnalteredRole);
</span><span class="cx">     appendedItemList.append(WTF::move(pathSeg));
</span><del>-    auto appendedByteStream = std::make_unique&lt;SVGPathByteStream&gt;();
</del><span class="cx"> 
</span><del>-    SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(appendedByteStream.get());
-    auto source = std::make_unique&lt;SVGPathSegListSource&gt;(appendedItemList);
-    SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
-    bool ok = parser-&gt;parsePathDataFromSource(parsingMode, false);
-    parser-&gt;cleanup();
</del><ins>+    SVGPathByteStream appendedByteStream;
+    SVGPathByteStreamBuilder&amp; builder = globalSVGPathByteStreamBuilder(appendedByteStream);
+    SVGPathSegListSource source(appendedItemList);
+    SVGPathParser&amp; parser = globalSVGPathParser(source, builder);
+    bool ok = parser.parsePathDataFromSource(parsingMode, false);
+    parser.cleanup();
</ins><span class="cx"> 
</span><span class="cx">     if (ok)
</span><del>-        result-&gt;append(*appendedByteStream);
</del><ins>+        result.append(appendedByteStream);
</ins><span class="cx"> 
</span><span class="cx">     return ok;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool buildPathFromByteStream(SVGPathByteStream* stream, Path&amp; result)
</del><ins>+bool buildPathFromByteStream(const SVGPathByteStream&amp; stream, Path&amp; result)
</ins><span class="cx"> {
</span><del>-    ASSERT(stream);
-    if (stream-&gt;isEmpty())
</del><ins>+    if (stream.isEmpty())
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    SVGPathBuilder* builder = globalSVGPathBuilder(result);
</del><ins>+    SVGPathBuilder&amp; builder = globalSVGPathBuilder(result);
</ins><span class="cx"> 
</span><del>-    auto source = std::make_unique&lt;SVGPathByteStreamSource&gt;(stream);
-    SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
-    bool ok = parser-&gt;parsePathDataFromSource(NormalizedParsing);
-    parser-&gt;cleanup();
</del><ins>+    SVGPathByteStreamSource source(stream);
+    SVGPathParser&amp; parser = globalSVGPathParser(source, builder);
+    bool ok = parser.parsePathDataFromSource(NormalizedParsing);
+    parser.cleanup();
</ins><span class="cx">     return ok;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool buildSVGPathSegListFromByteStream(SVGPathByteStream* stream, SVGPathElement* element, SVGPathSegList&amp; result, PathParsingMode parsingMode)
</del><ins>+bool buildSVGPathSegListFromByteStream(const SVGPathByteStream&amp; stream, SVGPathElement&amp; element, SVGPathSegList&amp; result, PathParsingMode parsingMode)
</ins><span class="cx"> {
</span><del>-    ASSERT(stream);
-    if (stream-&gt;isEmpty())
</del><ins>+    if (stream.isEmpty())
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    SVGPathSegListBuilder* builder = globalSVGPathSegListBuilder(element, parsingMode == NormalizedParsing ? PathSegNormalizedRole : PathSegUnalteredRole, result);
</del><ins>+    SVGPathSegListBuilder&amp; builder = globalSVGPathSegListBuilder(element, parsingMode == NormalizedParsing ? PathSegNormalizedRole : PathSegUnalteredRole, result);
</ins><span class="cx"> 
</span><del>-    auto source = std::make_unique&lt;SVGPathByteStreamSource&gt;(stream);
-    SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
-    bool ok = parser-&gt;parsePathDataFromSource(parsingMode);
-    parser-&gt;cleanup();
</del><ins>+    SVGPathByteStreamSource source(stream);
+    SVGPathParser&amp; parser = globalSVGPathParser(source, builder);
+    bool ok = parser.parsePathDataFromSource(parsingMode);
+    parser.cleanup();
</ins><span class="cx">     return ok;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool buildStringFromByteStream(SVGPathByteStream* stream, String&amp; result, PathParsingMode parsingMode)
</del><ins>+bool buildStringFromByteStream(const SVGPathByteStream&amp; stream, String&amp; result, PathParsingMode parsingMode)
</ins><span class="cx"> {
</span><del>-    ASSERT(stream);
-    if (stream-&gt;isEmpty())
</del><ins>+    if (stream.isEmpty())
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    SVGPathStringBuilder* builder = globalSVGPathStringBuilder();
</del><ins>+    SVGPathStringBuilder&amp; builder = globalSVGPathStringBuilder();
</ins><span class="cx"> 
</span><del>-    auto source = std::make_unique&lt;SVGPathByteStreamSource&gt;(stream);
-    SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
-    bool ok = parser-&gt;parsePathDataFromSource(parsingMode);
-    result = builder-&gt;result();
-    parser-&gt;cleanup();
</del><ins>+    SVGPathByteStreamSource source(stream);
+    SVGPathParser&amp; parser = globalSVGPathParser(source, builder);
+    bool ok = parser.parsePathDataFromSource(parsingMode);
+    result = builder.result();
+    parser.cleanup();
</ins><span class="cx">     return ok;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -213,121 +192,113 @@
</span><span class="cx">     if (list.isEmpty())
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    SVGPathStringBuilder* builder = globalSVGPathStringBuilder();
</del><ins>+    SVGPathStringBuilder&amp; builder = globalSVGPathStringBuilder();
</ins><span class="cx"> 
</span><del>-    auto source = std::make_unique&lt;SVGPathSegListSource&gt;(list);
-    SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
-    bool ok = parser-&gt;parsePathDataFromSource(parsingMode);
-    result = builder-&gt;result();
-    parser-&gt;cleanup();
</del><ins>+    SVGPathSegListSource source(list);
+    SVGPathParser&amp; parser = globalSVGPathParser(source, builder);
+    bool ok = parser.parsePathDataFromSource(parsingMode);
+    result = builder.result();
+    parser.cleanup();
</ins><span class="cx">     return ok;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool buildSVGPathByteStreamFromString(const String&amp; d, SVGPathByteStream* result, PathParsingMode parsingMode)
</del><ins>+bool buildSVGPathByteStreamFromString(const String&amp; d, SVGPathByteStream&amp; result, PathParsingMode parsingMode)
</ins><span class="cx"> {
</span><del>-    ASSERT(result);
-    result-&gt;clear();
</del><ins>+    result.clear();
</ins><span class="cx">     if (d.isEmpty())
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(result);
</del><ins>+    SVGPathByteStreamBuilder&amp; builder = globalSVGPathByteStreamBuilder(result);
</ins><span class="cx"> 
</span><del>-    auto source = std::make_unique&lt;SVGPathStringSource&gt;(d);
-    SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
-    bool ok = parser-&gt;parsePathDataFromSource(parsingMode);
-    parser-&gt;cleanup();
</del><ins>+    SVGPathStringSource source(d);
+    SVGPathParser&amp; parser = globalSVGPathParser(source, builder);
+    bool ok = parser.parsePathDataFromSource(parsingMode);
+    parser.cleanup();
</ins><span class="cx">     return ok;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool buildAnimatedSVGPathByteStream(SVGPathByteStream* fromStream, SVGPathByteStream* toStream, SVGPathByteStream* result, float progress)
</del><ins>+bool buildAnimatedSVGPathByteStream(const SVGPathByteStream&amp; fromStream, const SVGPathByteStream&amp; toStream, SVGPathByteStream&amp; result, float progress)
</ins><span class="cx"> {
</span><del>-    ASSERT(fromStream);
-    ASSERT(toStream);
-    ASSERT(result);
-    ASSERT(toStream != result);
-
-    result-&gt;clear();
-    if (toStream-&gt;isEmpty())
</del><ins>+    ASSERT(&amp;toStream != &amp;result);
+    result.clear();
+    if (toStream.isEmpty())
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(result);
</del><ins>+    SVGPathByteStreamBuilder&amp; builder = globalSVGPathByteStreamBuilder(result);
</ins><span class="cx"> 
</span><del>-    auto fromSource = std::make_unique&lt;SVGPathByteStreamSource&gt;(fromStream);
-    auto toSource = std::make_unique&lt;SVGPathByteStreamSource&gt;(toStream);
-    SVGPathBlender* blender = globalSVGPathBlender();
-    bool ok = blender-&gt;blendAnimatedPath(progress, fromSource.get(), toSource.get(), builder);
-    blender-&gt;cleanup();
</del><ins>+    SVGPathByteStreamSource fromSource(fromStream);
+    SVGPathByteStreamSource toSource(toStream);
+    SVGPathBlender&amp; blender = globalSVGPathBlender();
+    bool ok = blender.blendAnimatedPath(progress, &amp;fromSource, &amp;toSource, &amp;builder);
+    blender.cleanup();
</ins><span class="cx">     return ok;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool addToSVGPathByteStream(SVGPathByteStream* fromStream, SVGPathByteStream* byStream, unsigned repeatCount)
</del><ins>+bool addToSVGPathByteStream(SVGPathByteStream&amp; streamToAppendTo, const SVGPathByteStream&amp; byStream, unsigned repeatCount)
</ins><span class="cx"> {
</span><del>-    ASSERT(fromStream);
-    ASSERT(byStream);
-    if (fromStream-&gt;isEmpty() || byStream-&gt;isEmpty())
</del><ins>+    // Why return when streamToAppendTo is empty? Don't we still need to append?
+    if (streamToAppendTo.isEmpty() || byStream.isEmpty())
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(fromStream);
</del><ins>+    // Is it OK to make the SVGPathByteStreamBuilder from a stream, and then clear that stream?
+    SVGPathByteStreamBuilder&amp; builder = globalSVGPathByteStreamBuilder(streamToAppendTo);
</ins><span class="cx"> 
</span><del>-    auto fromStreamCopy = fromStream-&gt;copy();
-    fromStream-&gt;clear();
</del><ins>+    SVGPathByteStream fromStreamCopy = streamToAppendTo;
+    streamToAppendTo.clear();
</ins><span class="cx"> 
</span><del>-    auto fromSource = std::make_unique&lt;SVGPathByteStreamSource&gt;(fromStreamCopy.get());
-    auto bySource = std::make_unique&lt;SVGPathByteStreamSource&gt;(byStream);
-    SVGPathBlender* blender = globalSVGPathBlender();
-    bool ok = blender-&gt;addAnimatedPath(fromSource.get(), bySource.get(), builder, repeatCount);
-    blender-&gt;cleanup();
</del><ins>+    SVGPathByteStreamSource fromSource(fromStreamCopy);
+    SVGPathByteStreamSource bySource(byStream);
+    SVGPathBlender&amp; blender = globalSVGPathBlender();
+    bool ok = blender.addAnimatedPath(&amp;fromSource, &amp;bySource, &amp;builder, repeatCount);
+    blender.cleanup();
</ins><span class="cx">     return ok;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool getSVGPathSegAtLengthFromSVGPathByteStream(SVGPathByteStream* stream, float length, unsigned&amp; pathSeg)
</del><ins>+bool getSVGPathSegAtLengthFromSVGPathByteStream(const SVGPathByteStream&amp; stream, float length, unsigned&amp; pathSeg)
</ins><span class="cx"> {
</span><del>-    ASSERT(stream);
-    if (stream-&gt;isEmpty())
</del><ins>+    if (stream.isEmpty())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     PathTraversalState traversalState(PathTraversalState::Action::SegmentAtLength);
</span><del>-    SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, length);
</del><ins>+    SVGPathTraversalStateBuilder&amp; builder = globalSVGPathTraversalStateBuilder(traversalState, length);
</ins><span class="cx"> 
</span><del>-    auto source = std::make_unique&lt;SVGPathByteStreamSource&gt;(stream);
-    SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
-    bool ok = parser-&gt;parsePathDataFromSource(NormalizedParsing);
-    pathSeg = builder-&gt;pathSegmentIndex();
-    parser-&gt;cleanup();
</del><ins>+    SVGPathByteStreamSource source(stream);
+    SVGPathParser&amp; parser = globalSVGPathParser(source, builder);
+    bool ok = parser.parsePathDataFromSource(NormalizedParsing);
+    pathSeg = builder.pathSegmentIndex();
+    parser.cleanup();
</ins><span class="cx">     return ok;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool getTotalLengthOfSVGPathByteStream(SVGPathByteStream* stream, float&amp; totalLength)
</del><ins>+bool getTotalLengthOfSVGPathByteStream(const SVGPathByteStream&amp; stream, float&amp; totalLength)
</ins><span class="cx"> {
</span><del>-    ASSERT(stream);
-    if (stream-&gt;isEmpty())
</del><ins>+    if (stream.isEmpty())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     PathTraversalState traversalState(PathTraversalState::Action::TotalLength);
</span><del>-    SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, 0);
</del><ins>+    SVGPathTraversalStateBuilder&amp; builder = globalSVGPathTraversalStateBuilder(traversalState, 0);
</ins><span class="cx"> 
</span><del>-    auto source = std::make_unique&lt;SVGPathByteStreamSource&gt;(stream);
-    SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
-    bool ok = parser-&gt;parsePathDataFromSource(NormalizedParsing);
-    totalLength = builder-&gt;totalLength();
-    parser-&gt;cleanup();
</del><ins>+    SVGPathByteStreamSource source(stream);
+    SVGPathParser&amp; parser = globalSVGPathParser(source, builder);
+    bool ok = parser.parsePathDataFromSource(NormalizedParsing);
+    totalLength = builder.totalLength();
+    parser.cleanup();
</ins><span class="cx">     return ok;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool getPointAtLengthOfSVGPathByteStream(SVGPathByteStream* stream, float length, SVGPoint&amp; point)
</del><ins>+bool getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream&amp; stream, float length, SVGPoint&amp; point)
</ins><span class="cx"> {
</span><del>-    ASSERT(stream);
-    if (stream-&gt;isEmpty())
</del><ins>+    if (stream.isEmpty())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     PathTraversalState traversalState(PathTraversalState::Action::VectorAtLength);
</span><del>-    SVGPathTraversalStateBuilder* builder = globalSVGPathTraversalStateBuilder(traversalState, length);
</del><ins>+    SVGPathTraversalStateBuilder&amp; builder = globalSVGPathTraversalStateBuilder(traversalState, length);
</ins><span class="cx"> 
</span><del>-    auto source = std::make_unique&lt;SVGPathByteStreamSource&gt;(stream);
-    SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
-    bool ok = parser-&gt;parsePathDataFromSource(NormalizedParsing);
-    point = builder-&gt;currentPoint();
-    parser-&gt;cleanup();
</del><ins>+    SVGPathByteStreamSource source(stream);
+    SVGPathParser&amp; parser = globalSVGPathParser(source, builder);
+    bool ok = parser.parsePathDataFromSource(NormalizedParsing);
+    point = builder.currentPoint();
+    parser.cleanup();
</ins><span class="cx">     return ok;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -361,12 +332,12 @@
</span><span class="cx">     // Ideally we would have a SVGPathPlatformPathSource, but it's not possible to manually iterate
</span><span class="cx">     // a path, only apply a function to all path elements at once.
</span><span class="cx"> 
</span><del>-    SVGPathStringBuilder* builder = globalSVGPathStringBuilder();
-    path.apply([builder](const PathElement&amp; pathElement) {
-        pathIteratorForBuildingString(*builder, pathElement);
</del><ins>+    SVGPathStringBuilder&amp; builder = globalSVGPathStringBuilder();
+    path.apply([&amp;builder](const PathElement&amp; pathElement) {
+        pathIteratorForBuildingString(builder, pathElement);
</ins><span class="cx">     });
</span><del>-    string = builder-&gt;result();
-    static_cast&lt;SVGPathConsumer*&gt;(builder)-&gt;cleanup();
</del><ins>+    string = builder.result();
+    static_cast&lt;SVGPathConsumer&amp;&gt;(builder).cleanup(); // Wat?
</ins><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoresvgSVGPathUtilitiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/SVGPathUtilities.h (190843 => 190844)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/SVGPathUtilities.h        2015-10-10 21:14:56 UTC (rev 190843)
+++ trunk/Source/WebCore/svg/SVGPathUtilities.h        2015-10-11 06:16:18 UTC (rev 190844)
</span><span class="lines">@@ -34,26 +34,26 @@
</span><span class="cx"> 
</span><span class="cx"> // String/SVGPathByteStream -&gt; Path
</span><span class="cx"> bool buildPathFromString(const String&amp;, Path&amp;);
</span><del>-bool buildPathFromByteStream(SVGPathByteStream*, Path&amp;);
</del><ins>+bool buildPathFromByteStream(const SVGPathByteStream&amp;, Path&amp;);
</ins><span class="cx"> 
</span><span class="cx"> // SVGPathSegList/String -&gt; SVGPathByteStream
</span><del>-bool buildSVGPathByteStreamFromSVGPathSegList(const SVGPathSegList&amp;, SVGPathByteStream*, PathParsingMode);
-bool appendSVGPathByteStreamFromSVGPathSeg(RefPtr&lt;SVGPathSeg&gt;&amp;&amp;, SVGPathByteStream*, PathParsingMode);
-bool buildSVGPathByteStreamFromString(const String&amp;, SVGPathByteStream*, PathParsingMode);
</del><ins>+bool buildSVGPathByteStreamFromSVGPathSegList(const SVGPathSegList&amp;, SVGPathByteStream&amp; result, PathParsingMode);
+bool appendSVGPathByteStreamFromSVGPathSeg(RefPtr&lt;SVGPathSeg&gt;&amp;&amp;, SVGPathByteStream&amp;, PathParsingMode);
+bool buildSVGPathByteStreamFromString(const String&amp;, SVGPathByteStream&amp;, PathParsingMode);
</ins><span class="cx"> 
</span><span class="cx"> // SVGPathByteStream/SVGPathSegList -&gt; String
</span><del>-bool buildStringFromByteStream(SVGPathByteStream*, String&amp;, PathParsingMode);
</del><ins>+bool buildStringFromByteStream(const SVGPathByteStream&amp;, String&amp;, PathParsingMode);
</ins><span class="cx"> bool buildStringFromSVGPathSegList(const SVGPathSegList&amp;, String&amp;, PathParsingMode);
</span><span class="cx"> 
</span><span class="cx"> // SVGPathByteStream -&gt; SVGPathSegList
</span><del>-bool buildSVGPathSegListFromByteStream(SVGPathByteStream*, SVGPathElement*, SVGPathSegList&amp;, PathParsingMode);
</del><ins>+bool buildSVGPathSegListFromByteStream(const SVGPathByteStream&amp;, SVGPathElement&amp;, SVGPathSegList&amp;, PathParsingMode);
</ins><span class="cx"> 
</span><del>-bool buildAnimatedSVGPathByteStream(SVGPathByteStream*, SVGPathByteStream*, SVGPathByteStream*, float);
-bool addToSVGPathByteStream(SVGPathByteStream*, SVGPathByteStream*, unsigned repeatCount = 1);
</del><ins>+bool buildAnimatedSVGPathByteStream(const SVGPathByteStream&amp; from, const SVGPathByteStream&amp; to, SVGPathByteStream&amp; result, float progress);
+bool addToSVGPathByteStream(SVGPathByteStream&amp; streamToAppendTo, const SVGPathByteStream&amp; from, unsigned repeatCount = 1);
</ins><span class="cx"> 
</span><del>-bool getSVGPathSegAtLengthFromSVGPathByteStream(SVGPathByteStream*, float length, unsigned&amp; pathSeg);
-bool getTotalLengthOfSVGPathByteStream(SVGPathByteStream*, float&amp; totalLength);
-bool getPointAtLengthOfSVGPathByteStream(SVGPathByteStream*, float length, SVGPoint&amp;);
</del><ins>+bool getSVGPathSegAtLengthFromSVGPathByteStream(const SVGPathByteStream&amp;, float length, unsigned&amp; pathSeg);
+bool getTotalLengthOfSVGPathByteStream(const SVGPathByteStream&amp;, float&amp; totalLength);
+bool getPointAtLengthOfSVGPathByteStream(const SVGPathByteStream&amp;, float length, SVGPoint&amp;);
</ins><span class="cx"> 
</span><span class="cx"> // Path -&gt; String
</span><span class="cx"> WEBCORE_EXPORT bool buildStringFromPath(const Path&amp;, String&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoresvgpropertiesSVGAnimatedPathSegListPropertyTearOffh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h (190843 => 190844)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h        2015-10-10 21:14:56 UTC (rev 190843)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPathSegListPropertyTearOff.h        2015-10-11 06:16:18 UTC (rev 190844)
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx">         if (pathElement-&gt;isAnimValObserved()) {
</span><span class="cx">             SVGPathSegList&amp; animatedList = currentAnimatedValue();
</span><span class="cx">             animatedList.clear();
</span><del>-            buildSVGPathSegListFromByteStream(m_animatedPathByteStream, pathElement, animatedList, UnalteredParsing);
</del><ins>+            buildSVGPathSegListFromByteStream(*m_animatedPathByteStream, *pathElement, animatedList, UnalteredParsing);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         SVGAnimatedListPropertyTearOff&lt;SVGPathSegList&gt;::animValDidChange();
</span></span></pre>
</div>
</div>

</body>
</html>