Changeset 195243 in webkit
- Timestamp:
- Jan 18, 2016 6:56:34 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r195240 r195243 1 2016-01-18 Gyuyoung Kim <gyuyoung.kim@webkit.org> 2 3 Reduce PassRefPtr uses in dom - 3 4 https://bugs.webkit.org/show_bug.cgi?id=153055 5 6 Reviewed by Darin Adler. 7 8 Third patch to reduce uses of PassRefPtr in WebCore/dom. 9 10 * dom/MutationObserverInterestGroup.cpp: 11 (WebCore::MutationObserverInterestGroup::enqueueMutationRecord): 12 * dom/MutationRecord.cpp: 13 (WebCore::MutationRecord::createChildList): 14 (WebCore::MutationRecord::createAttributes): 15 (WebCore::MutationRecord::createCharacterData): 16 (WebCore::MutationRecord::createWithNullOldValue): 17 * dom/MutationRecord.h: 18 * dom/NamedFlowCollection.cpp: 19 (WebCore::NamedFlowCollection::createCSSOMSnapshot): 20 * dom/NamedFlowCollection.h: 21 * dom/PendingScript.cpp: 22 (WebCore::PendingScript::releaseElementAndClear): 23 * dom/PendingScript.h: 24 * dom/ScriptRunner.h: 25 * dom/SecurityContext.h: 26 * dom/ShadowRoot.cpp: 27 (WebCore::ShadowRoot::cloneNode): 28 * dom/ShadowRoot.h: 29 * dom/SpaceSplitString.cpp: 30 (WebCore::SpaceSplitStringData::create): 31 * dom/SpaceSplitString.h: 32 * dom/TreeWalker.cpp: 33 (WebCore::TreeWalker::setCurrent): 34 (WebCore::TreeWalker::parentNode): 35 (WebCore::TreeWalker::previousNode): 36 (WebCore::TreeWalker::nextNode): 37 * dom/TreeWalker.h: 38 * dom/default/PlatformMessagePortChannel.cpp: 39 (WebCore::PlatformMessagePortChannel::entangledChannel): 40 * dom/default/PlatformMessagePortChannel.h: 41 1 42 2016-01-18 Nan Wang <n_wang@apple.com> 2 43 -
trunk/Source/WebCore/dom/MutationObserverInterestGroup.cpp
r185994 r195243 79 79 mutationWithNullOldValue = mutation; 80 80 else 81 mutationWithNullOldValue = MutationRecord::createWithNullOldValue( mutation).get();81 mutationWithNullOldValue = MutationRecord::createWithNullOldValue(*mutation).ptr(); 82 82 } 83 83 observer->enqueueMutationRecord(mutationWithNullOldValue); -
trunk/Source/WebCore/dom/MutationRecord.cpp
r194819 r195243 125 125 class MutationRecordWithNullOldValue : public MutationRecord { 126 126 public: 127 MutationRecordWithNullOldValue( PassRefPtr<MutationRecord>record)127 MutationRecordWithNullOldValue(MutationRecord& record) 128 128 : m_record(record) 129 129 { … … 142 142 virtual String oldValue() override { return String(); } 143 143 144 Ref Ptr<MutationRecord> m_record;144 Ref<MutationRecord> m_record; 145 145 }; 146 146 … … 165 165 } // namespace 166 166 167 PassRefPtr<MutationRecord> MutationRecord::createChildList(ContainerNode& target, PassRefPtr<NodeList> added, PassRefPtr<NodeList> removed, PassRefPtr<Node> previousSibling, PassRefPtr<Node> nextSibling)167 Ref<MutationRecord> MutationRecord::createChildList(ContainerNode& target, PassRefPtr<NodeList> added, PassRefPtr<NodeList> removed, PassRefPtr<Node> previousSibling, PassRefPtr<Node> nextSibling) 168 168 { 169 return adoptRef(static_cast<MutationRecord *>(new ChildListRecord(target, added, removed, previousSibling, nextSibling)));169 return adoptRef(static_cast<MutationRecord&>(*new ChildListRecord(target, added, removed, previousSibling, nextSibling))); 170 170 } 171 171 172 PassRefPtr<MutationRecord> MutationRecord::createAttributes(Element& target, const QualifiedName& name, const AtomicString& oldValue)172 Ref<MutationRecord> MutationRecord::createAttributes(Element& target, const QualifiedName& name, const AtomicString& oldValue) 173 173 { 174 return adoptRef(static_cast<MutationRecord *>(new AttributesRecord(target, name, oldValue)));174 return adoptRef(static_cast<MutationRecord&>(*new AttributesRecord(target, name, oldValue))); 175 175 } 176 176 177 PassRefPtr<MutationRecord> MutationRecord::createCharacterData(CharacterData& target, const String& oldValue)177 Ref<MutationRecord> MutationRecord::createCharacterData(CharacterData& target, const String& oldValue) 178 178 { 179 return adoptRef(static_cast<MutationRecord *>(new CharacterDataRecord(target, oldValue)));179 return adoptRef(static_cast<MutationRecord&>(*new CharacterDataRecord(target, oldValue))); 180 180 } 181 181 182 PassRefPtr<MutationRecord> MutationRecord::createWithNullOldValue(PassRefPtr<MutationRecord>record)182 Ref<MutationRecord> MutationRecord::createWithNullOldValue(MutationRecord& record) 183 183 { 184 return adoptRef(static_cast<MutationRecord *>(new MutationRecordWithNullOldValue(record)));184 return adoptRef(static_cast<MutationRecord&>(*new MutationRecordWithNullOldValue(record))); 185 185 } 186 186 -
trunk/Source/WebCore/dom/MutationRecord.h
r156256 r195243 48 48 class MutationRecord : public RefCounted<MutationRecord> { 49 49 public: 50 static PassRefPtr<MutationRecord> createChildList(ContainerNode& target, PassRefPtr<NodeList> added, PassRefPtr<NodeList> removed, PassRefPtr<Node> previousSibling, PassRefPtr<Node> nextSibling);51 static PassRefPtr<MutationRecord> createAttributes(Element& target, const QualifiedName&, const AtomicString& oldValue);52 static PassRefPtr<MutationRecord> createCharacterData(CharacterData& target, const String& oldValue);50 static Ref<MutationRecord> createChildList(ContainerNode& target, PassRefPtr<NodeList> added, PassRefPtr<NodeList> removed, PassRefPtr<Node> previousSibling, PassRefPtr<Node> nextSibling); 51 static Ref<MutationRecord> createAttributes(Element& target, const QualifiedName&, const AtomicString& oldValue); 52 static Ref<MutationRecord> createCharacterData(CharacterData& target, const String& oldValue); 53 53 54 static PassRefPtr<MutationRecord> createWithNullOldValue(PassRefPtr<MutationRecord>);54 static Ref<MutationRecord> createWithNullOldValue(MutationRecord&); 55 55 56 56 virtual ~MutationRecord(); -
trunk/Source/WebCore/dom/NamedFlowCollection.cpp
r194324 r195243 105 105 } 106 106 107 PassRefPtr<DOMNamedFlowCollection> NamedFlowCollection::createCSSOMSnapshot()107 Ref<DOMNamedFlowCollection> NamedFlowCollection::createCSSOMSnapshot() 108 108 { 109 109 Vector<WebKitNamedFlow*> createdFlows; -
trunk/Source/WebCore/dom/NamedFlowCollection.h
r184225 r195243 35 35 #include <wtf/Forward.h> 36 36 #include <wtf/ListHashSet.h> 37 #include <wtf/PassRefPtr.h>38 37 #include <wtf/RefCounted.h> 39 38 #include <wtf/Vector.h> … … 58 57 virtual ~NamedFlowCollection() { } 59 58 60 PassRefPtr<DOMNamedFlowCollection> createCSSOMSnapshot();59 Ref<DOMNamedFlowCollection> createCSSOMSnapshot(); 61 60 62 61 private: -
trunk/Source/WebCore/dom/PendingScript.cpp
r191955 r195243 38 38 } 39 39 40 PassRefPtr<Element> PendingScript::releaseElementAndClear()40 RefPtr<Element> PendingScript::releaseElementAndClear() 41 41 { 42 42 setCachedScript(nullptr); 43 43 m_watchingForLoad = false; 44 44 m_startingPosition = TextPosition::belowRangePosition(); 45 return m_element.release();45 return WTFMove(m_element); 46 46 } 47 47 -
trunk/Source/WebCore/dom/PendingScript.h
r175148 r195243 90 90 Element* element() const { return m_element.get(); } 91 91 void setElement(Element* element) { m_element = element; } 92 PassRefPtr<Element> releaseElementAndClear();92 RefPtr<Element> releaseElementAndClear(); 93 93 94 94 CachedScript* cachedScript() const; -
trunk/Source/WebCore/dom/ScriptRunner.h
r176459 r195243 31 31 #include <wtf/HashMap.h> 32 32 #include <wtf/Noncopyable.h> 33 #include <wtf/PassRefPtr.h>34 33 #include <wtf/Vector.h> 35 34 -
trunk/Source/WebCore/dom/SecurityContext.h
r177739 r195243 29 29 30 30 #include <memory> 31 #include <wtf/PassRefPtr.h>32 31 #include <wtf/RefPtr.h> 33 32 #include <wtf/text/WTFString.h> -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r194496 r195243 124 124 } 125 125 126 PassRefPtr<Node> ShadowRoot::cloneNode(bool, ExceptionCode& ec)127 {128 ec = DATA_CLONE_ERR;129 return 0;130 }131 132 126 String ShadowRoot::innerHTML() const 133 127 { -
trunk/Source/WebCore/dom/ShadowRoot.h
r194496 r195243 82 82 Type type() const { return m_type; } 83 83 84 PassRefPtr<Node> cloneNode(bool, ExceptionCode&);85 86 84 virtual void removeAllEventListeners() override; 87 85 -
trunk/Source/WebCore/dom/SpaceSplitString.cpp
r175602 r195243 174 174 }; 175 175 176 inline PassRefPtr<SpaceSplitStringData> SpaceSplitStringData::create(const AtomicString& keyString, unsigned tokenCount)176 inline Ref<SpaceSplitStringData> SpaceSplitStringData::create(const AtomicString& keyString, unsigned tokenCount) 177 177 { 178 178 ASSERT(tokenCount); … … 189 189 ASSERT(reinterpret_cast<const char*>(tokenInitializer.nextMemoryBucket()) == reinterpret_cast<const char*>(spaceSplitStringData) + sizeToAllocate); 190 190 191 return adoptRef( spaceSplitStringData);192 } 193 194 PassRefPtr<SpaceSplitStringData> SpaceSplitStringData::create(const AtomicString& keyString)191 return adoptRef(*spaceSplitStringData); 192 } 193 194 RefPtr<SpaceSplitStringData> SpaceSplitStringData::create(const AtomicString& keyString) 195 195 { 196 196 ASSERT(isMainThread()); … … 212 212 RefPtr<SpaceSplitStringData> spaceSplitStringData = create(keyString, tokenCount); 213 213 addResult.iterator->value = spaceSplitStringData.get(); 214 return spaceSplitStringData .release();214 return spaceSplitStringData; 215 215 } 216 216 -
trunk/Source/WebCore/dom/SpaceSplitString.h
r186279 r195243 31 31 WTF_MAKE_FAST_ALLOCATED; 32 32 public: 33 static PassRefPtr<SpaceSplitStringData> create(const AtomicString&);33 static RefPtr<SpaceSplitStringData> create(const AtomicString&); 34 34 35 35 bool contains(const AtomicString& string) … … 78 78 79 79 private: 80 static PassRefPtr<SpaceSplitStringData> create(const AtomicString&, unsigned tokenCount);80 static Ref<SpaceSplitStringData> create(const AtomicString&, unsigned tokenCount); 81 81 SpaceSplitStringData(const AtomicString& string, unsigned size) 82 82 : m_keyString(string) -
trunk/Source/WebCore/dom/TreeWalker.cpp
r194496 r195243 49 49 } 50 50 51 inline Node* TreeWalker::setCurrent( PassRefPtr<Node>node)51 inline Node* TreeWalker::setCurrent(RefPtr<Node>&& node) 52 52 { 53 53 m_current = node; … … 64 64 short acceptNodeResult = acceptNode(node.get()); 65 65 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) 66 return setCurrent( node.release());66 return setCurrent(WTFMove(node)); 67 67 } 68 68 return nullptr; … … 197 197 short acceptNodeResult = acceptNode(node.get()); 198 198 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) 199 return setCurrent( node.release());199 return setCurrent(WTFMove(node)); 200 200 } 201 201 return nullptr; … … 210 210 short acceptNodeResult = acceptNode(node.get()); 211 211 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) 212 return setCurrent( node.release());212 return setCurrent(WTFMove(node)); 213 213 if (acceptNodeResult == NodeFilter::FILTER_REJECT) 214 214 break; … … 218 218 short acceptNodeResult = acceptNode(node.get()); 219 219 if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) 220 return setCurrent( node.release());220 return setCurrent(WTFMove(node)); 221 221 if (acceptNodeResult == NodeFilter::FILTER_SKIP) 222 222 goto Children; -
trunk/Source/WebCore/dom/TreeWalker.h
r194496 r195243 29 29 #include "ScriptWrappable.h" 30 30 #include "Traversal.h" 31 #include <wtf/PassRefPtr.h>32 31 #include <wtf/RefCounted.h> 33 32 … … 59 58 template<SiblingTraversalType> Node* traverseSiblings(); 60 59 61 Node* setCurrent( PassRefPtr<Node>);60 Node* setCurrent(RefPtr<Node>&&); 62 61 63 62 RefPtr<Node> m_current; -
trunk/Source/WebCore/dom/default/PlatformMessagePortChannel.cpp
r194496 r195243 170 170 } 171 171 172 PassRefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::entangledChannel()172 RefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::entangledChannel() 173 173 { 174 174 // FIXME: What guarantees that the result remains the same after we release the lock? -
trunk/Source/WebCore/dom/default/PlatformMessagePortChannel.h
r194496 r195243 91 91 PlatformMessagePortChannel(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing); 92 92 93 PassRefPtr<PlatformMessagePortChannel> entangledChannel();93 RefPtr<PlatformMessagePortChannel> entangledChannel(); 94 94 95 95 void setRemotePort(MessagePort*);
Note: See TracChangeset
for help on using the changeset viewer.