<!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>[163719] 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/163719">163719</a></dd>
<dt>Author</dt> <dd>zandobersek@gmail.com</dd>
<dt>Date</dt> <dd>2014-02-08 12:10:00 -0800 (Sat, 08 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move TreeScope, IdTargetObserverRegistry to std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=127276
Reviewed by Andreas Kling.
Replace uses of OwnPtr in the TreeScope and IdTargetObserverRegistry classes with std::unique_ptr.
* dom/IdTargetObserverRegistry.cpp:
(WebCore::IdTargetObserverRegistry::addObserver):
* dom/IdTargetObserverRegistry.h:
(WebCore::IdTargetObserverRegistry::IdTargetObserverRegistry):
* dom/TreeScope.cpp:
(WebCore::TreeScope::TreeScope):
(WebCore::TreeScope::destroyTreeScopeData):
(WebCore::TreeScope::addElementById):
(WebCore::TreeScope::addElementByName):
(WebCore::TreeScope::addImageMap):
(WebCore::TreeScope::labelElementForId):
* dom/TreeScope.h:
(WebCore::TreeScope::shouldCacheLabelsByForAttribute):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomIdTargetObserverRegistrycpp">trunk/Source/WebCore/dom/IdTargetObserverRegistry.cpp</a></li>
<li><a href="#trunkSourceWebCoredomIdTargetObserverRegistryh">trunk/Source/WebCore/dom/IdTargetObserverRegistry.h</a></li>
<li><a href="#trunkSourceWebCoredomTreeScopecpp">trunk/Source/WebCore/dom/TreeScope.cpp</a></li>
<li><a href="#trunkSourceWebCoredomTreeScopeh">trunk/Source/WebCore/dom/TreeScope.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163718 => 163719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-08 20:02:40 UTC (rev 163718)
+++ trunk/Source/WebCore/ChangeLog        2014-02-08 20:10:00 UTC (rev 163719)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-02-08 Zan Dobersek <zdobersek@igalia.com>
+
+ Move TreeScope, IdTargetObserverRegistry to std::unique_ptr
+ https://bugs.webkit.org/show_bug.cgi?id=127276
+
+ Reviewed by Andreas Kling.
+
+ Replace uses of OwnPtr in the TreeScope and IdTargetObserverRegistry classes with std::unique_ptr.
+
+ * dom/IdTargetObserverRegistry.cpp:
+ (WebCore::IdTargetObserverRegistry::addObserver):
+ * dom/IdTargetObserverRegistry.h:
+ (WebCore::IdTargetObserverRegistry::IdTargetObserverRegistry):
+ * dom/TreeScope.cpp:
+ (WebCore::TreeScope::TreeScope):
+ (WebCore::TreeScope::destroyTreeScopeData):
+ (WebCore::TreeScope::addElementById):
+ (WebCore::TreeScope::addElementByName):
+ (WebCore::TreeScope::addImageMap):
+ (WebCore::TreeScope::labelElementForId):
+ * dom/TreeScope.h:
+ (WebCore::TreeScope::shouldCacheLabelsByForAttribute):
+
</ins><span class="cx"> 2014-02-08 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> Slight CTTE in PingLoader
</span></span></pre></div>
<a id="trunkSourceWebCoredomIdTargetObserverRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/IdTargetObserverRegistry.cpp (163718 => 163719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/IdTargetObserverRegistry.cpp        2014-02-08 20:02:40 UTC (rev 163718)
+++ trunk/Source/WebCore/dom/IdTargetObserverRegistry.cpp        2014-02-08 20:10:00 UTC (rev 163719)
</span><span class="lines">@@ -30,11 +30,6 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-PassOwnPtr<IdTargetObserverRegistry> IdTargetObserverRegistry::create()
-{
- return adoptPtr(new IdTargetObserverRegistry());
-}
-
</del><span class="cx"> void IdTargetObserverRegistry::addObserver(const AtomicString& id, IdTargetObserver* observer)
</span><span class="cx"> {
</span><span class="cx"> if (id.isEmpty())
</span><span class="lines">@@ -42,7 +37,7 @@
</span><span class="cx">
</span><span class="cx"> IdToObserverSetMap::AddResult result = m_registry.add(id.impl(), nullptr);
</span><span class="cx"> if (result.isNewEntry)
</span><del>- result.iterator->value = adoptPtr(new ObserverSet());
</del><ins>+ result.iterator->value = std::make_unique<ObserverSet>();
</ins><span class="cx">
</span><span class="cx"> result.iterator->value->add(observer);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomIdTargetObserverRegistryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/IdTargetObserverRegistry.h (163718 => 163719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/IdTargetObserverRegistry.h        2014-02-08 20:02:40 UTC (rev 163718)
+++ trunk/Source/WebCore/dom/IdTargetObserverRegistry.h        2014-02-08 20:10:00 UTC (rev 163719)
</span><span class="lines">@@ -26,10 +26,10 @@
</span><span class="cx"> #ifndef IdTargetObserverRegistry_h
</span><span class="cx"> #define IdTargetObserverRegistry_h
</span><span class="cx">
</span><ins>+#include <memory>
</ins><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/HashSet.h>
</span><del>-#include <wtf/PassOwnPtr.h>
</del><span class="cx"> #include <wtf/text/AtomicString.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -40,18 +40,20 @@
</span><span class="cx"> WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> friend class IdTargetObserver;
</span><span class="cx"> public:
</span><del>- static PassOwnPtr<IdTargetObserverRegistry> create();
</del><ins>+ IdTargetObserverRegistry()
+ : m_notifyingObserversInSet(0)
+ { }
+
</ins><span class="cx"> void notifyObservers(const AtomicString& id);
</span><span class="cx"> void notifyObservers(const AtomicStringImpl& id);
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- IdTargetObserverRegistry() : m_notifyingObserversInSet(0) { }
</del><span class="cx"> void addObserver(const AtomicString& id, IdTargetObserver*);
</span><span class="cx"> void removeObserver(const AtomicString& id, IdTargetObserver*);
</span><span class="cx"> void notifyObserversInternal(const AtomicStringImpl& id);
</span><span class="cx">
</span><span class="cx"> typedef HashSet<IdTargetObserver*> ObserverSet;
</span><del>- typedef HashMap<const AtomicStringImpl*, OwnPtr<ObserverSet>> IdToObserverSetMap;
</del><ins>+ typedef HashMap<const AtomicStringImpl*, std::unique_ptr<ObserverSet>> IdToObserverSetMap;
</ins><span class="cx"> IdToObserverSetMap m_registry;
</span><span class="cx"> ObserverSet* m_notifyingObserversInSet;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoredomTreeScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/TreeScope.cpp (163718 => 163719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/TreeScope.cpp        2014-02-08 20:02:40 UTC (rev 163718)
+++ trunk/Source/WebCore/dom/TreeScope.cpp        2014-02-08 20:10:00 UTC (rev 163719)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx"> , m_documentScope(document)
</span><span class="cx"> , m_parentTreeScope(document)
</span><span class="cx"> , m_selfOnlyRefCount(0)
</span><del>- , m_idTargetObserverRegistry(IdTargetObserverRegistry::create())
</del><ins>+ , m_idTargetObserverRegistry(std::make_unique<IdTargetObserverRegistry>())
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(rootNode);
</span><span class="cx"> ASSERT(document);
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx"> , m_documentScope(document)
</span><span class="cx"> , m_parentTreeScope(nullptr)
</span><span class="cx"> , m_selfOnlyRefCount(0)
</span><del>- , m_idTargetObserverRegistry(IdTargetObserverRegistry::create())
</del><ins>+ , m_idTargetObserverRegistry(std::make_unique<IdTargetObserverRegistry>())
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(document);
</span><span class="cx"> m_rootNode->setTreeScope(*this);
</span><span class="lines">@@ -107,9 +107,9 @@
</span><span class="cx">
</span><span class="cx"> void TreeScope::destroyTreeScopeData()
</span><span class="cx"> {
</span><del>- m_elementsById.clear();
- m_imageMapsByName.clear();
- m_labelsByForAttribute.clear();
</del><ins>+ m_elementsById = nullptr;
+ m_imageMapsByName = nullptr;
+ m_labelsByForAttribute = nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void TreeScope::clearDocumentScope()
</span><span class="lines">@@ -153,7 +153,7 @@
</span><span class="cx"> void TreeScope::addElementById(const AtomicStringImpl& elementId, Element& element)
</span><span class="cx"> {
</span><span class="cx"> if (!m_elementsById)
</span><del>- m_elementsById = adoptPtr(new DocumentOrderedMap);
</del><ins>+ m_elementsById = std::make_unique<DocumentOrderedMap>();
</ins><span class="cx"> m_elementsById->add(elementId, element, *this);
</span><span class="cx"> m_idTargetObserverRegistry->notifyObservers(elementId);
</span><span class="cx"> }
</span><span class="lines">@@ -178,7 +178,7 @@
</span><span class="cx"> void TreeScope::addElementByName(const AtomicStringImpl& name, Element& element)
</span><span class="cx"> {
</span><span class="cx"> if (!m_elementsByName)
</span><del>- m_elementsByName = adoptPtr(new DocumentOrderedMap);
</del><ins>+ m_elementsByName = std::make_unique<DocumentOrderedMap>();
</ins><span class="cx"> m_elementsByName->add(name, element, *this);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -206,7 +206,7 @@
</span><span class="cx"> if (!name)
</span><span class="cx"> return;
</span><span class="cx"> if (!m_imageMapsByName)
</span><del>- m_imageMapsByName = adoptPtr(new DocumentOrderedMap);
</del><ins>+ m_imageMapsByName = std::make_unique<DocumentOrderedMap>();
</ins><span class="cx"> m_imageMapsByName->add(*name, imageMap, *this);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -298,7 +298,7 @@
</span><span class="cx">
</span><span class="cx"> if (!m_labelsByForAttribute) {
</span><span class="cx"> // Populate the map on first access.
</span><del>- m_labelsByForAttribute = adoptPtr(new DocumentOrderedMap);
</del><ins>+ m_labelsByForAttribute = std::make_unique<DocumentOrderedMap>();
</ins><span class="cx">
</span><span class="cx"> for (auto& label : descendantsOfType<HTMLLabelElement>(*rootNode())) {
</span><span class="cx"> const AtomicString& forValue = label.fastGetAttribute(forAttr);
</span></span></pre></div>
<a id="trunkSourceWebCoredomTreeScopeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/TreeScope.h (163718 => 163719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/TreeScope.h        2014-02-08 20:02:40 UTC (rev 163718)
+++ trunk/Source/WebCore/dom/TreeScope.h        2014-02-08 20:10:00 UTC (rev 163719)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #define TreeScope_h
</span><span class="cx">
</span><span class="cx"> #include "DocumentOrderedMap.h"
</span><ins>+#include <memory>
</ins><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/text/AtomicString.h>
</span><span class="cx">
</span><span class="lines">@@ -79,7 +80,7 @@
</span><span class="cx"> Element* elementFromPoint(int x, int y) const;
</span><span class="cx">
</span><span class="cx"> // For accessibility.
</span><del>- bool shouldCacheLabelsByForAttribute() const { return m_labelsByForAttribute; }
</del><ins>+ bool shouldCacheLabelsByForAttribute() const { return !!m_labelsByForAttribute; }
</ins><span class="cx"> void addLabel(const AtomicStringImpl& forAttributeValue, HTMLLabelElement&);
</span><span class="cx"> void removeLabel(const AtomicStringImpl& forAttributeValue, HTMLLabelElement&);
</span><span class="cx"> HTMLLabelElement* labelElementForId(const AtomicString& forAttributeValue);
</span><span class="lines">@@ -164,12 +165,12 @@
</span><span class="cx"> TreeScope* m_parentTreeScope;
</span><span class="cx"> unsigned m_selfOnlyRefCount;
</span><span class="cx">
</span><del>- OwnPtr<DocumentOrderedMap> m_elementsById;
- OwnPtr<DocumentOrderedMap> m_elementsByName;
- OwnPtr<DocumentOrderedMap> m_imageMapsByName;
- OwnPtr<DocumentOrderedMap> m_labelsByForAttribute;
</del><ins>+ std::unique_ptr<DocumentOrderedMap> m_elementsById;
+ std::unique_ptr<DocumentOrderedMap> m_elementsByName;
+ std::unique_ptr<DocumentOrderedMap> m_imageMapsByName;
+ std::unique_ptr<DocumentOrderedMap> m_labelsByForAttribute;
</ins><span class="cx">
</span><del>- OwnPtr<IdTargetObserverRegistry> m_idTargetObserverRegistry;
</del><ins>+ std::unique_ptr<IdTargetObserverRegistry> m_idTargetObserverRegistry;
</ins><span class="cx">
</span><span class="cx"> mutable RefPtr<DOMSelection> m_selection;
</span><span class="cx"> };
</span></span></pre>
</div>
</div>
</body>
</html>