Title: [164662] trunk/Source/WebCore
Revision
164662
Author
[email protected]
Date
2014-02-25 12:42:44 -0800 (Tue, 25 Feb 2014)

Log Message

Unreviewed, rolling out r164638.
http://trac.webkit.org/changeset/164638
https://bugs.webkit.org/show_bug.cgi?id=129321

Broke Windows build. (Requested by bfulgham on #webkit).

* dom/ContainerNode.h:
(WebCore::ChildNodesLazySnapshot::takeSnapshot):
(WebCore::ChildNodesLazySnapshot::hasSnapshot):
* dom/Element.cpp:
(WebCore::ensureAttrNodeListForElement):
(WebCore::Element::attributes):
* dom/ElementIteratorAssertions.h:
(WebCore::ElementIteratorAssertions::ElementIteratorAssertions):
* dom/ElementRareData.h:
(WebCore::ElementRareData::create):
(WebCore::ElementRareData::setAttributeMap):
* dom/MutationObserverRegistration.cpp:
(WebCore::MutationObserverRegistration::create):
(WebCore::MutationObserverRegistration::observedSubtreeNodeWillDetach):
(WebCore::MutationObserverRegistration::clearTransientRegistrations):
(WebCore::MutationObserverRegistration::addRegistrationNodesToSet):
* dom/MutationObserverRegistration.h:
* dom/NamedNodeMap.h:
(WebCore::NamedNodeMap::create):
(WebCore::NamedNodeMap::NamedNodeMap):
* dom/Node.cpp:
(WebCore::Node::ensureRareData):
(WebCore::Node::didMoveToNewDocument):
(WebCore::Node::ensureEventTargetData):
(WebCore::Node::mutationObserverRegistry):
(WebCore::Node::registerMutationObserver):
(WebCore::Node::unregisterMutationObserver):
(WebCore::Node::notifyMutationObserversNodeWillDetach):
* dom/Node.h:
* dom/NodeRareData.h:
(WebCore::NodeListsNodeData::create):
(WebCore::NodeListsNodeData::NodeListsNodeData):
(WebCore::NodeMutationObserverData::create):
(WebCore::NodeMutationObserverData::NodeMutationObserverData):
(WebCore::NodeRareData::create):
(WebCore::NodeRareData::clearNodeLists):
(WebCore::NodeRareData::ensureNodeLists):
(WebCore::NodeRareData::ensureMutationObserverData):
(WebCore::NodeRareData::NodeRareData):
* dom/StyledElement.cpp:
(WebCore::StyledElement::rebuildPresentationAttributeStyle):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (164661 => 164662)


--- trunk/Source/WebCore/ChangeLog	2014-02-25 20:29:58 UTC (rev 164661)
+++ trunk/Source/WebCore/ChangeLog	2014-02-25 20:42:44 UTC (rev 164662)
@@ -1,3 +1,53 @@
+2014-02-25  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r164638.
+        http://trac.webkit.org/changeset/164638
+        https://bugs.webkit.org/show_bug.cgi?id=129321
+
+        Broke Windows build. (Requested by bfulgham on #webkit).
+
+        * dom/ContainerNode.h:
+        (WebCore::ChildNodesLazySnapshot::takeSnapshot):
+        (WebCore::ChildNodesLazySnapshot::hasSnapshot):
+        * dom/Element.cpp:
+        (WebCore::ensureAttrNodeListForElement):
+        (WebCore::Element::attributes):
+        * dom/ElementIteratorAssertions.h:
+        (WebCore::ElementIteratorAssertions::ElementIteratorAssertions):
+        * dom/ElementRareData.h:
+        (WebCore::ElementRareData::create):
+        (WebCore::ElementRareData::setAttributeMap):
+        * dom/MutationObserverRegistration.cpp:
+        (WebCore::MutationObserverRegistration::create):
+        (WebCore::MutationObserverRegistration::observedSubtreeNodeWillDetach):
+        (WebCore::MutationObserverRegistration::clearTransientRegistrations):
+        (WebCore::MutationObserverRegistration::addRegistrationNodesToSet):
+        * dom/MutationObserverRegistration.h:
+        * dom/NamedNodeMap.h:
+        (WebCore::NamedNodeMap::create):
+        (WebCore::NamedNodeMap::NamedNodeMap):
+        * dom/Node.cpp:
+        (WebCore::Node::ensureRareData):
+        (WebCore::Node::didMoveToNewDocument):
+        (WebCore::Node::ensureEventTargetData):
+        (WebCore::Node::mutationObserverRegistry):
+        (WebCore::Node::registerMutationObserver):
+        (WebCore::Node::unregisterMutationObserver):
+        (WebCore::Node::notifyMutationObserversNodeWillDetach):
+        * dom/Node.h:
+        * dom/NodeRareData.h:
+        (WebCore::NodeListsNodeData::create):
+        (WebCore::NodeListsNodeData::NodeListsNodeData):
+        (WebCore::NodeMutationObserverData::create):
+        (WebCore::NodeMutationObserverData::NodeMutationObserverData):
+        (WebCore::NodeRareData::create):
+        (WebCore::NodeRareData::clearNodeLists):
+        (WebCore::NodeRareData::ensureNodeLists):
+        (WebCore::NodeRareData::ensureMutationObserverData):
+        (WebCore::NodeRareData::NodeRareData):
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::rebuildPresentationAttributeStyle):
+
 2014-02-25  Eric Carlson  <[email protected]>
 
         [iOS] Show status image when playing video to external device

Modified: trunk/Source/WebCore/dom/ContainerNode.h (164661 => 164662)


--- trunk/Source/WebCore/dom/ContainerNode.h	2014-02-25 20:29:58 UTC (rev 164661)
+++ trunk/Source/WebCore/dom/ContainerNode.h	2014-02-25 20:42:44 UTC (rev 164662)
@@ -26,7 +26,8 @@
 
 #include "ExceptionCodePlaceholder.h"
 #include "Node.h"
-#include <memory>
+
+#include <wtf/OwnPtr.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
@@ -287,7 +288,7 @@
     {
         if (hasSnapshot())
             return;
-        m_childNodes = std::make_unique<Vector<RefPtr<Node>>>();
+        m_childNodes = adoptPtr(new Vector<RefPtr<Node>>());
         Node* node = m_currentNode.get();
         while (node) {
             m_childNodes->append(node);
@@ -296,7 +297,7 @@
     }
 
     ChildNodesLazySnapshot* nextSnapshot() { return m_nextSnapshot; }
-    bool hasSnapshot() { return !!m_childNodes; }
+    bool hasSnapshot() { return !!m_childNodes.get(); }
 
     static void takeChildNodesLazySnapshot()
     {
@@ -312,7 +313,7 @@
 
     RefPtr<Node> m_currentNode;
     unsigned m_currentIndex;
-    std::unique_ptr<Vector<RefPtr<Node>>> m_childNodes; // Lazily instantiated.
+    OwnPtr<Vector<RefPtr<Node>>> m_childNodes; // Lazily instantiated.
     ChildNodesLazySnapshot* m_nextSnapshot;
 };
 

Modified: trunk/Source/WebCore/dom/Element.cpp (164661 => 164662)


--- trunk/Source/WebCore/dom/Element.cpp	2014-02-25 20:29:58 UTC (rev 164661)
+++ trunk/Source/WebCore/dom/Element.cpp	2014-02-25 20:42:44 UTC (rev 164662)
@@ -78,7 +78,6 @@
 #include "XMLNSNames.h"
 #include "XMLNames.h"
 #include "htmlediting.h"
-#include <memory>
 #include <wtf/BitVector.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/text/CString.h>
@@ -94,7 +93,7 @@
 }
 
 typedef Vector<RefPtr<Attr>> AttrNodeList;
-typedef HashMap<Element*, std::unique_ptr<AttrNodeList>> AttrNodeListMap;
+typedef HashMap<Element*, OwnPtr<AttrNodeList>> AttrNodeListMap;
 
 static AttrNodeListMap& attrNodeListMap()
 {
@@ -118,7 +117,7 @@
     }
     ASSERT(!attrNodeListMap().contains(element));
     element->setHasSyntheticAttrChildNodes(true);
-    AttrNodeListMap::AddResult result = attrNodeListMap().add(element, std::make_unique<AttrNodeList>());
+    AttrNodeListMap::AddResult result = attrNodeListMap().add(element, adoptPtr(new AttrNodeList));
     return *result.iterator->value;
 }
 
@@ -352,7 +351,7 @@
     if (NamedNodeMap* attributeMap = rareData.attributeMap())
         return attributeMap;
 
-    rareData.setAttributeMap(std::make_unique<NamedNodeMap>(const_cast<Element&>(*this)));
+    rareData.setAttributeMap(NamedNodeMap::create(const_cast<Element&>(*this)));
     return rareData.attributeMap();
 }
 

Modified: trunk/Source/WebCore/dom/ElementIteratorAssertions.h (164661 => 164662)


--- trunk/Source/WebCore/dom/ElementIteratorAssertions.h	2014-02-25 20:29:58 UTC (rev 164661)
+++ trunk/Source/WebCore/dom/ElementIteratorAssertions.h	2014-02-25 20:42:44 UTC (rev 164662)
@@ -28,7 +28,6 @@
 
 #include "Document.h"
 #include "Element.h"
-#include <memory>
 
 namespace WebCore {
 
@@ -42,7 +41,7 @@
 private:
     const Document* m_document;
     uint64_t m_initialDOMTreeVersion;
-    std::unique_ptr<NoEventDispatchAssertion> m_noEventDispatchAssertion;
+    OwnPtr<NoEventDispatchAssertion> m_noEventDispatchAssertion;
 };
 
 inline ElementIteratorAssertions::ElementIteratorAssertions()
@@ -54,7 +53,7 @@
 inline ElementIteratorAssertions::ElementIteratorAssertions(const Element* first)
     : m_document(first ? &first->document() : nullptr)
     , m_initialDOMTreeVersion(m_document ? m_document->domTreeVersion() : 0)
-    , m_noEventDispatchAssertion(m_document ? std::make_unique<NoEventDispatchAssertion>() : nullptr)
+    , m_noEventDispatchAssertion(m_document ? adoptPtr(new NoEventDispatchAssertion) : nullptr)
 {
 }
 

Modified: trunk/Source/WebCore/dom/ElementRareData.h (164661 => 164662)


--- trunk/Source/WebCore/dom/ElementRareData.h	2014-02-25 20:29:58 UTC (rev 164661)
+++ trunk/Source/WebCore/dom/ElementRareData.h	2014-02-25 20:42:44 UTC (rev 164662)
@@ -30,13 +30,14 @@
 #include "RenderElement.h"
 #include "ShadowRoot.h"
 #include "StyleInheritedData.h"
-#include <memory>
+#include <wtf/OwnPtr.h>
 
 namespace WebCore {
 
 class ElementRareData : public NodeRareData {
 public:
-    explicit ElementRareData(RenderElement*);
+    static PassOwnPtr<ElementRareData> create(RenderElement* renderer) { return adoptPtr(new ElementRareData(renderer)); }
+
     ~ElementRareData();
 
     void setBeforePseudoElement(PassRefPtr<PseudoElement>);
@@ -92,7 +93,7 @@
     void setShadowRoot(PassRefPtr<ShadowRoot> shadowRoot) { m_shadowRoot = shadowRoot; }
 
     NamedNodeMap* attributeMap() const { return m_attributeMap.get(); }
-    void setAttributeMap(std::unique_ptr<NamedNodeMap> attributeMap) { m_attributeMap = std::move(attributeMap); }
+    void setAttributeMap(PassOwnPtr<NamedNodeMap> attributeMap) { m_attributeMap = attributeMap; }
 
     RenderStyle* computedStyle() const { return m_computedStyle.get(); }
     void setComputedStyle(PassRef<RenderStyle> computedStyle) { m_computedStyle = std::move(computedStyle); }
@@ -149,11 +150,12 @@
     std::unique_ptr<DatasetDOMStringMap> m_dataset;
     std::unique_ptr<ClassList> m_classList;
     RefPtr<ShadowRoot> m_shadowRoot;
-    std::unique_ptr<NamedNodeMap> m_attributeMap;
+    OwnPtr<NamedNodeMap> m_attributeMap;
 
     RefPtr<PseudoElement> m_beforePseudoElement;
     RefPtr<PseudoElement> m_afterPseudoElement;
 
+    explicit ElementRareData(RenderElement*);
     void releasePseudoElement(PseudoElement*);
 };
 

Modified: trunk/Source/WebCore/dom/MutationObserverRegistration.cpp (164661 => 164662)


--- trunk/Source/WebCore/dom/MutationObserverRegistration.cpp	2014-02-25 20:29:58 UTC (rev 164661)
+++ trunk/Source/WebCore/dom/MutationObserverRegistration.cpp	2014-02-25 20:42:44 UTC (rev 164662)
@@ -36,6 +36,11 @@
 
 namespace WebCore {
 
+PassOwnPtr<MutationObserverRegistration> MutationObserverRegistration::create(PassRefPtr<MutationObserver> observer, Node* registrationNode, MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter)
+{
+    return adoptPtr(new MutationObserverRegistration(observer, registrationNode, options, attributeFilter));
+}
+
 MutationObserverRegistration::MutationObserverRegistration(PassRefPtr<MutationObserver> observer, Node* registrationNode, MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter)
     : m_observer(observer)
     , m_registrationNode(registrationNode)
@@ -67,7 +72,7 @@
     m_observer->setHasTransientRegistration();
 
     if (!m_transientRegistrationNodes) {
-        m_transientRegistrationNodes = std::make_unique<NodeHashSet>();
+        m_transientRegistrationNodes = adoptPtr(new NodeHashSet);
 
         ASSERT(!m_registrationNodeKeepAlive);
         m_registrationNodeKeepAlive = m_registrationNode; // Balanced in clearTransientRegistrations.
@@ -82,10 +87,10 @@
         return;
     }
 
-    for (auto& iter : *m_transientRegistrationNodes)
-        iter->unregisterTransientMutationObserver(this);
+    for (NodeHashSet::iterator iter = m_transientRegistrationNodes->begin(); iter != m_transientRegistrationNodes->end(); ++iter)
+        (*iter)->unregisterTransientMutationObserver(this);
 
-    m_transientRegistrationNodes = nullptr;
+    m_transientRegistrationNodes.clear();
 
     ASSERT(m_registrationNodeKeepAlive);
     m_registrationNodeKeepAlive = 0; // Balanced in observeSubtreeNodeWillDetach.
@@ -121,8 +126,8 @@
     nodes.add(m_registrationNode);
     if (!m_transientRegistrationNodes)
         return;
-    for (auto& iter : *m_transientRegistrationNodes)
-        nodes.add(iter.get());
+    for (NodeHashSet::const_iterator iter = m_transientRegistrationNodes->begin(); iter != m_transientRegistrationNodes->end(); ++iter)
+        nodes.add(iter->get());
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/MutationObserverRegistration.h (164661 => 164662)


--- trunk/Source/WebCore/dom/MutationObserverRegistration.h	2014-02-25 20:29:58 UTC (rev 164661)
+++ trunk/Source/WebCore/dom/MutationObserverRegistration.h	2014-02-25 20:42:44 UTC (rev 164662)
@@ -32,7 +32,6 @@
 #define MutationObserverRegistration_h
 
 #include "MutationObserver.h"
-#include <memory>
 #include <wtf/HashSet.h>
 #include <wtf/text/AtomicString.h>
 #include <wtf/text/AtomicStringHash.h>
@@ -43,7 +42,7 @@
 
 class MutationObserverRegistration {
 public:
-    MutationObserverRegistration(PassRefPtr<MutationObserver>, Node*, MutationObserverOptions, const HashSet<AtomicString>& attributeFilter);
+    static PassOwnPtr<MutationObserverRegistration> create(PassRefPtr<MutationObserver>, Node*, MutationObserverOptions, const HashSet<AtomicString>& attributeFilter);
     ~MutationObserverRegistration();
 
     void resetObservation(MutationObserverOptions, const HashSet<AtomicString>& attributeFilter);
@@ -62,11 +61,13 @@
     void addRegistrationNodesToSet(HashSet<Node*>&) const;
 
 private:
+    MutationObserverRegistration(PassRefPtr<MutationObserver>, Node*, MutationObserverOptions, const HashSet<AtomicString>& attributeFilter);
+
     RefPtr<MutationObserver> m_observer;
     Node* m_registrationNode;
     RefPtr<Node> m_registrationNodeKeepAlive;
     typedef HashSet<RefPtr<Node>> NodeHashSet;
-    std::unique_ptr<NodeHashSet> m_transientRegistrationNodes;
+    OwnPtr<NodeHashSet> m_transientRegistrationNodes;
 
     MutationObserverOptions m_options;
     HashSet<AtomicString> m_attributeFilter;

Modified: trunk/Source/WebCore/dom/NamedNodeMap.h (164661 => 164662)


--- trunk/Source/WebCore/dom/NamedNodeMap.h	2014-02-25 20:29:58 UTC (rev 164661)
+++ trunk/Source/WebCore/dom/NamedNodeMap.h	2014-02-25 20:42:44 UTC (rev 164662)
@@ -26,6 +26,7 @@
 #define NamedNodeMap_h
 
 #include "ScriptWrappable.h"
+#include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/text/AtomicString.h>
 
@@ -40,10 +41,9 @@
     WTF_MAKE_FAST_ALLOCATED;
     friend class Element;
 public:
-    explicit NamedNodeMap(Element& element)
-        : m_element(element)
+    static PassOwnPtr<NamedNodeMap> create(Element& element)
     {
-        // Only supports NamedNodeMaps with Element associated, DocumentType.entities and DocumentType.notations are not supported yet.
+        return adoptPtr(new NamedNodeMap(element));
     }
 
     void ref();
@@ -67,6 +67,12 @@
     Element* element() const { return &m_element; }
 
 private:
+    explicit NamedNodeMap(Element& element)
+        : m_element(element)
+    {
+        // Only supports NamedNodeMaps with Element associated, DocumentType.entities and DocumentType.notations are not supported yet.
+    }
+
     Element& m_element;
 };
 

Modified: trunk/Source/WebCore/dom/Node.cpp (164661 => 164662)


--- trunk/Source/WebCore/dom/Node.cpp	2014-02-25 20:29:58 UTC (rev 164661)
+++ trunk/Source/WebCore/dom/Node.cpp	2014-02-25 20:42:44 UTC (rev 164662)
@@ -339,9 +339,9 @@
 
     NodeRareData* data;
     if (isElementNode())
-        data = "" ElementRareData(toRenderElement(m_data.m_renderer));
+        data = ""
     else
-        data = "" NodeRareData(m_data.m_renderer);
+        data = ""
     ASSERT(data);
 
     m_data.m_rareData = data;
@@ -1766,7 +1766,7 @@
         }
     }
 
-    if (Vector<std::unique_ptr<MutationObserverRegistration>>* registry = mutationObserverRegistry()) {
+    if (Vector<OwnPtr<MutationObserverRegistration>>* registry = mutationObserverRegistry()) {
         for (size_t i = 0; i < registry->size(); ++i) {
             document().addMutationObserverTypes(registry->at(i)->mutationTypes());
         }
@@ -1863,7 +1863,7 @@
     return tryRemoveEventListener(this, eventType, listener, useCapture);
 }
 
-typedef HashMap<Node*, std::unique_ptr<EventTargetData>> EventTargetDataMap;
+typedef HashMap<Node*, OwnPtr<EventTargetData>> EventTargetDataMap;
 
 static EventTargetDataMap& eventTargetDataMap()
 {
@@ -1882,7 +1882,7 @@
         return *eventTargetDataMap().get(this);
     setHasEventTargetData(true);
     EventTargetData* data = "" EventTargetData;
-    eventTargetDataMap().set(this, std::unique_ptr<EventTargetData>(data));
+    eventTargetDataMap().set(this, adoptPtr(data));
     return *data;
 }
 
@@ -1891,7 +1891,7 @@
     eventTargetDataMap().remove(this);
 }
 
-Vector<std::unique_ptr<MutationObserverRegistration>>* Node::mutationObserverRegistry()
+Vector<OwnPtr<MutationObserverRegistration>>* Node::mutationObserverRegistry()
 {
     if (!hasRareData())
         return 0;
@@ -1941,7 +1941,7 @@
 void Node::registerMutationObserver(MutationObserver* observer, MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter)
 {
     MutationObserverRegistration* registration = 0;
-    Vector<std::unique_ptr<MutationObserverRegistration>>& registry = ensureRareData().ensureMutationObserverData().registry;
+    Vector<OwnPtr<MutationObserverRegistration>>& registry = ensureRareData().ensureMutationObserverData().registry;
     for (size_t i = 0; i < registry.size(); ++i) {
         if (registry[i]->observer() == observer) {
             registration = registry[i].get();
@@ -1950,7 +1950,7 @@
     }
 
     if (!registration) {
-        registry.append(std::make_unique<MutationObserverRegistration>(observer, this, options, attributeFilter));
+        registry.append(MutationObserverRegistration::create(observer, this, options, attributeFilter));
         registration = registry.last().get();
     }
 
@@ -1959,22 +1959,17 @@
 
 void Node::unregisterMutationObserver(MutationObserverRegistration* registration)
 {
-    Vector<std::unique_ptr<MutationObserverRegistration>>* registry = mutationObserverRegistry();
+    Vector<OwnPtr<MutationObserverRegistration>>* registry = mutationObserverRegistry();
     ASSERT(registry);
     if (!registry)
         return;
 
-    size_t index = 0;
-    for (const auto& storedRegistration : *registry) {
-        if (storedRegistration.get() == registration) {
-            registry->remove(index);
-            return;
-        }
+    size_t index = registry->find(registration);
+    ASSERT(index != notFound);
+    if (index == notFound)
+        return;
 
-        index++;
-    }
-
-    ASSERT_NOT_REACHED();
+    registry->remove(index);
 }
 
 void Node::registerTransientMutationObserver(MutationObserverRegistration* registration)
@@ -1999,7 +1994,7 @@
         return;
 
     for (Node* node = parentNode(); node; node = node->parentNode()) {
-        if (Vector<std::unique_ptr<MutationObserverRegistration>>* registry = node->mutationObserverRegistry()) {
+        if (Vector<OwnPtr<MutationObserverRegistration>>* registry = node->mutationObserverRegistry()) {
             const size_t size = registry->size();
             for (size_t i = 0; i < size; ++i)
                 registry->at(i)->observedSubtreeNodeWillDetach(this);

Modified: trunk/Source/WebCore/dom/Node.h (164661 => 164662)


--- trunk/Source/WebCore/dom/Node.h	2014-02-25 20:29:58 UTC (rev 164661)
+++ trunk/Source/WebCore/dom/Node.h	2014-02-25 20:42:44 UTC (rev 164662)
@@ -35,7 +35,6 @@
 #include "SimulatedClickOptions.h"
 #include "TreeScope.h"
 #include "TreeShared.h"
-#include <memory>
 #include <wtf/Forward.h>
 #include <wtf/ListHashSet.h>
 #include <wtf/text/AtomicString.h>
@@ -675,7 +674,7 @@
 
     void trackForDebugging();
 
-    Vector<std::unique_ptr<MutationObserverRegistration>>* mutationObserverRegistry();
+    Vector<OwnPtr<MutationObserverRegistration>>* mutationObserverRegistry();
     HashSet<MutationObserverRegistration*>* transientMutationObserverRegistry();
 
     mutable uint32_t m_nodeFlags;

Modified: trunk/Source/WebCore/dom/NodeRareData.h (164661 => 164662)


--- trunk/Source/WebCore/dom/NodeRareData.h	2014-02-25 20:29:58 UTC (rev 164661)
+++ trunk/Source/WebCore/dom/NodeRareData.h	2014-02-25 20:42:44 UTC (rev 164662)
@@ -36,8 +36,9 @@
 #if ENABLE(VIDEO_TRACK)
 #include "TextTrack.h"
 #endif
-#include <memory>
 #include <wtf/HashSet.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
 #include <wtf/text/AtomicString.h>
 #include <wtf/text/StringHash.h>
 
@@ -50,11 +51,6 @@
 class NodeListsNodeData {
     WTF_MAKE_NONCOPYABLE(NodeListsNodeData); WTF_MAKE_FAST_ALLOCATED;
 public:
-    NodeListsNodeData()
-        : m_childNodeList(nullptr)
-        , m_emptyChildNodeList(nullptr)
-    { }
-
     void clearChildNodeListCache()
     {
         if (m_childNodeList)
@@ -211,6 +207,11 @@
         m_cachedCollections.remove(namedCollectionKey(collection->type(), name));
     }
 
+    static PassOwnPtr<NodeListsNodeData> create()
+    {
+        return adoptPtr(new NodeListsNodeData);
+    }
+
     void invalidateCaches(const QualifiedName* attrName = 0);
     bool isEmpty() const
     {
@@ -255,6 +256,11 @@
     }
 
 private:
+    NodeListsNodeData()
+        : m_childNodeList(nullptr)
+        , m_emptyChildNodeList(nullptr)
+    { }
+
     std::pair<unsigned char, AtomicString> namedCollectionKey(CollectionType type, const AtomicString& name)
     {
         return std::pair<unsigned char, AtomicString>(type, name);
@@ -280,26 +286,26 @@
 class NodeMutationObserverData {
     WTF_MAKE_NONCOPYABLE(NodeMutationObserverData); WTF_MAKE_FAST_ALLOCATED;
 public:
-    NodeMutationObserverData() = default;
-    Vector<std::unique_ptr<MutationObserverRegistration>> registry;
+    Vector<OwnPtr<MutationObserverRegistration>> registry;
     HashSet<MutationObserverRegistration*> transientRegistry;
+
+    static PassOwnPtr<NodeMutationObserverData> create() { return adoptPtr(new NodeMutationObserverData); }
+
+private:
+    NodeMutationObserverData() { }
 };
 
 class NodeRareData : public NodeRareDataBase {
     WTF_MAKE_NONCOPYABLE(NodeRareData); WTF_MAKE_FAST_ALLOCATED;
 public:
-    NodeRareData(RenderObject* renderer)
-        : NodeRareDataBase(renderer)
-        , m_connectedFrameCount(0)
-    { }
+    static PassOwnPtr<NodeRareData> create(RenderObject* renderer) { return adoptPtr(new NodeRareData(renderer)); }
 
-
-    void clearNodeLists() { m_nodeLists = nullptr; }
+    void clearNodeLists() { m_nodeLists.clear(); }
     NodeListsNodeData* nodeLists() const { return m_nodeLists.get(); }
     NodeListsNodeData& ensureNodeLists()
     {
         if (!m_nodeLists)
-            m_nodeLists = std::make_unique<NodeListsNodeData>();
+            m_nodeLists = NodeListsNodeData::create();
         return *m_nodeLists;
     }
 
@@ -307,7 +313,7 @@
     NodeMutationObserverData& ensureMutationObserverData()
     {
         if (!m_mutationObserverData)
-            m_mutationObserverData = std::make_unique<NodeMutationObserverData>();
+            m_mutationObserverData = NodeMutationObserverData::create();
         return *m_mutationObserverData;
     }
 
@@ -323,11 +329,17 @@
         m_connectedFrameCount -= amount;
     }
 
+protected:
+    NodeRareData(RenderObject* renderer)
+        : NodeRareDataBase(renderer)
+        , m_connectedFrameCount(0)
+    { }
+
 private:
     unsigned m_connectedFrameCount : 10; // Must fit Page::maxNumberOfFrames.
 
-    std::unique_ptr<NodeListsNodeData> m_nodeLists;
-    std::unique_ptr<NodeMutationObserverData> m_mutationObserverData;
+    OwnPtr<NodeListsNodeData> m_nodeLists;
+    OwnPtr<NodeMutationObserverData> m_mutationObserverData;
 };
 
 inline bool NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLastList(Node& ownerNode)

Modified: trunk/Source/WebCore/dom/StyledElement.cpp (164661 => 164662)


--- trunk/Source/WebCore/dom/StyledElement.cpp	2014-02-25 20:29:58 UTC (rev 164661)
+++ trunk/Source/WebCore/dom/StyledElement.cpp	2014-02-25 20:42:44 UTC (rev 164662)
@@ -58,7 +58,7 @@
     RefPtr<StyleProperties> value;
 };
 
-typedef HashMap<unsigned, std::unique_ptr<PresentationAttributeCacheEntry>, AlreadyHashed> PresentationAttributeCache;
+typedef HashMap<unsigned, OwnPtr<PresentationAttributeCacheEntry>, AlreadyHashed> PresentationAttributeCache;
     
 static bool operator!=(const PresentationAttributeCacheKey& a, const PresentationAttributeCacheKey& b)
 {
@@ -346,7 +346,7 @@
     if (!cacheHash || cacheIterator->value)
         return;
 
-    auto newEntry = std::make_unique<PresentationAttributeCacheEntry>();
+    OwnPtr<PresentationAttributeCacheEntry> newEntry = adoptPtr(new PresentationAttributeCacheEntry);
     newEntry->key = cacheKey;
     newEntry->value = style.release();
 
@@ -354,9 +354,9 @@
     if (presentationAttributeCache().size() > presentationAttributeCacheMaximumSize) {
         // Start building from scratch if the cache ever gets big.
         presentationAttributeCache().clear();
-        presentationAttributeCache().set(cacheHash, std::move(newEntry));
+        presentationAttributeCache().set(cacheHash, newEntry.release());
     } else
-        cacheIterator->value = std::move(newEntry);
+        cacheIterator->value = newEntry.release();
 }
 
 void StyledElement::addPropertyToPresentationAttributeStyle(MutableStyleProperties& style, CSSPropertyID propertyID, CSSValueID identifier)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to