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

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: rebased 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
« no previous file with comments | « Source/core/loader/DocumentWriter.h ('k') | Source/core/loader/TextResourceDecoderBuilder.cpp » ('j') | 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 1134cc8db224889d2621c2375cd52fdc23dc8824..b67add63b716b758fbdf5a8185932eebbcd4ab47 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);
+ }
// 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());
« no previous file with comments | « Source/core/loader/DocumentWriter.h ('k') | Source/core/loader/TextResourceDecoderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698