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

Unified Diff: Source/core/loader/DocumentWriter.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/loader/DocumentWriter.h ('k') | Source/core/xmlhttprequest/XMLHttpRequest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/DocumentWriter.cpp
diff --git a/Source/core/loader/DocumentWriter.cpp b/Source/core/loader/DocumentWriter.cpp
index 41c48c18407230dac318b8d2cc9d4b603bdfbfce..a187c73339b49f2def4a33708229a953eef52453 100644
--- a/Source/core/loader/DocumentWriter.cpp
+++ b/Source/core/loader/DocumentWriter.cpp
@@ -44,19 +44,18 @@
namespace blink {
-PassRefPtrWillBeRawPtr<DocumentWriter> DocumentWriter::create(Document* document, const AtomicString& mimeType, const AtomicString& encoding)
+PassRefPtrWillBeRawPtr<DocumentWriter> DocumentWriter::create(Document* document, ParserSynchronizationPolicy parsingPolicy, const AtomicString& mimeType, const AtomicString& encoding)
{
- return adoptRefWillBeNoop(new DocumentWriter(document, mimeType, encoding));
+ return adoptRefWillBeNoop(new DocumentWriter(document, parsingPolicy, mimeType, encoding));
}
-DocumentWriter::DocumentWriter(Document* document, const AtomicString& mimeType, const AtomicString& encoding)
+DocumentWriter::DocumentWriter(Document* document, ParserSynchronizationPolicy parserSyncPolicy, const AtomicString& mimeType, const AtomicString& encoding)
: m_document(document)
, m_decoderBuilder(mimeType, encoding)
// We grab a reference to the parser so that we'll always send data to the
// original parser, even if the document acquires a new parser (e.g., via
// document.open).
- , m_parser(m_document->implicitOpen())
- , m_forcedSynchronousParse(false)
+ , m_parser(m_document->implicitOpen(parserSyncPolicy))
{
if (m_document->frame()) {
if (FrameView* view = m_document->frame()->view())
@@ -74,15 +73,6 @@ void DocumentWriter::trace(Visitor* visitor)
visitor->trace(m_parser);
}
-void DocumentWriter::forceSynchronousParse()
-{
- ASSERT(!m_forcedSynchronousParse);
-
- ASSERT(m_parser);
- m_parser->pinToMainThread();
- m_forcedSynchronousParse = true;
-}
-
void DocumentWriter::appendReplacingData(const String& source)
{
m_document->setCompatibilityMode(Document::NoQuirksMode);
@@ -90,9 +80,7 @@ void DocumentWriter::appendReplacingData(const String& source)
// FIXME: This should call DocumentParser::appendBytes instead of append
// to support RawDataDocumentParsers.
if (DocumentParser* parser = m_document->parser()) {
- if (!m_forcedSynchronousParse)
- forceSynchronousParse();
- // Because we're pinned to the main thread we don't need to worry about
+ // Because the parser is pinned to the main thread we don't need to worry about
// passing ownership of the source string.
parser->append(source.impl());
}
« no previous file with comments | « Source/core/loader/DocumentWriter.h ('k') | Source/core/xmlhttprequest/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698