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

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp

Issue 2172613002: Renderer-side changes for NoState Prefetch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix style Created 4 years, 4 months 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 side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698