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

Unified Diff: Source/core/loader/DocumentWriter.cpp

Issue 646913002: Force synchronized parser for substitute main resource load marked forceSynchronousLoad. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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
« no previous file with comments | « Source/core/loader/DocumentWriter.h ('k') | no next file » | 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 ef7b636f7fff42b4f2ed4d6ff1d477208724b9b1..41c48c18407230dac318b8d2cc9d4b603bdfbfce 100644
--- a/Source/core/loader/DocumentWriter.cpp
+++ b/Source/core/loader/DocumentWriter.cpp
@@ -56,6 +56,7 @@ DocumentWriter::DocumentWriter(Document* document, const AtomicString& mimeType,
// original parser, even if the document acquires a new parser (e.g., via
// document.open).
, m_parser(m_document->implicitOpen())
+ , m_forcedSynchronousParse(false)
{
if (m_document->frame()) {
if (FrameView* view = m_document->frame()->view())
@@ -73,6 +74,15 @@ 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);
@@ -80,7 +90,8 @@ void DocumentWriter::appendReplacingData(const String& source)
// FIXME: This should call DocumentParser::appendBytes instead of append
// to support RawDataDocumentParsers.
if (DocumentParser* parser = m_document->parser()) {
- parser->pinToMainThread();
+ if (!m_forcedSynchronousParse)
+ forceSynchronousParse();
// Because we're 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') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698