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

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

Issue 690793003: Threaded data provider: Support main thread data notifications (Blink side) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Directly call InspectorInstrumentation::hasFrontends Created 6 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
« no previous file with comments | « Source/core/fetch/ResourceLoader.h ('k') | Source/core/loader/DocumentLoader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « Source/core/fetch/ResourceLoader.h ('k') | Source/core/loader/DocumentLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698