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

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

Issue 23455024: Move ownership of the TextResourceDecoder to DecodedDataDocumentParser (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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
Index: Source/core/loader/DocumentWriter.cpp
diff --git a/Source/core/loader/DocumentWriter.cpp b/Source/core/loader/DocumentWriter.cpp
index 566351d30a906c1015606baf0ceb224a0d8a666d..d64f9d16ca0659bf7e74193537491c11121410a2 100644
--- a/Source/core/loader/DocumentWriter.cpp
+++ b/Source/core/loader/DocumentWriter.cpp
@@ -97,8 +97,10 @@ void DocumentWriter::reportDataReceived()
void DocumentWriter::addData(const char* bytes, size_t length)
{
ASSERT(m_parser);
- if (!m_decoder && m_parser->needsDecoder() && 0 < length)
+ if (!m_decoder && m_parser->needsDecoder() && 0 < length) {
m_decoder = m_decoderBuilder.buildFor(m_document);
+ m_parser->asDecodedDataDocumentParser()->setDecoder(m_decoder);
abarth-chromium 2013/08/30 22:50:38 Maybe setDecoder should be defined on the same int
+ }
// appendBytes() can result replacing DocumentLoader::m_writer.
RefPtr<DocumentWriter> protectingThis(this);
size_t consumedChars = m_parser->appendBytes(bytes, length);
@@ -118,8 +120,10 @@ void DocumentWriter::end()
if (!m_parser)
return;
- if (!m_decoder && m_parser->needsDecoder())
+ if (!m_decoder && m_parser->needsDecoder()) {
m_decoder = m_decoderBuilder.buildFor(m_document);
+ m_parser->asDecodedDataDocumentParser()->setDecoder(m_decoder);
+ }
// flush() can result replacing DocumentLoader::m_writer.
RefPtr<DocumentWriter> protectingThis(this);
size_t consumedChars = m_parser->flush();
@@ -133,6 +137,11 @@ void DocumentWriter::end()
m_document = 0;
}
+void DocumentWriter::setUserChosenEncoding(const String& charset)
+{
+ m_decoder->setEncoding(charset, TextResourceDecoder::UserChosenEncoding);
+}
+
void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation()
{
ASSERT(m_parser && !m_parser->isStopped());

Powered by Google App Engine
This is Rietveld 408576698