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

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

Issue 74513003: Moved text decoding to the parser thread (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@parserthread_step25
Patch Set: XSSAuditor fix Created 7 years, 1 month 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: Source/core/dom/DecodedDataDocumentParser.cpp
diff --git a/Source/core/dom/DecodedDataDocumentParser.cpp b/Source/core/dom/DecodedDataDocumentParser.cpp
index 7f3c01f23d888588788284487ead384a0f4ef704..a14b82e82f0f10f3b6772ea7c35e4a9dbe66f98c 100644
--- a/Source/core/dom/DecodedDataDocumentParser.cpp
+++ b/Source/core/dom/DecodedDataDocumentParser.cpp
@@ -34,7 +34,7 @@ namespace WebCore {
DecodedDataDocumentParser::DecodedDataDocumentParser(Document* document)
: DocumentParser(document)
- , m_hasAppendedData(false)
+ , m_needsDecoder(true)
{
}
@@ -44,6 +44,7 @@ DecodedDataDocumentParser::~DecodedDataDocumentParser()
void DecodedDataDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder)
{
+ m_needsDecoder = false;
m_decoder = decoder;
}
@@ -52,9 +53,9 @@ TextResourceDecoder* DecodedDataDocumentParser::decoder()
return m_decoder.get();
}
-void DecodedDataDocumentParser::setHasAppendedData()
+PassOwnPtr<TextResourceDecoder> DecodedDataDocumentParser::takeDecoder()
{
- m_hasAppendedData = true;
+ return m_decoder.release();
}
void DecodedDataDocumentParser::appendBytes(const char* data, size_t length)
@@ -91,22 +92,10 @@ void DecodedDataDocumentParser::flush()
void DecodedDataDocumentParser::updateDocument(String& decodedData)
{
- DocumentEncodingData encodingData;
- encodingData.encoding = m_decoder->encoding();
- encodingData.wasDetectedHeuristically = m_decoder->encodingWasDetectedHeuristically();
- encodingData.sawDecodingError = m_decoder->sawError();
- document()->setEncodingData(encodingData);
+ document()->setEncodingData(DocumentEncodingData(*m_decoder.get()));
- if (decodedData.isEmpty())
- return;
-
- append(decodedData.releaseImpl());
- // FIXME: Should be removed as part of https://code.google.com/p/chromium/issues/detail?id=319643
- if (!m_hasAppendedData) {
- m_hasAppendedData = true;
- if (m_decoder->encoding().usesVisualOrdering())
- document()->setVisuallyOrdered();
- }
+ if (!decodedData.isEmpty())
+ append(decodedData.releaseImpl());
}
};

Powered by Google App Engine
This is Rietveld 408576698