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

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

Issue 69823002: Move ownership of the TextResourceDecoder to DecodedDataDocumentParser (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moved DocumentEncodingData to its own header 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/loader/DocumentWriter.cpp
diff --git a/Source/core/loader/DocumentWriter.cpp b/Source/core/loader/DocumentWriter.cpp
index 1134cc8db224889d2621c2375cd52fdc23dc8824..da1f638fa53d504284cf3762be4ff3b727136873 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->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);
abarth-chromium 2013/11/14 07:04:33 Do we need to keep the m_decoder member here? The
oystein (OOO til 10th of July) 2013/11/14 19:02:29 Nah might as well move it now :).
+ m_parser->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