Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(594)

Side by Side Diff: third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp

Issue 2494333002: Replace wrapUnique(new T(args)) by makeUnique<T>(args) in Blink (Closed)
Patch Set: Drop redundant WTF:: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2005, 2006, 2008, 2014 Apple Inc. All rights reserved. 3 * Copyright (C) 2005, 2006, 2008, 2014 Apple Inc. All rights reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2008 Holger Hans Peter Freyther 7 * Copyright (C) 2008 Holger Hans Peter Freyther
8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 // runScriptsAtDocumentElementAvailable might have invalidated the document. 1058 // runScriptsAtDocumentElementAvailable might have invalidated the document.
1059 } 1059 }
1060 } 1060 }
1061 1061
1062 void XMLDocumentParser::endElementNs() { 1062 void XMLDocumentParser::endElementNs() {
1063 if (isStopped()) 1063 if (isStopped())
1064 return; 1064 return;
1065 1065
1066 if (m_parserPaused) { 1066 if (m_parserPaused) {
1067 m_pendingCallbacks.append( 1067 m_pendingCallbacks.append(
1068 wrapUnique(new PendingEndElementNSCallback(m_scriptStartPosition))); 1068 makeUnique<PendingEndElementNSCallback>(m_scriptStartPosition));
1069 return; 1069 return;
1070 } 1070 }
1071 1071
1072 if (!updateLeafTextNode()) 1072 if (!updateLeafTextNode())
1073 return; 1073 return;
1074 1074
1075 ContainerNode* n = m_currentNode; 1075 ContainerNode* n = m_currentNode;
1076 if (m_currentNode->isElementNode()) 1076 if (m_currentNode->isElementNode())
1077 toElement(n)->finishParsingChildren(); 1077 toElement(n)->finishParsingChildren();
1078 1078
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 void XMLDocumentParser::setScriptStartPosition(TextPosition textPosition) { 1146 void XMLDocumentParser::setScriptStartPosition(TextPosition textPosition) {
1147 m_scriptStartPosition = textPosition; 1147 m_scriptStartPosition = textPosition;
1148 } 1148 }
1149 1149
1150 void XMLDocumentParser::characters(const xmlChar* chars, int length) { 1150 void XMLDocumentParser::characters(const xmlChar* chars, int length) {
1151 if (isStopped()) 1151 if (isStopped())
1152 return; 1152 return;
1153 1153
1154 if (m_parserPaused) { 1154 if (m_parserPaused) {
1155 m_pendingCallbacks.append( 1155 m_pendingCallbacks.append(
1156 wrapUnique(new PendingCharactersCallback(chars, length))); 1156 makeUnique<PendingCharactersCallback>(chars, length));
1157 return; 1157 return;
1158 } 1158 }
1159 1159
1160 createLeafTextNodeIfNeeded(); 1160 createLeafTextNodeIfNeeded();
1161 m_bufferedText.append(chars, length); 1161 m_bufferedText.append(chars, length);
1162 } 1162 }
1163 1163
1164 void XMLDocumentParser::error(XMLErrors::ErrorType type, 1164 void XMLDocumentParser::error(XMLErrors::ErrorType type,
1165 const char* message, 1165 const char* message,
1166 va_list args) { 1166 va_list args) {
(...skipping 13 matching lines...) Expand all
1180 handleError(type, formattedMessage, textPosition()); 1180 handleError(type, formattedMessage, textPosition());
1181 } 1181 }
1182 1182
1183 void XMLDocumentParser::processingInstruction(const String& target, 1183 void XMLDocumentParser::processingInstruction(const String& target,
1184 const String& data) { 1184 const String& data) {
1185 if (isStopped()) 1185 if (isStopped())
1186 return; 1186 return;
1187 1187
1188 if (m_parserPaused) { 1188 if (m_parserPaused) {
1189 m_pendingCallbacks.append( 1189 m_pendingCallbacks.append(
1190 wrapUnique(new PendingProcessingInstructionCallback(target, data))); 1190 makeUnique<PendingProcessingInstructionCallback>(target, data));
1191 return; 1191 return;
1192 } 1192 }
1193 1193
1194 if (!updateLeafTextNode()) 1194 if (!updateLeafTextNode())
1195 return; 1195 return;
1196 1196
1197 // ### handle exceptions 1197 // ### handle exceptions
1198 TrackExceptionState exceptionState; 1198 TrackExceptionState exceptionState;
1199 ProcessingInstruction* pi = 1199 ProcessingInstruction* pi =
1200 m_currentNode->document().createProcessingInstruction(target, data, 1200 m_currentNode->document().createProcessingInstruction(target, data,
(...skipping 20 matching lines...) Expand all
1221 // FIXME: This contradicts the contract of DocumentParser. 1221 // FIXME: This contradicts the contract of DocumentParser.
1222 stopParsing(); 1222 stopParsing();
1223 } 1223 }
1224 } 1224 }
1225 1225
1226 void XMLDocumentParser::cdataBlock(const String& text) { 1226 void XMLDocumentParser::cdataBlock(const String& text) {
1227 if (isStopped()) 1227 if (isStopped())
1228 return; 1228 return;
1229 1229
1230 if (m_parserPaused) { 1230 if (m_parserPaused) {
1231 m_pendingCallbacks.append(wrapUnique(new PendingCDATABlockCallback(text))); 1231 m_pendingCallbacks.append(makeUnique<PendingCDATABlockCallback>(text));
1232 return; 1232 return;
1233 } 1233 }
1234 1234
1235 if (!updateLeafTextNode()) 1235 if (!updateLeafTextNode())
1236 return; 1236 return;
1237 1237
1238 m_currentNode->parserAppendChild( 1238 m_currentNode->parserAppendChild(
1239 CDATASection::create(m_currentNode->document(), text)); 1239 CDATASection::create(m_currentNode->document(), text));
1240 } 1240 }
1241 1241
1242 void XMLDocumentParser::comment(const String& text) { 1242 void XMLDocumentParser::comment(const String& text) {
1243 if (isStopped()) 1243 if (isStopped())
1244 return; 1244 return;
1245 1245
1246 if (m_parserPaused) { 1246 if (m_parserPaused) {
1247 m_pendingCallbacks.append(wrapUnique(new PendingCommentCallback(text))); 1247 m_pendingCallbacks.append(makeUnique<PendingCommentCallback>(text));
1248 return; 1248 return;
1249 } 1249 }
1250 1250
1251 if (!updateLeafTextNode()) 1251 if (!updateLeafTextNode())
1252 return; 1252 return;
1253 1253
1254 m_currentNode->parserAppendChild( 1254 m_currentNode->parserAppendChild(
1255 Comment::create(m_currentNode->document(), text)); 1255 Comment::create(m_currentNode->document(), text));
1256 } 1256 }
1257 1257
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 const char noStyleMessage[] = 1543 const char noStyleMessage[] =
1544 "This XML file does not appear to have any style information " 1544 "This XML file does not appear to have any style information "
1545 "associated with it. The document tree is shown below."; 1545 "associated with it. The document tree is shown below.";
1546 document()->setIsViewSource(true); 1546 document()->setIsViewSource(true);
1547 V8Document::PrivateScript::transformDocumentToTreeViewMethod( 1547 V8Document::PrivateScript::transformDocumentToTreeViewMethod(
1548 document()->frame(), document(), noStyleMessage); 1548 document()->frame(), document(), noStyleMessage);
1549 } else if (m_sawXSLTransform) { 1549 } else if (m_sawXSLTransform) {
1550 xmlDocPtr doc = 1550 xmlDocPtr doc =
1551 xmlDocPtrForString(document(), m_originalSourceForTransform.toString(), 1551 xmlDocPtrForString(document(), m_originalSourceForTransform.toString(),
1552 document()->url().getString()); 1552 document()->url().getString());
1553 document()->setTransformSource(wrapUnique(new TransformSource(doc))); 1553 document()->setTransformSource(makeUnique<TransformSource>(doc));
1554 DocumentParser::stopParsing(); 1554 DocumentParser::stopParsing();
1555 } 1555 }
1556 } 1556 }
1557 1557
1558 xmlDocPtr xmlDocPtrForString(Document* document, 1558 xmlDocPtr xmlDocPtrForString(Document* document,
1559 const String& source, 1559 const String& source,
1560 const String& url) { 1560 const String& url) {
1561 if (source.isEmpty()) 1561 if (source.isEmpty())
1562 return 0; 1562 return 0;
1563 // Parse in a single chunk into an xmlDocPtr 1563 // Parse in a single chunk into an xmlDocPtr
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 RefPtr<XMLParserContext> parser = 1707 RefPtr<XMLParserContext> parser =
1708 XMLParserContext::createStringParser(&sax, &state); 1708 XMLParserContext::createStringParser(&sax, &state);
1709 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1709 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1710 parseChunk(parser->context(), parseString); 1710 parseChunk(parser->context(), parseString);
1711 finishParsing(parser->context()); 1711 finishParsing(parser->context());
1712 attrsOK = state.gotAttributes; 1712 attrsOK = state.gotAttributes;
1713 return state.attributes; 1713 return state.attributes;
1714 } 1714 }
1715 1715
1716 } // namespace blink 1716 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698