<!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>[170816] 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/170816">170816</a></dd>
<dt>Author</dt> <dd>akling@apple.com</dd>
<dt>Date</dt> <dd>2014-07-04 18:29:55 -0700 (Fri, 04 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>QualifiedName should use RefPtr&lt;QualifiedNameImpl&gt; internally.
&lt;https://webkit.org/b/132796&gt;

We were not inlining ~QualifiedName() and it was showing up in some
profiles (over 1% on dom-attr.html.)

This patch modernizes QualifiedName a bit by using RefPtr to store
the QualifiedNameImpl instead of doing manual ref() and deref()
in out-of-line functions.

Reviewed by Darin Adler.

* WebCore.exp.in:
* dom/QualifiedName.cpp:
(WebCore::QNameComponentsTranslator::translate):
(WebCore::QualifiedName::QualifiedName):
(WebCore::QualifiedName::~QualifiedName): Deleted.
(WebCore::QualifiedName::deref): Deleted.
* dom/QualifiedName.h:
(WebCore::QualifiedName::QualifiedNameImpl::create):
(WebCore::QualifiedName::QualifiedName):
(WebCore::QualifiedName::isHashTableDeletedValue):
(WebCore::QualifiedName::~QualifiedName):
(WebCore::QualifiedName::operator=):
(WebCore::QualifiedName::impl):
(WebCore::QualifiedName::ref): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoredomQualifiedNamecpp">trunk/Source/WebCore/dom/QualifiedName.cpp</a></li>
<li><a href="#trunkSourceWebCoredomQualifiedNameh">trunk/Source/WebCore/dom/QualifiedName.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (170815 => 170816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-07-04 23:03:24 UTC (rev 170815)
+++ trunk/Source/WebCore/ChangeLog        2014-07-05 01:29:55 UTC (rev 170816)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2014-05-10  Andreas Kling  &lt;akling@apple.com&gt;
+
+        QualifiedName should use RefPtr&lt;QualifiedNameImpl&gt; internally.
+        &lt;https://webkit.org/b/132796&gt;
+
+        We were not inlining ~QualifiedName() and it was showing up in some
+        profiles (over 1% on dom-attr.html.)
+
+        This patch modernizes QualifiedName a bit by using RefPtr to store
+        the QualifiedNameImpl instead of doing manual ref() and deref()
+        in out-of-line functions.
+
+        Reviewed by Darin Adler.
+
+        * WebCore.exp.in:
+        * dom/QualifiedName.cpp:
+        (WebCore::QNameComponentsTranslator::translate):
+        (WebCore::QualifiedName::QualifiedName):
+        (WebCore::QualifiedName::~QualifiedName): Deleted.
+        (WebCore::QualifiedName::deref): Deleted.
+        * dom/QualifiedName.h:
+        (WebCore::QualifiedName::QualifiedNameImpl::create):
+        (WebCore::QualifiedName::QualifiedName):
+        (WebCore::QualifiedName::isHashTableDeletedValue):
+        (WebCore::QualifiedName::~QualifiedName):
+        (WebCore::QualifiedName::operator=):
+        (WebCore::QualifiedName::impl):
+        (WebCore::QualifiedName::ref): Deleted.
+
</ins><span class="cx"> 2014-07-04  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] [Media] Prevent page zoom if it started in the video element
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (170815 => 170816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-07-04 23:03:24 UTC (rev 170815)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-07-05 01:29:55 UTC (rev 170816)
</span><span class="lines">@@ -310,7 +310,6 @@
</span><span class="cx"> __ZN7WebCore13NodeTraversal19nextAncestorSiblingEPKNS_4NodeE
</span><span class="cx"> __ZN7WebCore13NodeTraversal19nextAncestorSiblingEPKNS_4NodeES3_
</span><span class="cx"> __ZN7WebCore13PageThrottler7startedEv
</span><del>-__ZN7WebCore13QualifiedNameD1Ev
</del><span class="cx"> __ZN7WebCore13ResourceErrorC1EP7NSError
</span><span class="cx"> __ZN7WebCore13ResourceErrorC1EP9__CFError
</span><span class="cx"> __ZN7WebCore13SQLResultDoneE
</span></span></pre></div>
<a id="trunkSourceWebCoredomQualifiedNamecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/QualifiedName.cpp (170815 => 170816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/QualifiedName.cpp        2014-07-04 23:03:24 UTC (rev 170815)
+++ trunk/Source/WebCore/dom/QualifiedName.cpp        2014-07-05 01:29:55 UTC (rev 170816)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx">     }
</span><span class="cx">     static void translate(QualifiedName::QualifiedNameImpl*&amp; location, const QualifiedNameComponents&amp; components, unsigned)
</span><span class="cx">     {
</span><del>-        location = QualifiedName::QualifiedNameImpl::create(components.m_prefix, components.m_localName, components.m_namespace).leakRef();
</del><ins>+        location = &amp;QualifiedName::QualifiedNameImpl::create(components.m_prefix, components.m_localName, components.m_namespace).leakRef();
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -80,28 +80,11 @@
</span><span class="cx"> 
</span><span class="cx"> QualifiedName::QualifiedName(const AtomicString&amp; p, const AtomicString&amp; l, const AtomicString&amp; n)
</span><span class="cx"> {
</span><del>-    QualifiedNameComponents components = { p.impl(), l.impl(), n.isEmpty() ? nullAtom.impl() : n.impl() };
</del><ins>+    QualifiedNameComponents components = { p.impl(), l.impl(), n.isEmpty() ? nullptr : n.impl() };
</ins><span class="cx">     QNameSet::AddResult addResult = qualifiedNameCache().add&lt;QNameComponentsTranslator&gt;(components);
</span><del>-    m_impl = *addResult.iterator;
-    if (!addResult.isNewEntry)
-        m_impl-&gt;ref();
</del><ins>+    m_impl = addResult.isNewEntry ? adoptRef(*addResult.iterator) : *addResult.iterator;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-QualifiedName::~QualifiedName()
-{
-    deref();
-}
-
-void QualifiedName::deref()
-{
-#ifdef QNAME_DEFAULT_CONSTRUCTOR
-    if (!m_impl)
-        return;
-#endif
-    ASSERT(!isHashTableDeletedValue());
-    m_impl-&gt;deref();
-}
-
</del><span class="cx"> QualifiedName::QualifiedNameImpl::~QualifiedNameImpl()
</span><span class="cx"> {
</span><span class="cx">     qualifiedNameCache().remove(this);
</span></span></pre></div>
<a id="trunkSourceWebCoredomQualifiedNameh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/QualifiedName.h (170815 => 170816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/QualifiedName.h        2014-07-04 23:03:24 UTC (rev 170815)
+++ trunk/Source/WebCore/dom/QualifiedName.h        2014-07-05 01:29:55 UTC (rev 170816)
</span><span class="lines">@@ -39,9 +39,9 @@
</span><span class="cx"> public:
</span><span class="cx">     class QualifiedNameImpl : public RefCounted&lt;QualifiedNameImpl&gt; {
</span><span class="cx">     public:
</span><del>-        static PassRefPtr&lt;QualifiedNameImpl&gt; create(const AtomicString&amp; prefix, const AtomicString&amp; localName, const AtomicString&amp; namespaceURI)
</del><ins>+        static PassRef&lt;QualifiedNameImpl&gt; create(const AtomicString&amp; prefix, const AtomicString&amp; localName, const AtomicString&amp; namespaceURI)
</ins><span class="cx">         {
</span><del>-            return adoptRef(new QualifiedNameImpl(prefix, localName, namespaceURI));
</del><ins>+            return adoptRef(*new QualifiedNameImpl(prefix, localName, namespaceURI));
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         ~QualifiedNameImpl();
</span><span class="lines">@@ -71,15 +71,14 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     QualifiedName(const AtomicString&amp; prefix, const AtomicString&amp; localName, const AtomicString&amp; namespaceURI);
</span><del>-    explicit QualifiedName(WTF::HashTableDeletedValueType) : m_impl(hashTableDeletedValue()) { }
-    bool isHashTableDeletedValue() const { return m_impl == hashTableDeletedValue(); }
-    ~QualifiedName();
</del><ins>+    explicit QualifiedName(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue) { }
+    bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue(); }
</ins><span class="cx"> #ifdef QNAME_DEFAULT_CONSTRUCTOR
</span><del>-    QualifiedName() : m_impl(0) { }
</del><ins>+    QualifiedName() { }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    QualifiedName(const QualifiedName&amp; other) : m_impl(other.m_impl) { ref(); }
-    const QualifiedName&amp; operator=(const QualifiedName&amp; other) { other.ref(); deref(); m_impl = other.m_impl; return *this; }
</del><ins>+    QualifiedName(const QualifiedName&amp; other) : m_impl(other.m_impl) { }
+    const QualifiedName&amp; operator=(const QualifiedName&amp; other) { m_impl = other.m_impl; return *this; }
</ins><span class="cx"> 
</span><span class="cx">     bool operator==(const QualifiedName&amp; other) const { return m_impl == other.m_impl; }
</span><span class="cx">     bool operator!=(const QualifiedName&amp; other) const { return !(*this == other); }
</span><span class="lines">@@ -100,7 +99,7 @@
</span><span class="cx"> 
</span><span class="cx">     String toString() const;
</span><span class="cx"> 
</span><del>-    QualifiedNameImpl* impl() const { return m_impl; }
</del><ins>+    QualifiedNameImpl* impl() const { return m_impl.get(); }
</ins><span class="cx"> #if ENABLE(CSS_SELECTOR_JIT)
</span><span class="cx">     static ptrdiff_t implMemoryOffset() { return OBJECT_OFFSETOF(QualifiedName, m_impl); }
</span><span class="cx"> #endif // ENABLE(CSS_SELECTOR_JIT)
</span><span class="lines">@@ -109,12 +108,9 @@
</span><span class="cx">     static void init();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    void ref() const { m_impl-&gt;ref(); }
-    void deref();
-
</del><span class="cx">     static QualifiedNameImpl* hashTableDeletedValue() { return RefPtr&lt;QualifiedNameImpl&gt;::hashTableDeletedValue(); }
</span><span class="cx">     
</span><del>-    QualifiedNameImpl* m_impl;
</del><ins>+    RefPtr&lt;QualifiedNameImpl&gt; m_impl;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> #ifndef WEBCORE_QUALIFIEDNAME_HIDE_GLOBALS
</span></span></pre>
</div>
</div>

</body>
</html>