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

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

Issue 2041013004: HTMLDocumentParser: Dedupe member inits by moving them into in-class init (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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..db2487d090b2ee19687704f51c7cb570c0cc50cf 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -88,47 +88,24 @@ static HTMLTokenizer::State tokenizerStateForContextElement(Element* contextElem
HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, ParserSynchronizationPolicy syncPolicy)
: ScriptableDocumentParser(document)
- , m_options(&document)
, m_token(syncPolicy == ForceSynchronousParsing ? adoptPtr(new HTMLToken) : nullptr)
, m_tokenizer(syncPolicy == ForceSynchronousParsing ? HTMLTokenizer::create(m_options) : nullptr)
, m_scriptRunner(HTMLScriptRunner::create(&document, this))
, m_treeBuilder(HTMLTreeBuilder::create(this, &document, getParserContentPolicy(), m_options))
- , m_loadingTaskRunner(adoptPtr(document.loadingTaskRunner()->clone()))
, m_parserScheduler(HTMLParserScheduler::create(this, m_loadingTaskRunner.get()))
- , m_xssAuditorDelegate(&document)
- , m_weakFactory(this)
, m_preloader(HTMLResourcePreloader::create(document))
- , m_parsedChunkQueue(ParsedChunkQueue::create())
- , m_evaluator(DocumentWriteEvaluator::create(document))
+ , m_parsedChunkQueue(syncPolicy == ForceSynchronousParsing ? nullptr : ParsedChunkQueue::create())
, m_shouldUseThreading(syncPolicy == AllowAsynchronousParsing)
- , m_endWasDelayed(false)
- , m_haveBackgroundParser(false)
- , m_tasksWereSuspended(false)
- , m_pumpSessionNestingLevel(0)
- , m_pumpSpeculationsSessionNestingLevel(0)
- , m_isParsingAtLineNumber(false)
- , m_triedLoadingLinkHeaders(false)
{
ASSERT(shouldUseThreading() || (m_token && m_tokenizer));
}
-// FIXME: Member variables should be grouped into self-initializing structs to
-// minimize code duplication between these constructors.
HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, Element* contextElement, ParserContentPolicy parserContentPolicy)
: ScriptableDocumentParser(fragment->document(), parserContentPolicy)
- , m_options(&fragment->document())
, m_token(adoptPtr(new HTMLToken))
, m_tokenizer(HTMLTokenizer::create(m_options))
, m_treeBuilder(HTMLTreeBuilder::create(this, fragment, contextElement, this->getParserContentPolicy(), m_options))
- , m_loadingTaskRunner(adoptPtr(fragment->document().loadingTaskRunner()->clone()))
- , m_xssAuditorDelegate(&fragment->document())
- , m_weakFactory(this)
, m_shouldUseThreading(false)
- , m_endWasDelayed(false)
- , m_haveBackgroundParser(false)
- , m_tasksWereSuspended(false)
- , m_pumpSessionNestingLevel(0)
- , m_pumpSpeculationsSessionNestingLevel(0)
{
bool reportErrors = false; // For now document fragment parsing never reports errors.
m_tokenizer->setState(tokenizerStateForContextElement(contextElement, reportErrors, m_options));

Powered by Google App Engine
This is Rietveld 408576698