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

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

Issue 2544733002: Reland Script blocking resources tracking should be only done by Document::isScriptExecutionReady" (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4eff1b4c8915e5a54763ce9f440d1b23d295e283..f5cad31543ec3404aed70046df64f6c3982549de 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -397,6 +397,10 @@ void HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser(
void HTMLDocumentParser::validateSpeculations(
std::unique_ptr<TokenizedChunk> chunk) {
ASSERT(chunk);
+ // TODO(kouhei): We should simplify codepath here by disallowing
+ // validateSpeculations
+ // while isWaitingForScripts, and m_lastChunkBeforeScript can simply be
+ // pushed to m_speculations.
if (isWaitingForScripts()) {
// We're waiting on a network script, just save the chunk, we'll get a
// second validateSpeculations call after the script completes. This call
@@ -1056,14 +1060,18 @@ void HTMLDocumentParser::resumeParsingAfterScriptExecution() {
ASSERT(!isWaitingForScripts());
if (m_haveBackgroundParser) {
- validateSpeculations(std::move(m_lastChunkBeforeScript));
- ASSERT(!m_lastChunkBeforeScript);
- pumpPendingSpeculations();
+ if (m_lastChunkBeforeScript) {
+ validateSpeculations(std::move(m_lastChunkBeforeScript));
+ DCHECK(!m_lastChunkBeforeScript);
+ pumpPendingSpeculations();
+ }
return;
}
m_insertionPreloadScanner.reset();
- pumpTokenizerIfPossible();
+ if (m_tokenizer) {
+ pumpTokenizerIfPossible();
+ }
endIfDelayed();
}
@@ -1092,14 +1100,11 @@ void HTMLDocumentParser::notifyScriptLoaded(Resource* cachedResource) {
}
void HTMLDocumentParser::executeScriptsWaitingForResources() {
+ DCHECK(document()->isScriptExecutionReady());
+
// Document only calls this when the Document owns the DocumentParser so this
// will not be called in the DocumentFragment case.
- ASSERT(m_scriptRunner);
- // Ignore calls unless we have a script blocking the parser waiting on a
- // stylesheet load. Otherwise we are currently parsing and this is a
- // re-entrant call from encountering a </ style> tag.
- if (!m_scriptRunner->hasScriptsWaitingForResources())
- return;
+ DCHECK(m_scriptRunner);
m_scriptRunner->executeScriptsWaitingForResources();
if (!isWaitingForScripts())
resumeParsingAfterScriptExecution();
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698