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

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

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: Created 6 years, 10 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/html/parser/BackgroundHTMLParser.h
diff --git a/Source/core/html/parser/BackgroundHTMLParser.h b/Source/core/html/parser/BackgroundHTMLParser.h
index f1a76fd000577676c9ef0ea5b580076ebfeb221d..941683f59935b46da5b542a90be477b4883ab7f0 100644
--- a/Source/core/html/parser/BackgroundHTMLParser.h
+++ b/Source/core/html/parser/BackgroundHTMLParser.h
@@ -33,7 +33,9 @@
#include "core/html/parser/HTMLSourceTracker.h"
#include "core/html/parser/HTMLTreeBuilderSimulator.h"
#include "core/html/parser/XSSAuditorDelegate.h"
+#include "public/platform/WebThreadedResourceProvider.h"
#include "wtf/PassOwnPtr.h"
+#include "wtf/Vector.h"
#include "wtf/WeakPtr.h"
namespace WebCore {
@@ -42,7 +44,7 @@ class HTMLDocumentParser;
class SharedBuffer;
class XSSAuditor;
-class BackgroundHTMLParser {
+class BackgroundHTMLParser : public blink::WebThreadedResourceBackgroundClient {
WTF_MAKE_FAST_ALLOCATED;
public:
struct Configuration {
@@ -51,6 +53,7 @@ public:
OwnPtr<XSSAuditor> xssAuditor;
OwnPtr<TokenPreloadScanner> preloadScanner;
OwnPtr<TextResourceDecoder> decoder;
+ OwnPtr<blink::WebThreadedResourceProvider> resourceProvider;
};
static void start(PassRefPtr<WeakReference<BackgroundHTMLParser> >, PassOwnPtr<Configuration>);
@@ -65,6 +68,9 @@ public:
String unparsedInput;
};
+ // From blink::WebThreadedResourceBackgroundClient
+ virtual void didReceivedData(const char* data, size_t length) OVERRIDE FINAL;
+
void appendBytes(PassOwnPtr<Vector<char> >);
void setDecoder(PassOwnPtr<TextResourceDecoder>);
void flush();
@@ -72,18 +78,20 @@ public:
void startedChunkWithCheckpoint(HTMLInputCheckpoint);
void finish();
void stop();
+ void didSwitchedToBackgroundClient();
void forcePlaintextForTextDocument();
private:
BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser> >, PassOwnPtr<Configuration>);
- ~BackgroundHTMLParser();
+ virtual ~BackgroundHTMLParser();
void append(const String&);
void markEndOfFile();
void pumpTokenizer();
void sendTokensToMainThread();
void updateDocument(const String& decodedData);
+ void flushQueuedData();
WeakPtrFactory<BackgroundHTMLParser> m_weakFactory;
BackgroundHTMLInputStream m_input;
@@ -101,7 +109,10 @@ private:
OwnPtr<XSSAuditor> m_xssAuditor;
OwnPtr<TokenPreloadScanner> m_preloadScanner;
OwnPtr<TextResourceDecoder> m_decoder;
+ OwnPtr<blink::WebThreadedResourceProvider> m_resourceProvider;
DocumentEncodingData m_lastSeenEncodingData;
+ bool m_receivingDataOnlyFromResourceProvider;
+ RefPtr<SharedBuffer> m_queuedData;
};
}

Powered by Google App Engine
This is Rietveld 408576698