Index: Source/core/html/parser/HTMLDocumentParser.cpp |
diff --git a/Source/core/html/parser/HTMLDocumentParser.cpp b/Source/core/html/parser/HTMLDocumentParser.cpp |
index 5e89dc7c97a5cbb5cd0efdcf1bac319f77b55eb2..f2d863d4adb9bcd08937d37e84eaa7c5a68a3a1e 100644 |
--- a/Source/core/html/parser/HTMLDocumentParser.cpp |
+++ b/Source/core/html/parser/HTMLDocumentParser.cpp |
@@ -75,10 +75,11 @@ static HTMLTokenizer::State tokenizerStateForContextElement(Element* contextElem |
return HTMLTokenizer::DataState; |
} |
-class ParserDataReceiver : public blink::WebThreadedDataReceiver { |
+class ParserDataReceiver : public WebThreadedDataReceiver { |
public: |
- explicit ParserDataReceiver(WeakPtr<BackgroundHTMLParser> backgroundParser) |
+ explicit ParserDataReceiver(WeakPtr<BackgroundHTMLParser> backgroundParser, WeakPtrWillBeRawPtr<Document> document) |
: m_backgroundParser(backgroundParser) |
+ , m_document(document) |
{ |
} |
@@ -98,8 +99,17 @@ public: |
return nullptr; |
} |
+ virtual bool needsMainthreadDataCopy() override final { return InspectorInstrumentation::hasFrontends(); } |
+ virtual void acceptMainthreadDataNotification(const char* data, int dataLength, int encodedDataLength) override final |
+ { |
kouhei (in TOK)
2014/11/18 04:49:55
please add ASSERT(isMainThread());
|
+ ASSERT(!data || m_needMainthreadDataCopy); |
+ if (m_document.get()) |
+ m_document.get()->loader()->acceptDataFromThreadedReceiver(data, dataLength, encodedDataLength); |
+ } |
+ |
private: |
WeakPtr<BackgroundHTMLParser> m_backgroundParser; |
+ WeakPtrWillBeRawPtr<Document> m_document; |
kouhei (in TOK)
2014/11/18 04:49:55
This would not work on Oilpan, as RawPtr is not nu
haraken
2014/11/18 04:57:27
Can't this simply be a RefPtr?
In the first place
|
}; |
HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, bool reportErrors) |
@@ -722,7 +732,7 @@ void HTMLDocumentParser::startBackgroundParser() |
// TODO(oysteine): Disabled due to crbug.com/398076 until a full fix can be implemented. |
if (RuntimeEnabledFeatures::threadedParserDataReceiverEnabled()) { |
kouhei (in TOK)
2014/11/18 04:49:55
I think this is still marked as experimental and n
oystein (OOO til 10th of July)
2014/11/20 23:24:57
Yes, I put it behind the flag when we discovered t
|
if (DocumentLoader* loader = document()->loader()) |
- loader->attachThreadedDataReceiver(adoptPtr(new ParserDataReceiver(m_backgroundParser))); |
+ loader->attachThreadedDataReceiver(adoptPtr(new ParserDataReceiver(m_backgroundParser, document()->contextDocument()))); |
} |
OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new BackgroundHTMLParser::Configuration); |