| Index: third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
|
| index 33b3cf558eb3c42d2b2fe90899045a4251ef2de0..22b910e2d985864a5bb4053b57238f5de536bad9 100644
|
| --- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
|
| +++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
|
| @@ -130,6 +130,9 @@ HTMLDocumentParser::HTMLDocumentParser(Document& document, ParserContentPolicy c
|
| , m_triedLoadingLinkHeaders(false)
|
| {
|
| ASSERT(shouldUseThreading() || (m_token && m_tokenizer));
|
| + // Threading is not allowed in prefetch mode.
|
| + DCHECK(!document.isPrefetchOnly() || !shouldUseThreading());
|
| +
|
| ThreadState::current()->registerPreFinalizer(this);
|
| }
|
|
|
| @@ -797,6 +800,18 @@ void HTMLDocumentParser::append(const String& inputSource)
|
| TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("blink.debug"), "HTMLDocumentParser::append", "size", inputSource.length());
|
| const SegmentedString source(inputSource);
|
|
|
| + if (document()->isPrefetchOnly()) {
|
| + if (!m_preloadScanner)
|
| + m_preloadScanner = createPreloadScanner();
|
| +
|
| + m_preloadScanner->appendToEnd(source);
|
| + // TODO(droger): Set the LOAD_PREFETCH flags on the requests.
|
| + m_preloadScanner->scanAndPreload(m_preloader.get(), document()->validBaseElementURL(), nullptr);
|
| +
|
| + // Return after the preload scanner, do not actually parse the document.
|
| + return;
|
| + }
|
| +
|
| if (m_preloadScanner) {
|
| if (m_input.current().isEmpty() && !isWaitingForScripts()) {
|
| // We have parsed until the end of the current input and so are now moving ahead of the preload scanner.
|
|
|