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

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

Issue 2042413002: Notify the HTMLDocumentParser on document element available (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: insertedByParser after actual insertion point Created 4 years, 6 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 cf5ea7ff0fa1726080d852e328860a78bf4e3f30..69f8d510dc4e3d0fa584237ed3c124a2acd1ed92 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -312,7 +312,7 @@ void HTMLDocumentParser::notifyPendingParsedChunks()
} else {
// We can safely assume that there are no queued preloads request after
// the document element is available, as we empty the queue immediately
- // after the document element is created in pumpPendingSpeculations().
+ // after the document element is created in documentElementAvailable().
ASSERT(m_queuedPreloads.isEmpty());
ASSERT(m_queuedDocumentWriteScripts.isEmpty());
for (auto& chunk : pendingChunks) {
@@ -454,8 +454,6 @@ size_t HTMLDocumentParser::processParsedChunkFromBackgroundParser(PassOwnPtr<Par
if (isStopped())
break;
- pumpPreloadQueue();
-
if (!m_triedLoadingLinkHeaders && document()->loader()) {
String linkHeader = document()->loader()->response().httpHeaderField(HTTPNames::Link);
if (!linkHeader.isEmpty()) {
@@ -1055,11 +1053,10 @@ void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder)
HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::setDecoder, m_backgroundParser, passed(takeDecoder())));
}
-void HTMLDocumentParser::pumpPreloadQueue()
+void HTMLDocumentParser::documentElementAvailable()
{
- if (!document()->documentElement())
- return;
-
+ TRACE_EVENT0("blink,loader", "HTMLDocumentParser::documentElementAvailable");
+ DCHECK(document()->documentElement());
for (const String& scriptSource : m_queuedDocumentWriteScripts) {
evaluateAndPreloadScriptForDocumentWrite(scriptSource);
}

Powered by Google App Engine
This is Rietveld 408576698