Changeset 189776 in webkit
- Timestamp:
- Sep 14, 2015, 11:00:54 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r189771 r189776 1 2015-09-14 Gyuyoung Kim <gyuyoung.kim@webkit.org> 2 3 Remove all uses of PassRefPtr in WebCore/xml 4 https://bugs.webkit.org/show_bug.cgi?id=149114 5 6 Reviewed by Darin Adler. 7 8 * dom/DecodedDataDocumentParser.h: 9 * dom/DocumentParser.h: 10 * dom/RawDataDocumentParser.h: 11 * html/FTPDirectoryDocument.cpp: 12 (WebCore::FTPDirectoryDocumentParser::append): 13 * html/parser/HTMLDocumentParser.cpp: 14 (WebCore::HTMLDocumentParser::append): 15 * html/parser/HTMLDocumentParser.h: 16 * html/parser/TextDocumentParser.cpp: 17 (WebCore::TextDocumentParser::append): 18 * html/parser/TextDocumentParser.h: 19 * xml/NativeXPathNSResolver.cpp: 20 (WebCore::NativeXPathNSResolver::NativeXPathNSResolver): 21 * xml/NativeXPathNSResolver.h: 22 (WebCore::NativeXPathNSResolver::create): 23 * xml/XMLErrors.cpp: 24 (WebCore::createXHTMLParserErrorHeader): 25 * xml/XMLHttpRequestProgressEventThrottle.cpp: 26 (WebCore::XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent): 27 (WebCore::XMLHttpRequestProgressEventThrottle::dispatchEvent): 28 (WebCore::XMLHttpRequestProgressEventThrottle::dispatchDeferredEvents): 29 * xml/XMLHttpRequestProgressEventThrottle.h: 30 * xml/XMLSerializer.h: 31 * xml/XPathEvaluator.cpp: 32 (WebCore::XPathEvaluator::createExpression): 33 (WebCore::XPathEvaluator::createNSResolver): 34 (WebCore::XPathEvaluator::evaluate): 35 * xml/XPathEvaluator.h: 36 * xml/XPathNodeSet.h: Fix style errors. 37 (WebCore::XPath::NodeSet::NodeSet): 38 (WebCore::XPath::NodeSet::append): 39 * xml/XPathPath.cpp: 40 (WebCore::XPath::Filter::evaluate): 41 (WebCore::XPath::LocationPath::evaluate): 42 * xml/XPathValue.h: ditto. 43 (WebCore::XPath::Value::Value): 44 (WebCore::XPath::Value::Data::create): 45 (WebCore::XPath::Value::Data::Data): 46 * xml/XSLTProcessor.cpp: 47 (WebCore::XSLTProcessor::transformToDocument): 48 (WebCore::XSLTProcessor::transformToFragment): 49 * xml/XSLTProcessor.h: 50 (WebCore::XSLTProcessor::setXSLStyleSheet): 51 (WebCore::XSLTProcessor::importStylesheet): 52 * xml/parser/XMLDocumentParser.cpp: 53 (WebCore::XMLDocumentParser::append): 54 * xml/parser/XMLDocumentParser.h: 55 1 56 2015-09-14 Dewei Zhu <dewei_zhu@apple.com> 2 57 -
trunk/Source/WebCore/dom/DecodedDataDocumentParser.h
r184068 r189776 42 42 private: 43 43 // append is used by DocumentWriter::replaceDocument. 44 virtual void append( PassRefPtr<StringImpl>) override = 0;44 virtual void append(RefPtr<StringImpl>&&) override = 0; 45 45 46 46 // appendBytes and flush are used by DocumentWriter (the loader). -
trunk/Source/WebCore/dom/DocumentParser.h
r183169 r189776 54 54 // FIXME: This really should take a std::unique_ptr to signify that it expects to take 55 55 // ownership of the buffer. The parser expects the PassRefPtr to hold the only ref of the StringImpl. 56 virtual void append( PassRefPtr<StringImpl>) = 0;56 virtual void append(RefPtr<StringImpl>&&) = 0; 57 57 58 58 virtual void finish() = 0; -
trunk/Source/WebCore/dom/RawDataDocumentParser.h
r175148 r189776 57 57 } 58 58 59 virtual void append( PassRefPtr<StringImpl>) override59 virtual void append(RefPtr<StringImpl>&&) override 60 60 { 61 61 ASSERT_NOT_REACHED(); -
trunk/Source/WebCore/html/FTPDirectoryDocument.cpp
r189576 r189776 51 51 52 52 private: 53 virtual void append( PassRefPtr<StringImpl>) override;53 virtual void append(RefPtr<StringImpl>&&) override; 54 54 virtual void finish() override; 55 55 … … 340 340 } 341 341 342 void FTPDirectoryDocumentParser::append( PassRefPtr<StringImpl>inputSource)343 { 344 String source( inputSource);342 void FTPDirectoryDocumentParser::append(RefPtr<StringImpl>&& inputSource) 343 { 344 String source(WTF::move(inputSource)); 345 345 346 346 // Make sure we have the table element to append to by loading the template set in the pref, or -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp
r182266 r189776 357 357 } 358 358 359 void HTMLDocumentParser::append( PassRefPtr<StringImpl>inputSource)359 void HTMLDocumentParser::append(RefPtr<StringImpl>&& inputSource) 360 360 { 361 361 if (isStopped()) … … 366 366 Ref<HTMLDocumentParser> protect(*this); 367 367 368 String source( inputSource);368 String source(WTF::move(inputSource)); 369 369 370 370 if (m_preloadScanner) { -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.h
r178648 r189776 67 67 68 68 virtual void insert(const SegmentedString&) override final; 69 virtual void append( PassRefPtr<StringImpl>) override;69 virtual void append(RefPtr<StringImpl>&&) override; 70 70 virtual void finish() override; 71 71 -
trunk/Source/WebCore/html/parser/TextDocumentParser.cpp
r178265 r189776 37 37 } 38 38 39 void TextDocumentParser::append( PassRefPtr<StringImpl>text)39 void TextDocumentParser::append(RefPtr<StringImpl>&& text) 40 40 { 41 41 if (!m_haveInsertedFakePreElement) 42 42 insertFakePreElement(); 43 HTMLDocumentParser::append( text);43 HTMLDocumentParser::append(WTF::move(text)); 44 44 } 45 45 -
trunk/Source/WebCore/html/parser/TextDocumentParser.h
r177883 r189776 40 40 explicit TextDocumentParser(HTMLDocument&); 41 41 42 virtual void append( PassRefPtr<StringImpl>) override;42 virtual void append(RefPtr<StringImpl>&&) override; 43 43 44 44 void insertFakePreElement(); -
trunk/Source/WebCore/xml/NativeXPathNSResolver.cpp
r165676 r189776 33 33 namespace WebCore { 34 34 35 NativeXPathNSResolver::NativeXPathNSResolver( PassRefPtr<Node>node)36 : m_node( node)35 NativeXPathNSResolver::NativeXPathNSResolver(RefPtr<Node>&& node) 36 : m_node(WTF::move(node)) 37 37 { 38 38 } -
trunk/Source/WebCore/xml/NativeXPathNSResolver.h
r177733 r189776 36 36 class NativeXPathNSResolver : public XPathNSResolver { 37 37 public: 38 static Ref<NativeXPathNSResolver> create( PassRefPtr<Node> node) { return adoptRef(*new NativeXPathNSResolver(node)); }38 static Ref<NativeXPathNSResolver> create(RefPtr<Node>&& node) { return adoptRef(*new NativeXPathNSResolver(WTF::move(node))); } 39 39 virtual ~NativeXPathNSResolver(); 40 40 … … 42 42 43 43 private: 44 explicit NativeXPathNSResolver( PassRefPtr<Node>);44 explicit NativeXPathNSResolver(RefPtr<Node>&&); 45 45 RefPtr<Node> m_node; 46 46 }; -
trunk/Source/WebCore/xml/XMLErrors.cpp
r168350 r189776 85 85 } 86 86 87 static inline PassRefPtr<Element> createXHTMLParserErrorHeader(Document* doc, const String& errorMessages)87 static inline RefPtr<Element> createXHTMLParserErrorHeader(Document* doc, const String& errorMessages) 88 88 { 89 89 RefPtr<Element> reportElement = doc->createElement(QualifiedName(nullAtom, "parsererror", xhtmlNamespaceURI), true); … … 109 109 h3->parserAppendChild(doc->createTextNode("Below is a rendering of the page up to the first error.")); 110 110 111 return reportElement .release();111 return reportElement; 112 112 } 113 113 -
trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp
r184622 r189776 82 82 } 83 83 84 void XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent( PassRefPtr<Event>event, ProgressEventAction progressEventAction)84 void XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent(RefPtr<Event>&& event, ProgressEventAction progressEventAction) 85 85 { 86 86 if (progressEventAction == FlushProgressEvent) 87 87 flushProgressEvent(); 88 88 89 dispatchEvent( event);90 } 91 92 void XMLHttpRequestProgressEventThrottle::dispatchEvent( PassRefPtr<Event>event)89 dispatchEvent(WTF::move(event)); 90 } 91 92 void XMLHttpRequestProgressEventThrottle::dispatchEvent(RefPtr<Event>&& event) 93 93 { 94 94 ASSERT(event); … … 98 98 return; 99 99 } 100 m_deferredEvents.append( event);100 m_deferredEvents.append(WTF::move(event)); 101 101 } else 102 m_target->dispatchEvent( event);102 m_target->dispatchEvent(WTF::move(event)); 103 103 } 104 104 … … 154 154 // If not, just send the most up-to-date progress on resume. 155 155 if (deferredProgressEvent) 156 dispatchEvent( deferredProgressEvent);156 dispatchEvent(WTF::move(deferredProgressEvent)); 157 157 } 158 158 -
trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h
r176459 r189776 29 29 30 30 #include "Timer.h" 31 #include "wtf/PassRefPtr.h"32 31 #include "wtf/Vector.h" 33 32 #include <wtf/Forward.h> … … 51 50 52 51 void dispatchThrottledProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total); 53 void dispatchReadyStateChangeEvent( PassRefPtr<Event>, ProgressEventAction = DoNotFlushProgressEvent);52 void dispatchReadyStateChangeEvent(RefPtr<Event>&&, ProgressEventAction = DoNotFlushProgressEvent); 54 53 void dispatchProgressEvent(const AtomicString&); 55 54 … … 63 62 void dispatchDeferredEvents(); 64 63 void flushProgressEvent(); 65 void dispatchEvent( PassRefPtr<Event>);64 void dispatchEvent(RefPtr<Event>&&); 66 65 67 66 bool hasEventToDispatch() const; -
trunk/Source/WebCore/xml/XMLSerializer.h
r177733 r189776 22 22 23 23 #include <wtf/Forward.h> 24 #include <wtf/ PassRefPtr.h>24 #include <wtf/Ref.h> 25 25 #include <wtf/RefCounted.h> 26 26 -
trunk/Source/WebCore/xml/XPathEvaluator.cpp
r165676 r189776 38 38 using namespace XPath; 39 39 40 PassRefPtr<XPathExpression> XPathEvaluator::createExpression(const String& expression,40 RefPtr<XPathExpression> XPathEvaluator::createExpression(const String& expression, 41 41 XPathNSResolver* resolver, 42 42 ExceptionCode& ec) … … 45 45 } 46 46 47 PassRefPtr<XPathNSResolver> XPathEvaluator::createNSResolver(Node* nodeResolver)47 Ref<XPathNSResolver> XPathEvaluator::createNSResolver(Node* nodeResolver) 48 48 { 49 49 return NativeXPathNSResolver::create(nodeResolver); 50 50 } 51 51 52 PassRefPtr<XPathResult> XPathEvaluator::evaluate(const String& expression,52 RefPtr<XPathResult> XPathEvaluator::evaluate(const String& expression, 53 53 Node* contextNode, 54 54 XPathNSResolver* resolver, … … 59 59 if (!isValidContextNode(contextNode)) { 60 60 ec = NOT_SUPPORTED_ERR; 61 return 0;61 return nullptr; 62 62 } 63 63 … … 65 65 RefPtr<XPathExpression> expr = createExpression(expression, resolver, ec); 66 66 if (ec) 67 return 0;67 return nullptr; 68 68 69 69 return expr->evaluate(contextNode, type, result, ec); -
trunk/Source/WebCore/xml/XPathEvaluator.h
r177733 r189776 29 29 30 30 #include <wtf/Forward.h> 31 #include <wtf/Ref.h> 31 32 #include <wtf/RefCounted.h> 32 #include <wtf/PassRefPtr.h>33 33 34 34 namespace WebCore { … … 45 45 static Ref<XPathEvaluator> create() { return adoptRef(*new XPathEvaluator); } 46 46 47 PassRefPtr<XPathExpression> createExpression(const String& expression, XPathNSResolver*, ExceptionCode&);48 PassRefPtr<XPathNSResolver> createNSResolver(Node* nodeResolver);49 PassRefPtr<XPathResult> evaluate(const String& expression, Node* contextNode,47 RefPtr<XPathExpression> createExpression(const String& expression, XPathNSResolver*, ExceptionCode&); 48 Ref<XPathNSResolver> createNSResolver(Node* nodeResolver); 49 RefPtr<XPathResult> evaluate(const String& expression, Node* contextNode, 50 50 XPathNSResolver*, unsigned short type, XPathResult*, ExceptionCode&); 51 51 -
trunk/Source/WebCore/xml/XPathNodeSet.h
r177316 r189776 37 37 public: 38 38 NodeSet() : m_isSorted(true), m_subtreesAreDisjoint(false) { } 39 explicit NodeSet(PassRefPtr<Node> node) : m_isSorted(true), m_subtreesAreDisjoint(false), m_nodes(1, node) { } 39 explicit NodeSet(RefPtr<Node>&& node) 40 : m_isSorted(true), m_subtreesAreDisjoint(false), m_nodes(1, WTF::move(node)) 41 { } 40 42 41 43 size_t size() const { return m_nodes.size(); } … … 46 48 47 49 // NodeSet itself does not verify that nodes in it are unique. 48 void append( PassRefPtr<Node> node) { m_nodes.append(node); }50 void append(RefPtr<Node>&& node) { m_nodes.append(WTF::move(node)); } 49 51 void append(const NodeSet& nodeSet) { m_nodes.appendVector(nodeSet.m_nodes); } 50 52 -
trunk/Source/WebCore/xml/XPathPath.cpp
r184566 r189776 62 62 63 63 if (evaluatePredicate(*predicate)) 64 newNodes.append(node );64 newNodes.append(node.copyRef()); 65 65 } 66 66 nodes = WTF::move(newNodes); … … 131 131 for (auto& match : matches) { 132 132 if (!needToCheckForDuplicateNodes || newNodesSet.add(match.get()).isNewEntry) 133 newNodes.append(match );133 newNodes.append(match.copyRef()); 134 134 } 135 135 } -
trunk/Source/WebCore/xml/XPathValue.h
r170774 r189776 45 45 Value(const char* value) : m_type(StringValue), m_data(Data::create(value)) { } 46 46 47 explicit Value(NodeSet value) : m_type(NodeSetValue), m_data(Data::create(WTF::move(value))) { } 48 explicit Value(Node* value) : m_type(NodeSetValue), m_data(Data::create(value)) { } 49 explicit Value(PassRefPtr<Node> value) : m_type(NodeSetValue), m_data(Data::create(value)) { } 47 explicit Value(NodeSet&& value) 48 : m_type(NodeSetValue), m_data(Data::create(WTF::move(value))) 49 { } 50 explicit Value(Node* value) 51 : m_type(NodeSetValue), m_data(Data::create(value)) 52 { } 53 explicit Value(RefPtr<Node>&& value) 54 : m_type(NodeSetValue), m_data(Data::create(WTF::move(value))) 55 { } 50 56 51 57 Type type() const { return m_type; } … … 69 75 70 76 struct Data : public RefCounted<Data> { 71 static PassRefPtr<Data> create() { return adoptRef(new Data); }72 static PassRefPtr<Data> create(const String& string) { return adoptRef(new Data(string)); }73 static PassRefPtr<Data> create(NodeSet nodeSet) { return adoptRef(new Data(WTF::move(nodeSet))); }74 static PassRefPtr<Data> create(PassRefPtr<Node> node) { return adoptRef(new Data(node)); }77 static Ref<Data> create() { return adoptRef(*new Data); } 78 static Ref<Data> create(const String& string) { return adoptRef(*new Data(string)); } 79 static Ref<Data> create(NodeSet&& nodeSet) { return adoptRef(*new Data(WTF::move(nodeSet))); } 80 static Ref<Data> create(RefPtr<Node>&& node) { return adoptRef(*new Data(WTF::move(node))); } 75 81 76 82 String string; … … 79 85 private: 80 86 Data() { } 81 explicit Data(const String& string) : string(string) { } 82 explicit Data(NodeSet nodeSet) : nodeSet(WTF::move(nodeSet)) { } 83 explicit Data(PassRefPtr<Node> node) : nodeSet(node) { } 87 explicit Data(const String& string) 88 : string(string) 89 { } 90 explicit Data(NodeSet&& nodeSet) 91 : nodeSet(WTF::move(nodeSet)) 92 { } 93 explicit Data(RefPtr<Node>&& node) 94 : nodeSet(WTF::move(node)) 95 { } 84 96 }; 85 97 -
trunk/Source/WebCore/xml/XSLTProcessor.cpp
r188193 r189776 110 110 } 111 111 112 PassRefPtr<Document> XSLTProcessor::transformToDocument(Node* sourceNode)112 RefPtr<Document> XSLTProcessor::transformToDocument(Node* sourceNode) 113 113 { 114 114 if (!sourceNode) 115 return 0;115 return nullptr; 116 116 117 117 String resultMIMEType; … … 119 119 String resultEncoding; 120 120 if (!transformToString(*sourceNode, resultMIMEType, resultString, resultEncoding)) 121 return 0;121 return nullptr; 122 122 return createDocumentFromSource(resultString, resultEncoding, resultMIMEType, sourceNode, 0); 123 123 } 124 124 125 PassRefPtr<DocumentFragment> XSLTProcessor::transformToFragment(Node* sourceNode, Document* outputDoc)125 RefPtr<DocumentFragment> XSLTProcessor::transformToFragment(Node* sourceNode, Document* outputDoc) 126 126 { 127 127 if (!sourceNode || !outputDoc) 128 return 0;128 return nullptr; 129 129 130 130 String resultMIMEType; … … 137 137 138 138 if (!transformToString(*sourceNode, resultMIMEType, resultString, resultEncoding)) 139 return 0;139 return nullptr; 140 140 return createFragmentForTransformToFragment(resultString, resultMIMEType, outputDoc); 141 141 } -
trunk/Source/WebCore/xml/XSLTProcessor.h
r188193 r189776 45 45 ~XSLTProcessor(); 46 46 47 void setXSLStyleSheet( PassRefPtr<XSLStyleSheet> styleSheet) { m_stylesheet = styleSheet; }47 void setXSLStyleSheet(RefPtr<XSLStyleSheet>&& styleSheet) { m_stylesheet = WTF::move(styleSheet); } 48 48 bool transformToString(Node& source, String& resultMIMEType, String& resultString, String& resultEncoding); 49 49 Ref<Document> createDocumentFromSource(const String& source, const String& sourceEncoding, const String& sourceMIMEType, Node* sourceNode, Frame* frame); 50 50 51 51 // DOM methods 52 void importStylesheet( PassRefPtr<Node>style)52 void importStylesheet(RefPtr<Node>&& style) 53 53 { 54 54 if (style) 55 m_stylesheetRootNode = style;55 m_stylesheetRootNode = WTF::move(style); 56 56 } 57 PassRefPtr<DocumentFragment> transformToFragment(Node* source, Document* ouputDoc);58 PassRefPtr<Document> transformToDocument(Node* source);57 RefPtr<DocumentFragment> transformToFragment(Node* source, Document* ouputDoc); 58 RefPtr<Document> transformToDocument(Node* source); 59 59 60 60 void setParameter(const String& namespaceURI, const String& localName, const String& value); -
trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp
r189676 r189776 106 106 } 107 107 108 void XMLDocumentParser::append( PassRefPtr<StringImpl>inputSource)109 { 110 SegmentedString source( inputSource);108 void XMLDocumentParser::append(RefPtr<StringImpl>&& inputSource) 109 { 110 SegmentedString source(WTF::move(inputSource)); 111 111 if (m_sawXSLTransform || !m_sawFirstElement) 112 112 m_originalSourceForTransform.append(source); -
trunk/Source/WebCore/xml/parser/XMLDocumentParser.h
r184622 r189776 99 99 // From DocumentParser 100 100 virtual void insert(const SegmentedString&) override; 101 virtual void append( PassRefPtr<StringImpl>) override;101 virtual void append(RefPtr<StringImpl>&&) override; 102 102 virtual void finish() override; 103 103 virtual bool isWaitingForScripts() const override;
Note:
See TracChangeset
for help on using the changeset viewer.