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

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

Issue 1366883002: [Reland] Post loading tasks on the appropriate WebFrameScheduler's queue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix UAF in BackgroundHTMLParser Created 5 years, 2 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: third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
index 070fd43924a08a505c108ad8e510c3443f218e3c..07a2709e9f6845bc9e6ef3e5f889befd8e830cdd 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -50,6 +50,7 @@
#include "platform/TraceEvent.h"
#include "platform/heap/Handle.h"
#include "public/platform/Platform.h"
+#include "public/platform/WebFrameScheduler.h"
#include "public/platform/WebScheduler.h"
#include "public/platform/WebThread.h"
#include "wtf/RefCounted.h"
@@ -143,7 +144,8 @@ HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, bool reportErrors
, m_tokenizer(syncPolicy == ForceSynchronousParsing ? HTMLTokenizer::create(m_options) : nullptr)
, m_scriptRunner(HTMLScriptRunner::create(&document, this))
, m_treeBuilder(HTMLTreeBuilder::create(this, &document, parserContentPolicy(), reportErrors, m_options))
- , m_parserScheduler(HTMLParserScheduler::create(this))
+ , m_loadingTaskRunner(adoptPtr(document.loadingTaskRunner()->clone()))
+ , m_parserScheduler(HTMLParserScheduler::create(this, m_loadingTaskRunner.get()))
, m_xssAuditorDelegate(&document)
, m_weakFactory(this)
, m_preloader(HTMLResourcePreloader::create(document))
@@ -166,6 +168,7 @@ HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, Element* cont
, m_token(adoptPtr(new HTMLToken))
, m_tokenizer(HTMLTokenizer::create(m_options))
, m_treeBuilder(HTMLTreeBuilder::create(this, fragment, contextElement, this->parserContentPolicy(), m_options))
+ , m_loadingTaskRunner(adoptPtr(fragment->document().loadingTaskRunner()->clone()))
, m_xssAuditorDelegate(&fragment->document())
, m_weakFactory(this)
, m_shouldUseThreading(false)
@@ -801,7 +804,7 @@ void HTMLDocumentParser::startBackgroundParser()
ASSERT(config->xssAuditor->isSafeToSendToAnotherThread());
ASSERT(config->preloadScanner->isSafeToSendToAnotherThread());
HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParser::start, reference.release(), config.release(),
- AllowCrossThreadAccess(Platform::current()->currentThread()->scheduler())));
+ AllowCrossThreadAccess(m_loadingTaskRunner.get())));
}
void HTMLDocumentParser::stopBackgroundParser()

Powered by Google App Engine
This is Rietveld 408576698