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

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

Issue 644573002: Disable async main thread HTML parsing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: WebFrameTest should wait for background thread tasks Created 6 years, 2 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
« no previous file with comments | « no previous file | Source/core/html/parser/HTMLParserOptions.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/parser/HTMLDocumentParser.cpp
diff --git a/Source/core/html/parser/HTMLDocumentParser.cpp b/Source/core/html/parser/HTMLDocumentParser.cpp
index 685c097b8cf1fb27461a4d1928709f01009f1a6e..86578e8b43af6115d67cbfbb28b1c546c76cda79 100644
--- a/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -255,6 +255,8 @@ bool HTMLDocumentParser::processingData() const
void HTMLDocumentParser::pumpTokenizerIfPossible(SynchronousMode mode)
{
+ ASSERT(mode == ForceSynchronous);
+
if (isStopped())
return;
if (isWaitingForScripts())
@@ -262,7 +264,6 @@ void HTMLDocumentParser::pumpTokenizerIfPossible(SynchronousMode mode)
// Once a resume is scheduled, HTMLParserScheduler controls when we next pump.
if (isScheduledForResume()) {
- ASSERT(mode == AllowYield);
return;
}
@@ -278,19 +279,12 @@ bool HTMLDocumentParser::isScheduledForResume() const
void HTMLDocumentParser::resumeParsingAfterYield()
{
ASSERT(!m_isPinnedToMainThread);
- // pumpTokenizer can cause this parser to be detached from the Document,
+ ASSERT(m_haveBackgroundParser);
+
+ // pumpPendingSpeculations can cause this parser to be detached from the Document,
// but we need to ensure it isn't deleted yet.
RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this);
-
- if (m_haveBackgroundParser) {
- pumpPendingSpeculations();
- return;
- }
-
- // We should never be here unless we can pump immediately. Call pumpTokenizer()
- // directly so that ASSERTS will fire if we're wrong.
- pumpTokenizer(AllowYield);
- endIfDelayed();
+ pumpPendingSpeculations();
}
void HTMLDocumentParser::runScriptsForPausedTreeBuilder()
@@ -589,7 +583,7 @@ void HTMLDocumentParser::pumpTokenizer(SynchronousMode mode)
#endif
ASSERT(m_tokenizer);
ASSERT(m_token);
- ASSERT(!m_haveBackgroundParser || mode == ForceSynchronous);
+ ASSERT(mode == ForceSynchronous);
PumpSession session(m_pumpSessionNestingLevel, contextForParsingSession());
@@ -814,10 +808,8 @@ void HTMLDocumentParser::append(PassRefPtr<StringImpl> inputSource)
// javascript: url handling is one such caller.
// FIXME: This is gross, and we should separate the concept of synchronous parsing
// from insert() so that only document.write() uses insert.
- if (m_isPinnedToMainThread)
- pumpTokenizerIfPossible(ForceSynchronous);
- else
- pumpTokenizerIfPossible(AllowYield);
+ ASSERT(m_isPinnedToMainThread);
+ pumpTokenizerIfPossible(ForceSynchronous);
endIfDelayed();
}
@@ -971,7 +963,7 @@ void HTMLDocumentParser::resumeParsingAfterScriptExecution()
}
m_insertionPreloadScanner.clear();
- pumpTokenizerIfPossible(AllowYield);
+ pumpTokenizerIfPossible(ForceSynchronous);
endIfDelayed();
}
« no previous file with comments | « no previous file | Source/core/html/parser/HTMLParserOptions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698