Index: Source/core/html/parser/BackgroundHTMLParser.cpp |
diff --git a/Source/core/html/parser/BackgroundHTMLParser.cpp b/Source/core/html/parser/BackgroundHTMLParser.cpp |
index 77d11543259836602909d8da77ebeed03c3d073e..66a62b8d1e77979e627500f19eb0851da2e89e22 100644 |
--- a/Source/core/html/parser/BackgroundHTMLParser.cpp |
+++ b/Source/core/html/parser/BackgroundHTMLParser.cpp |
@@ -27,7 +27,6 @@ |
#include "core/html/parser/BackgroundHTMLParser.h" |
#include "core/html/parser/HTMLDocumentParser.h" |
-#include "core/html/parser/HTMLParserThread.h" |
#include "core/html/parser/TextResourceDecoder.h" |
#include "core/html/parser/XSSAuditor.h" |
#include "wtf/MainThread.h" |
@@ -101,25 +100,34 @@ BackgroundHTMLParser::~BackgroundHTMLParser() |
{ |
} |
-void BackgroundHTMLParser::append(const String& input) |
+void BackgroundHTMLParser::appendRawBytesFromParserThread(const char* data, int dataLength) |
{ |
- ASSERT(!m_input.current().isClosed()); |
- m_input.append(input); |
- pumpTokenizer(); |
+ ASSERT(m_decoder); |
+ updateDocument(m_decoder->decode(data, dataLength)); |
} |
-void BackgroundHTMLParser::appendBytes(PassOwnPtr<Vector<char> > buffer) |
+void BackgroundHTMLParser::appendRawBytesFromMainThread(PassOwnPtr<Vector<char> > buffer) |
{ |
+ ASSERT(m_decoder); |
updateDocument(m_decoder->decode(buffer->data(), buffer->size())); |
} |
+void BackgroundHTMLParser::appendDecodedBytes(const String& input) |
+{ |
+ ASSERT(!m_input.current().isClosed()); |
+ m_input.append(input); |
+ pumpTokenizer(); |
+} |
+ |
void BackgroundHTMLParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
{ |
+ ASSERT(decoder); |
m_decoder = decoder; |
} |
void BackgroundHTMLParser::flush() |
{ |
+ ASSERT(m_decoder); |
updateDocument(m_decoder->flush()); |
} |
@@ -137,7 +145,7 @@ void BackgroundHTMLParser::updateDocument(const String& decodedData) |
if (decodedData.isEmpty()) |
return; |
- append(decodedData); |
+ appendDecodedBytes(decodedData); |
} |
void BackgroundHTMLParser::resumeFrom(PassOwnPtr<Checkpoint> checkpoint) |