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

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

Issue 133273007: Revert "Moved text decoding to the parser thread" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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/dom/DecodedDataDocumentParser.h ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DecodedDataDocumentParser.cpp
diff --git a/Source/core/dom/DecodedDataDocumentParser.cpp b/Source/core/dom/DecodedDataDocumentParser.cpp
index d5a118cdff6c3eb2189d216fe4550061253828fd..7f3c01f23d888588788284487ead384a0f4ef704 100644
--- a/Source/core/dom/DecodedDataDocumentParser.cpp
+++ b/Source/core/dom/DecodedDataDocumentParser.cpp
@@ -28,13 +28,13 @@
#include "core/dom/Document.h"
#include "core/dom/DocumentEncodingData.h"
-#include "core/html/parser/TextResourceDecoder.h"
+#include "core/fetch/TextResourceDecoder.h"
namespace WebCore {
DecodedDataDocumentParser::DecodedDataDocumentParser(Document* document)
: DocumentParser(document)
- , m_needsDecoder(true)
+ , m_hasAppendedData(false)
{
}
@@ -44,10 +44,6 @@ DecodedDataDocumentParser::~DecodedDataDocumentParser()
void DecodedDataDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder)
{
- // If the decoder is explicitly unset rather than having ownership
- // transferred away by takeDecoder(), we need to make sure it's recreated
- // next time data is appended.
- m_needsDecoder = !decoder;
m_decoder = decoder;
}
@@ -56,9 +52,9 @@ TextResourceDecoder* DecodedDataDocumentParser::decoder()
return m_decoder.get();
}
-PassOwnPtr<TextResourceDecoder> DecodedDataDocumentParser::takeDecoder()
+void DecodedDataDocumentParser::setHasAppendedData()
{
- return m_decoder.release();
+ m_hasAppendedData = true;
}
void DecodedDataDocumentParser::appendBytes(const char* data, size_t length)
@@ -95,10 +91,22 @@ void DecodedDataDocumentParser::flush()
void DecodedDataDocumentParser::updateDocument(String& decodedData)
{
- document()->setEncodingData(DocumentEncodingData(*m_decoder.get()));
+ DocumentEncodingData encodingData;
+ encodingData.encoding = m_decoder->encoding();
+ encodingData.wasDetectedHeuristically = m_decoder->encodingWasDetectedHeuristically();
+ encodingData.sawDecodingError = m_decoder->sawError();
+ document()->setEncodingData(encodingData);
- if (!decodedData.isEmpty())
- append(decodedData.releaseImpl());
+ 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();
+ }
}
};
« no previous file with comments | « Source/core/dom/DecodedDataDocumentParser.h ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698