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

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

Issue 1823863002: Simplify parsing/loading state, attempt #2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes Created 4 years, 9 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 0ed9b645e97913e65ae42861cfb2848a1a67024c..3f1e1957a1c25b4a8622ea67936ddaa850505066 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -259,11 +259,6 @@ bool HTMLDocumentParser::isParsingFragment() const
return m_treeBuilder->isParsingFragment();
}
-bool HTMLDocumentParser::processingData() const
-{
- return isScheduledForResume() || inPumpSession() || m_haveBackgroundParser;
-}
-
void HTMLDocumentParser::pumpTokenizerIfPossible()
{
if (isStopped() || isWaitingForScripts())
@@ -434,7 +429,8 @@ size_t HTMLDocumentParser::processParsedChunkFromBackgroundParser(PassOwnPtr<Par
TRACE_EVENT0("blink", "HTMLDocumentParser::processParsedChunkFromBackgroundParser");
TemporaryChange<bool> hasLineNumber(m_isParsingAtLineNumber, true);
- ASSERT_WITH_SECURITY_IMPLICATION(document()->activeParserCount() == 1);
+ ASSERT_WITH_SECURITY_IMPLICATION(m_pumpSpeculationsSessionNestingLevel == 1);
+ ASSERT_WITH_SECURITY_IMPLICATION(!inPumpSession());
ASSERT(!isParsingFragment());
ASSERT(!isWaitingForScripts());
ASSERT(!isStopped());
@@ -550,7 +546,7 @@ void HTMLDocumentParser::pumpPendingSpeculations()
// FIXME: Pass in current input length.
TRACE_EVENT_BEGIN1("devtools.timeline", "ParseHTML", "beginData", InspectorParseHtmlEvent::beginData(document(), lineNumber().zeroBasedInt()));
- SpeculationsPumpSession session(m_pumpSpeculationsSessionNestingLevel, contextForParsingSession());
+ SpeculationsPumpSession session(m_pumpSpeculationsSessionNestingLevel);
while (!m_speculations.isEmpty()) {
ASSERT(!isScheduledForResume());
size_t elementTokenCount = processParsedChunkFromBackgroundParser(m_speculations.takeFirst().release());
@@ -584,15 +580,6 @@ void HTMLDocumentParser::forcePlaintextForTextDocument()
m_tokenizer->setState(HTMLTokenizer::PLAINTEXTState);
}
-Document* HTMLDocumentParser::contextForParsingSession()
-{
- // The parsing session should interact with the document only when parsing
- // non-fragments. Otherwise, we might delay the load event mistakenly.
- if (isParsingFragment())
- return nullptr;
- return document();
-}
-
void HTMLDocumentParser::pumpTokenizer()
{
ASSERT(!isStopped());
@@ -603,7 +590,7 @@ void HTMLDocumentParser::pumpTokenizer()
ASSERT(m_tokenizer);
ASSERT(m_token);
- PumpSession session(m_pumpSessionNestingLevel, contextForParsingSession());
+ PumpSession session(m_pumpSessionNestingLevel);
// We tell the InspectorInstrumentation about every pump, even if we
// end up pumping nothing. It can filter out empty pumps itself.
@@ -1061,7 +1048,6 @@ void HTMLDocumentParser::parseDocumentFragment(const String& source, DocumentFra
RefPtrWillBeRawPtr<HTMLDocumentParser> parser = HTMLDocumentParser::create(fragment, contextElement, parserContentPolicy);
parser->append(source);
parser->finish();
- ASSERT(!parser->processingData()); // Make sure we're done. <rdar://problem/3963151>
parser->detach(); // Allows ~DocumentParser to assert it was detached before destruction.
}

Powered by Google App Engine
This is Rietveld 408576698