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

Unified Diff: third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.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/BackgroundHTMLParser.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
index 3589b67de86f5fe7344beabcc004ee2afb007aaa..3e924820281de706aa1404fa1fd38d3fd630b3ed 100644
--- a/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp
@@ -33,7 +33,7 @@
#include "platform/Task.h"
#include "platform/ThreadSafeFunctional.h"
#include "public/platform/Platform.h"
-#include "public/platform/WebScheduler.h"
+#include "public/platform/WebTaskRunner.h"
#include "wtf/text/TextPosition.h"
namespace blink {
@@ -81,9 +81,9 @@ static void checkThatXSSInfosAreSafeToSendToAnotherThread(const XSSInfoStream& i
#endif
-void BackgroundHTMLParser::start(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, WebScheduler* scheduler)
+void BackgroundHTMLParser::start(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, WebTaskRunner* loadingTaskRunner)
{
- new BackgroundHTMLParser(reference, config, scheduler);
+ new BackgroundHTMLParser(reference, config, loadingTaskRunner);
// Caller must free by calling stop().
}
@@ -93,7 +93,7 @@ BackgroundHTMLParser::Configuration::Configuration()
{
}
-BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, WebScheduler* scheduler)
+BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHTMLParser>> reference, PassOwnPtr<Configuration> config, WebTaskRunner* loadingTaskRunner)
: m_weakFactory(reference, this)
, m_token(adoptPtr(new HTMLToken))
, m_tokenizer(HTMLTokenizer::create(config->options))
@@ -106,7 +106,7 @@ BackgroundHTMLParser::BackgroundHTMLParser(PassRefPtr<WeakReference<BackgroundHT
, m_xssAuditor(config->xssAuditor.release())
, m_preloadScanner(config->preloadScanner.release())
, m_decoder(config->decoder.release())
- , m_scheduler(scheduler)
+ , m_loadingTaskRunner(adoptPtr(loadingTaskRunner->clone()))
, m_startingScript(false)
{
ASSERT(m_outstandingTokenLimit > 0);
@@ -157,7 +157,7 @@ void BackgroundHTMLParser::updateDocument(const String& decodedData)
m_lastSeenEncodingData = encodingData;
m_xssAuditor->setEncoding(encodingData.encoding());
- m_scheduler->loadingTaskRunner()->postTask(
+ m_loadingTaskRunner->postTask(
FROM_HERE,
threadSafeBind(&HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser, AllowCrossThreadAccess(m_parser), encodingData));
}
@@ -291,7 +291,7 @@ void BackgroundHTMLParser::sendTokensToMainThread()
chunk->startingScript = m_startingScript;
m_startingScript = false;
- m_scheduler->loadingTaskRunner()->postTask(
+ m_loadingTaskRunner->postTask(
FROM_HERE,
new Task(threadSafeBind(&HTMLDocumentParser::didReceiveParsedChunkFromBackgroundParser, AllowCrossThreadAccess(m_parser), chunk.release())));

Powered by Google App Engine
This is Rietveld 408576698