Chromium Code Reviews| Index: Source/core/loader/DocumentWriter.cpp |
| diff --git a/Source/core/loader/DocumentWriter.cpp b/Source/core/loader/DocumentWriter.cpp |
| index 41c48c18407230dac318b8d2cc9d4b603bdfbfce..97f88b5bd33ffd259ce0195f960479f489a4fcc2 100644 |
| --- a/Source/core/loader/DocumentWriter.cpp |
| +++ b/Source/core/loader/DocumentWriter.cpp |
| @@ -44,20 +44,24 @@ |
| 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 parsingPolicy, const AtomicString& mimeType, const AtomicString& encoding) |
| : m_document(document) |
| , m_decoderBuilder(mimeType, encoding) |
| + , m_forcedSynchronousParse(parsingPolicy == ForceSynchronousParsing) |
| +{ |
| + if (m_forcedSynchronousParse) |
| + m_document->forceSynchronousParsing(); |
| + |
| // 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(); |
|
kbalazs
2014/12/05 23:37:57
moved out from initializer list because forceSyncP
|
| + |
| if (m_document->frame()) { |
| if (FrameView* view = m_document->frame()->view()) |
| view->setContentsSize(IntSize()); |
| @@ -74,15 +78,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,10 +85,9 @@ 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. |
| + ASSERT(m_forcedSynchronousParse); |
| parser->append(source.impl()); |
| } |
| } |