Chromium Code Reviews| Index: Source/core/html/parser/HTMLDocumentParser.cpp |
| diff --git a/Source/core/html/parser/HTMLDocumentParser.cpp b/Source/core/html/parser/HTMLDocumentParser.cpp |
| index 9f9c44dbbffa480ec5f94314793f8f0bfcdf0140..a22d315905e61f384a97991541ad0154ecf00af6 100644 |
| --- a/Source/core/html/parser/HTMLDocumentParser.cpp |
| +++ b/Source/core/html/parser/HTMLDocumentParser.cpp |
| @@ -29,6 +29,7 @@ |
| #include "core/HTMLNames.h" |
| #include "core/css/MediaValuesCached.h" |
| #include "core/dom/DocumentFragment.h" |
| +#include "core/dom/DocumentLifecycleNotifier.h" |
|
haraken
2015/01/16 04:58:36
DocumentLifecycleNotifier.h => DocumentLifecycleOb
oystein (OOO til 10th of July)
2015/01/16 05:04:37
Done.
|
| #include "core/dom/Element.h" |
| #include "core/frame/LocalFrame.h" |
| #include "core/html/HTMLDocument.h" |
| @@ -76,10 +77,11 @@ static HTMLTokenizer::State tokenizerStateForContextElement(Element* contextElem |
| return HTMLTokenizer::DataState; |
| } |
| -class ParserDataReceiver : public blink::WebThreadedDataReceiver { |
| +class ParserDataReceiver : public WebThreadedDataReceiver, public DocumentLifecycleObserver { |
| public: |
| - explicit ParserDataReceiver(WeakPtr<BackgroundHTMLParser> backgroundParser) |
| - : m_backgroundParser(backgroundParser) |
| + explicit ParserDataReceiver(WeakPtr<BackgroundHTMLParser> backgroundParser, Document* document) |
| + : DocumentLifecycleObserver(document) |
| + , m_backgroundParser(backgroundParser) |
| { |
| } |
| @@ -99,6 +101,14 @@ public: |
| return nullptr; |
| } |
| + virtual bool needsMainthreadDataCopy() override final { return InspectorInstrumentation::hasFrontends(); } |
| + virtual void acceptMainthreadDataNotification(const char* data, int dataLength, int encodedDataLength) override final |
| + { |
| + ASSERT(!data || needsMainthreadDataCopy()); |
| + if (lifecycleContext()) |
| + lifecycleContext()->loader()->acceptDataFromThreadedReceiver(data, dataLength, encodedDataLength); |
| + } |
| + |
| private: |
| WeakPtr<BackgroundHTMLParser> m_backgroundParser; |
| }; |
| @@ -729,7 +739,7 @@ void HTMLDocumentParser::startBackgroundParser() |
| // TODO(oysteine): Disabled due to crbug.com/398076 until a full fix can be implemented. |
|
haraken
2015/01/16 04:58:36
TODO => FIXME
oystein (OOO til 10th of July)
2015/01/16 05:04:37
Done.
|
| if (RuntimeEnabledFeatures::threadedParserDataReceiverEnabled()) { |
| if (DocumentLoader* loader = document()->loader()) |
| - loader->attachThreadedDataReceiver(adoptPtr(new ParserDataReceiver(m_backgroundParser))); |
| + loader->attachThreadedDataReceiver(adoptPtr(new ParserDataReceiver(m_backgroundParser, document()->contextDocument().get()))); |
| } |
| OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new BackgroundHTMLParser::Configuration); |