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

Unified Diff: Source/core/dom/Document.cpp

Issue 779393002: Turn DocumentParser::pinToMainThread into a cleaner api (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 | « Source/core/dom/Document.h ('k') | Source/core/dom/DocumentParser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index fed99da27b200b5a3b9ffe4f27ed8f3376f14c85..7456b2b0695e8e3778e347872524c4eb66ee2d1f 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -508,6 +508,7 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsTimerFired)
, m_hasViewportUnits(false)
, m_styleRecalcElementCounter(0)
+ , m_parserSyncPolicy(AllowAsynchronousParsing)
{
if (m_frame) {
ASSERT(m_frame->page());
@@ -1233,11 +1234,6 @@ KURL Document::baseURI() const
void Document::setContent(const String& content)
{
open();
- // FIXME: This should probably use insert(), but that's (intentionally)
- // not implemented for the XML parser as it's normally synonymous with
- // document.write(). append() will end up yielding, but close() will
- // pump the tokenizer syncrhonously and finish the parse.
- m_parser->pinToMainThread();
m_parser->append(content.impl());
close();
}
@@ -2294,7 +2290,7 @@ PassRefPtrWillBeRawPtr<DocumentParser> Document::createParser()
{
if (isHTMLDocument()) {
bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors(page());
- return HTMLDocumentParser::create(toHTMLDocument(*this), reportErrors);
+ return HTMLDocumentParser::create(toHTMLDocument(*this), reportErrors, m_parserSyncPolicy);
}
// FIXME: this should probably pass the frame instead
return XMLDocumentParser::create(*this, view());
@@ -2342,7 +2338,7 @@ void Document::open(Document* ownerDocument, ExceptionState& exceptionState)
}
removeAllEventListenersRecursively();
- implicitOpen();
+ implicitOpen(ForceSynchronousParsing);
if (ScriptableDocumentParser* parser = scriptableDocumentParser())
parser->setWasCreatedByScript(true);
@@ -2373,7 +2369,7 @@ void Document::cancelParsing()
explicitClose();
}
-PassRefPtrWillBeRawPtr<DocumentParser> Document::implicitOpen()
+PassRefPtrWillBeRawPtr<DocumentParser> Document::implicitOpen(ParserSynchronizationPolicy parserSyncPolicy)
{
cancelParsing();
@@ -2382,6 +2378,7 @@ PassRefPtrWillBeRawPtr<DocumentParser> Document::implicitOpen()
setCompatibilityMode(NoQuirksMode);
+ m_parserSyncPolicy = parserSyncPolicy;
m_parser = createParser();
setParsingState(Parsing);
setReadyState(Loading);
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/DocumentParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698