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

Unified Diff: Source/core/html/parser/BackgroundHTMLParser.cpp

Issue 100563004: Redirect HTML resource bytes directly to parser thread (Blink side CL) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@parserthread_decodermove
Patch Set: Conflict fix Created 6 years, 9 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/html/parser/BackgroundHTMLParser.h ('k') | Source/core/html/parser/HTMLDocumentParser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/core/html/parser/BackgroundHTMLParser.h ('k') | Source/core/html/parser/HTMLDocumentParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698