Title: [195243] trunk/Source/WebCore
Revision
195243
Author
[email protected]
Date
2016-01-18 18:56:34 -0800 (Mon, 18 Jan 2016)

Log Message

Reduce PassRefPtr uses in dom - 3
https://bugs.webkit.org/show_bug.cgi?id=153055

Reviewed by Darin Adler.

Third patch to reduce uses of PassRefPtr in WebCore/dom.

* dom/MutationObserverInterestGroup.cpp:
(WebCore::MutationObserverInterestGroup::enqueueMutationRecord):
* dom/MutationRecord.cpp:
(WebCore::MutationRecord::createChildList):
(WebCore::MutationRecord::createAttributes):
(WebCore::MutationRecord::createCharacterData):
(WebCore::MutationRecord::createWithNullOldValue):
* dom/MutationRecord.h:
* dom/NamedFlowCollection.cpp:
(WebCore::NamedFlowCollection::createCSSOMSnapshot):
* dom/NamedFlowCollection.h:
* dom/PendingScript.cpp:
(WebCore::PendingScript::releaseElementAndClear):
* dom/PendingScript.h:
* dom/ScriptRunner.h:
* dom/SecurityContext.h:
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::cloneNode):
* dom/ShadowRoot.h:
* dom/SpaceSplitString.cpp:
(WebCore::SpaceSplitStringData::create):
* dom/SpaceSplitString.h:
* dom/TreeWalker.cpp:
(WebCore::TreeWalker::setCurrent):
(WebCore::TreeWalker::parentNode):
(WebCore::TreeWalker::previousNode):
(WebCore::TreeWalker::nextNode):
* dom/TreeWalker.h:
* dom/default/PlatformMessagePortChannel.cpp:
(WebCore::PlatformMessagePortChannel::entangledChannel):
* dom/default/PlatformMessagePortChannel.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (195242 => 195243)


--- trunk/Source/WebCore/ChangeLog	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/ChangeLog	2016-01-19 02:56:34 UTC (rev 195243)
@@ -1,3 +1,44 @@
+2016-01-18  Gyuyoung Kim  <[email protected]>
+
+        Reduce PassRefPtr uses in dom - 3
+        https://bugs.webkit.org/show_bug.cgi?id=153055
+
+        Reviewed by Darin Adler.
+
+        Third patch to reduce uses of PassRefPtr in WebCore/dom.
+
+        * dom/MutationObserverInterestGroup.cpp:
+        (WebCore::MutationObserverInterestGroup::enqueueMutationRecord):
+        * dom/MutationRecord.cpp:
+        (WebCore::MutationRecord::createChildList):
+        (WebCore::MutationRecord::createAttributes):
+        (WebCore::MutationRecord::createCharacterData):
+        (WebCore::MutationRecord::createWithNullOldValue):
+        * dom/MutationRecord.h:
+        * dom/NamedFlowCollection.cpp:
+        (WebCore::NamedFlowCollection::createCSSOMSnapshot):
+        * dom/NamedFlowCollection.h:
+        * dom/PendingScript.cpp:
+        (WebCore::PendingScript::releaseElementAndClear):
+        * dom/PendingScript.h:
+        * dom/ScriptRunner.h:
+        * dom/SecurityContext.h:
+        * dom/ShadowRoot.cpp:
+        (WebCore::ShadowRoot::cloneNode):
+        * dom/ShadowRoot.h:
+        * dom/SpaceSplitString.cpp:
+        (WebCore::SpaceSplitStringData::create):
+        * dom/SpaceSplitString.h:
+        * dom/TreeWalker.cpp:
+        (WebCore::TreeWalker::setCurrent):
+        (WebCore::TreeWalker::parentNode):
+        (WebCore::TreeWalker::previousNode):
+        (WebCore::TreeWalker::nextNode):
+        * dom/TreeWalker.h:
+        * dom/default/PlatformMessagePortChannel.cpp:
+        (WebCore::PlatformMessagePortChannel::entangledChannel):
+        * dom/default/PlatformMessagePortChannel.h:
+
 2016-01-18  Nan Wang  <[email protected]>
 
         AX: [Mac] Implement next/previous text marker functions using TextIterator

Modified: trunk/Source/WebCore/dom/MutationObserverInterestGroup.cpp (195242 => 195243)


--- trunk/Source/WebCore/dom/MutationObserverInterestGroup.cpp	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/MutationObserverInterestGroup.cpp	2016-01-19 02:56:34 UTC (rev 195243)
@@ -78,7 +78,7 @@
             if (mutation->oldValue().isNull())
                 mutationWithNullOldValue = mutation;
             else
-                mutationWithNullOldValue = MutationRecord::createWithNullOldValue(mutation).get();
+                mutationWithNullOldValue = MutationRecord::createWithNullOldValue(*mutation).ptr();
         }
         observer->enqueueMutationRecord(mutationWithNullOldValue);
     }

Modified: trunk/Source/WebCore/dom/MutationRecord.cpp (195242 => 195243)


--- trunk/Source/WebCore/dom/MutationRecord.cpp	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/MutationRecord.cpp	2016-01-19 02:56:34 UTC (rev 195243)
@@ -124,7 +124,7 @@
 
 class MutationRecordWithNullOldValue : public MutationRecord {
 public:
-    MutationRecordWithNullOldValue(PassRefPtr<MutationRecord> record)
+    MutationRecordWithNullOldValue(MutationRecord& record)
         : m_record(record)
     {
     }
@@ -141,7 +141,7 @@
 
     virtual String oldValue() override { return String(); }
 
-    RefPtr<MutationRecord> m_record;
+    Ref<MutationRecord> m_record;
 };
 
 const AtomicString& ChildListRecord::type()
@@ -164,24 +164,24 @@
 
 } // namespace
 
-PassRefPtr<MutationRecord> MutationRecord::createChildList(ContainerNode& target, PassRefPtr<NodeList> added, PassRefPtr<NodeList> removed, PassRefPtr<Node> previousSibling, PassRefPtr<Node> nextSibling)
+Ref<MutationRecord> MutationRecord::createChildList(ContainerNode& target, PassRefPtr<NodeList> added, PassRefPtr<NodeList> removed, PassRefPtr<Node> previousSibling, PassRefPtr<Node> nextSibling)
 {
-    return adoptRef(static_cast<MutationRecord*>(new ChildListRecord(target, added, removed, previousSibling, nextSibling)));
+    return adoptRef(static_cast<MutationRecord&>(*new ChildListRecord(target, added, removed, previousSibling, nextSibling)));
 }
 
-PassRefPtr<MutationRecord> MutationRecord::createAttributes(Element& target, const QualifiedName& name, const AtomicString& oldValue)
+Ref<MutationRecord> MutationRecord::createAttributes(Element& target, const QualifiedName& name, const AtomicString& oldValue)
 {
-    return adoptRef(static_cast<MutationRecord*>(new AttributesRecord(target, name, oldValue)));
+    return adoptRef(static_cast<MutationRecord&>(*new AttributesRecord(target, name, oldValue)));
 }
 
-PassRefPtr<MutationRecord> MutationRecord::createCharacterData(CharacterData& target, const String& oldValue)
+Ref<MutationRecord> MutationRecord::createCharacterData(CharacterData& target, const String& oldValue)
 {
-    return adoptRef(static_cast<MutationRecord*>(new CharacterDataRecord(target, oldValue)));
+    return adoptRef(static_cast<MutationRecord&>(*new CharacterDataRecord(target, oldValue)));
 }
 
-PassRefPtr<MutationRecord> MutationRecord::createWithNullOldValue(PassRefPtr<MutationRecord> record)
+Ref<MutationRecord> MutationRecord::createWithNullOldValue(MutationRecord& record)
 {
-    return adoptRef(static_cast<MutationRecord*>(new MutationRecordWithNullOldValue(record)));
+    return adoptRef(static_cast<MutationRecord&>(*new MutationRecordWithNullOldValue(record)));
 }
 
 MutationRecord::~MutationRecord()

Modified: trunk/Source/WebCore/dom/MutationRecord.h (195242 => 195243)


--- trunk/Source/WebCore/dom/MutationRecord.h	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/MutationRecord.h	2016-01-19 02:56:34 UTC (rev 195243)
@@ -47,11 +47,11 @@
 
 class MutationRecord : public RefCounted<MutationRecord> {
 public:
-    static PassRefPtr<MutationRecord> createChildList(ContainerNode& target, PassRefPtr<NodeList> added, PassRefPtr<NodeList> removed, PassRefPtr<Node> previousSibling, PassRefPtr<Node> nextSibling);
-    static PassRefPtr<MutationRecord> createAttributes(Element& target, const QualifiedName&, const AtomicString& oldValue);
-    static PassRefPtr<MutationRecord> createCharacterData(CharacterData& target, const String& oldValue);
+    static Ref<MutationRecord> createChildList(ContainerNode& target, PassRefPtr<NodeList> added, PassRefPtr<NodeList> removed, PassRefPtr<Node> previousSibling, PassRefPtr<Node> nextSibling);
+    static Ref<MutationRecord> createAttributes(Element& target, const QualifiedName&, const AtomicString& oldValue);
+    static Ref<MutationRecord> createCharacterData(CharacterData& target, const String& oldValue);
 
-    static PassRefPtr<MutationRecord> createWithNullOldValue(PassRefPtr<MutationRecord>);
+    static Ref<MutationRecord> createWithNullOldValue(MutationRecord&);
 
     virtual ~MutationRecord();
 

Modified: trunk/Source/WebCore/dom/NamedFlowCollection.cpp (195242 => 195243)


--- trunk/Source/WebCore/dom/NamedFlowCollection.cpp	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/NamedFlowCollection.cpp	2016-01-19 02:56:34 UTC (rev 195243)
@@ -104,7 +104,7 @@
     return downcast<Document>(context);
 }
 
-PassRefPtr<DOMNamedFlowCollection> NamedFlowCollection::createCSSOMSnapshot()
+Ref<DOMNamedFlowCollection> NamedFlowCollection::createCSSOMSnapshot()
 {
     Vector<WebKitNamedFlow*> createdFlows;
     for (auto& namedFlow : m_namedFlows) {

Modified: trunk/Source/WebCore/dom/NamedFlowCollection.h (195242 => 195243)


--- trunk/Source/WebCore/dom/NamedFlowCollection.h	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/NamedFlowCollection.h	2016-01-19 02:56:34 UTC (rev 195243)
@@ -34,7 +34,6 @@
 #include "WebKitNamedFlow.h"
 #include <wtf/Forward.h>
 #include <wtf/ListHashSet.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 
@@ -57,7 +56,7 @@
 
     virtual ~NamedFlowCollection() { }
 
-    PassRefPtr<DOMNamedFlowCollection> createCSSOMSnapshot();
+    Ref<DOMNamedFlowCollection> createCSSOMSnapshot();
 
 private:
     struct NamedFlowHashFunctions;

Modified: trunk/Source/WebCore/dom/PendingScript.cpp (195242 => 195243)


--- trunk/Source/WebCore/dom/PendingScript.cpp	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/PendingScript.cpp	2016-01-19 02:56:34 UTC (rev 195243)
@@ -37,12 +37,12 @@
         m_cachedScript->removeClient(this);
 }
 
-PassRefPtr<Element> PendingScript::releaseElementAndClear()
+RefPtr<Element> PendingScript::releaseElementAndClear()
 {
     setCachedScript(nullptr);
     m_watchingForLoad = false;
     m_startingPosition = TextPosition::belowRangePosition();
-    return m_element.release();
+    return WTFMove(m_element);
 }
 
 void PendingScript::setCachedScript(CachedScript* cachedScript)

Modified: trunk/Source/WebCore/dom/PendingScript.h (195242 => 195243)


--- trunk/Source/WebCore/dom/PendingScript.h	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/PendingScript.h	2016-01-19 02:56:34 UTC (rev 195243)
@@ -89,7 +89,7 @@
 
     Element* element() const { return m_element.get(); }
     void setElement(Element* element) { m_element = element; }
-    PassRefPtr<Element> releaseElementAndClear();
+    RefPtr<Element> releaseElementAndClear();
 
     CachedScript* cachedScript() const;
     void setCachedScript(CachedScript*);

Modified: trunk/Source/WebCore/dom/ScriptRunner.h (195242 => 195243)


--- trunk/Source/WebCore/dom/ScriptRunner.h	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/ScriptRunner.h	2016-01-19 02:56:34 UTC (rev 195243)
@@ -30,7 +30,6 @@
 #include "Timer.h"
 #include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {

Modified: trunk/Source/WebCore/dom/SecurityContext.h (195242 => 195243)


--- trunk/Source/WebCore/dom/SecurityContext.h	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/SecurityContext.h	2016-01-19 02:56:34 UTC (rev 195243)
@@ -28,7 +28,6 @@
 #define SecurityContext_h
 
 #include <memory>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/text/WTFString.h>
 

Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (195242 => 195243)


--- trunk/Source/WebCore/dom/ShadowRoot.cpp	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp	2016-01-19 02:56:34 UTC (rev 195243)
@@ -123,12 +123,6 @@
         setNeedsStyleRecalc();
 }
 
-PassRefPtr<Node> ShadowRoot::cloneNode(bool, ExceptionCode& ec)
-{
-    ec = DATA_CLONE_ERR;
-    return 0;
-}
-
 String ShadowRoot::innerHTML() const
 {
     return createMarkup(*this, ChildrenOnly);

Modified: trunk/Source/WebCore/dom/ShadowRoot.h (195242 => 195243)


--- trunk/Source/WebCore/dom/ShadowRoot.h	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/ShadowRoot.h	2016-01-19 02:56:34 UTC (rev 195243)
@@ -81,8 +81,6 @@
 
     Type type() const { return m_type; }
 
-    PassRefPtr<Node> cloneNode(bool, ExceptionCode&);
-
     virtual void removeAllEventListeners() override;
 
 #if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)

Modified: trunk/Source/WebCore/dom/SpaceSplitString.cpp (195242 => 195243)


--- trunk/Source/WebCore/dom/SpaceSplitString.cpp	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/SpaceSplitString.cpp	2016-01-19 02:56:34 UTC (rev 195243)
@@ -173,7 +173,7 @@
     AtomicString* m_memoryBucket;
 };
 
-inline PassRefPtr<SpaceSplitStringData> SpaceSplitStringData::create(const AtomicString& keyString, unsigned tokenCount)
+inline Ref<SpaceSplitStringData> SpaceSplitStringData::create(const AtomicString& keyString, unsigned tokenCount)
 {
     ASSERT(tokenCount);
 
@@ -188,10 +188,10 @@
     ASSERT(static_cast<unsigned>(tokenInitializer.nextMemoryBucket() - tokenArrayStart) == tokenCount);
     ASSERT(reinterpret_cast<const char*>(tokenInitializer.nextMemoryBucket()) == reinterpret_cast<const char*>(spaceSplitStringData) + sizeToAllocate);
 
-    return adoptRef(spaceSplitStringData);
+    return adoptRef(*spaceSplitStringData);
 }
 
-PassRefPtr<SpaceSplitStringData> SpaceSplitStringData::create(const AtomicString& keyString)
+RefPtr<SpaceSplitStringData> SpaceSplitStringData::create(const AtomicString& keyString)
 {
     ASSERT(isMainThread());
     ASSERT(!keyString.isNull());
@@ -211,7 +211,7 @@
 
     RefPtr<SpaceSplitStringData> spaceSplitStringData = create(keyString, tokenCount);
     addResult.iterator->value = spaceSplitStringData.get();
-    return spaceSplitStringData.release();
+    return spaceSplitStringData;
 }
 
 

Modified: trunk/Source/WebCore/dom/SpaceSplitString.h (195242 => 195243)


--- trunk/Source/WebCore/dom/SpaceSplitString.h	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/SpaceSplitString.h	2016-01-19 02:56:34 UTC (rev 195243)
@@ -30,7 +30,7 @@
     WTF_MAKE_NONCOPYABLE(SpaceSplitStringData);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassRefPtr<SpaceSplitStringData> create(const AtomicString&);
+    static RefPtr<SpaceSplitStringData> create(const AtomicString&);
 
     bool contains(const AtomicString& string)
     {
@@ -77,7 +77,7 @@
     static ptrdiff_t tokensMemoryOffset() { return sizeof(SpaceSplitStringData); }
 
 private:
-    static PassRefPtr<SpaceSplitStringData> create(const AtomicString&, unsigned tokenCount);
+    static Ref<SpaceSplitStringData> create(const AtomicString&, unsigned tokenCount);
     SpaceSplitStringData(const AtomicString& string, unsigned size)
         : m_keyString(string)
         , m_refCount(1)

Modified: trunk/Source/WebCore/dom/TreeWalker.cpp (195242 => 195243)


--- trunk/Source/WebCore/dom/TreeWalker.cpp	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/TreeWalker.cpp	2016-01-19 02:56:34 UTC (rev 195243)
@@ -48,7 +48,7 @@
     m_current = node;
 }
 
-inline Node* TreeWalker::setCurrent(PassRefPtr<Node> node)
+inline Node* TreeWalker::setCurrent(RefPtr<Node>&& node)
 {
     m_current = node;
     return m_current.get();
@@ -63,7 +63,7 @@
             return nullptr;
         short acceptNodeResult = acceptNode(node.get());
         if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
-            return setCurrent(node.release());
+            return setCurrent(WTFMove(node));
     }
     return nullptr;
 }
@@ -196,7 +196,7 @@
         node = parent;
         short acceptNodeResult = acceptNode(node.get());
         if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
-            return setCurrent(node.release());
+            return setCurrent(WTFMove(node));
     }
     return nullptr;
 }
@@ -209,7 +209,7 @@
         node = firstChild;
         short acceptNodeResult = acceptNode(node.get());
         if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
-            return setCurrent(node.release());
+            return setCurrent(WTFMove(node));
         if (acceptNodeResult == NodeFilter::FILTER_REJECT)
             break;
     }
@@ -217,7 +217,7 @@
         node = nextSibling;
         short acceptNodeResult = acceptNode(node.get());
         if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
-            return setCurrent(node.release());
+            return setCurrent(WTFMove(node));
         if (acceptNodeResult == NodeFilter::FILTER_SKIP)
             goto Children;
     }

Modified: trunk/Source/WebCore/dom/TreeWalker.h (195242 => 195243)


--- trunk/Source/WebCore/dom/TreeWalker.h	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/TreeWalker.h	2016-01-19 02:56:34 UTC (rev 195243)
@@ -28,7 +28,6 @@
 #include "NodeFilter.h"
 #include "ScriptWrappable.h"
 #include "Traversal.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
@@ -58,7 +57,7 @@
         enum class SiblingTraversalType { Previous, Next };
         template<SiblingTraversalType> Node* traverseSiblings();
         
-        Node* setCurrent(PassRefPtr<Node>);
+        Node* setCurrent(RefPtr<Node>&&);
 
         RefPtr<Node> m_current;
     };

Modified: trunk/Source/WebCore/dom/default/PlatformMessagePortChannel.cpp (195242 => 195243)


--- trunk/Source/WebCore/dom/default/PlatformMessagePortChannel.cpp	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/default/PlatformMessagePortChannel.cpp	2016-01-19 02:56:34 UTC (rev 195243)
@@ -169,7 +169,7 @@
     m_remotePort = port;
 }
 
-PassRefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::entangledChannel()
+RefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::entangledChannel()
 {
     // FIXME: What guarantees that the result remains the same after we release the lock?
     // This lock only guarantees that the returned pointer will not be pointing to released memory,

Modified: trunk/Source/WebCore/dom/default/PlatformMessagePortChannel.h (195242 => 195243)


--- trunk/Source/WebCore/dom/default/PlatformMessagePortChannel.h	2016-01-19 01:23:08 UTC (rev 195242)
+++ trunk/Source/WebCore/dom/default/PlatformMessagePortChannel.h	2016-01-19 02:56:34 UTC (rev 195243)
@@ -90,7 +90,7 @@
         static Ref<PlatformMessagePortChannel> create(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing);
         PlatformMessagePortChannel(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing);
 
-        PassRefPtr<PlatformMessagePortChannel> entangledChannel();
+        RefPtr<PlatformMessagePortChannel> entangledChannel();
 
         void setRemotePort(MessagePort*);
         void closeInternal();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to