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

Unified Diff: third_party/WebKit/Source/core/workers/WorkerThread.cpp

Issue 2716853002: (WIP) Worker: Merge ParentFrameTaskRunners into TaskRunnerHelper
Patch Set: WIP Created 3 years, 10 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/workers/WorkerThread.cpp
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.cpp b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
index 4401616c834082d49ee317be279be78917a56e13..59b921c0ccbe635b2af1bb50dd1182c2ee5467c8 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -26,9 +26,12 @@
#include "core/workers/WorkerThread.h"
+#include <limits.h>
+#include <memory>
#include "bindings/core/v8/Microtask.h"
#include "bindings/core/v8/ScriptSourceCode.h"
#include "bindings/core/v8/WorkerOrWorkletScriptController.h"
+#include "core/dom/TaskRunnerHelper.h"
#include "core/inspector/ConsoleMessageStorage.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/InspectorTaskRunner.h"
@@ -53,8 +56,6 @@
#include "wtf/PtrUtil.h"
#include "wtf/Threading.h"
#include "wtf/text/WTFString.h"
-#include <limits.h>
-#include <memory>
namespace blink {
@@ -105,18 +106,20 @@ WorkerThread::~WorkerThread() {
}
void WorkerThread::start(std::unique_ptr<WorkerThreadStartupData> startupData,
- ParentFrameTaskRunners* parentFrameTaskRunners) {
+ FrameTaskRunnersHolder* frameTaskRunners) {
DCHECK(isMainThread());
if (m_requestedToStart)
return;
m_requestedToStart = true;
- m_parentFrameTaskRunners = parentFrameTaskRunners;
+ m_frameTaskRunners = frameTaskRunners;
workerBackingThread().backingThread().postTask(
- BLINK_FROM_HERE, crossThreadBind(&WorkerThread::initializeOnWorkerThread,
- crossThreadUnretained(this),
- WTF::passed(std::move(startupData))));
+ BLINK_FROM_HERE,
+ crossThreadBind(&WorkerThread::initializeOnWorkerThread,
+ crossThreadUnretained(this),
+ WTF::passed(std::move(startupData)),
+ wrapCrossThreadPersistent(frameTaskRunners)));
}
void WorkerThread::terminate() {
@@ -341,7 +344,7 @@ void WorkerThread::terminateInternal(TerminationMode mode) {
case TerminationMode::Graceful:
DCHECK(!m_forcibleTerminationTaskHandle.isActive());
m_forcibleTerminationTaskHandle =
- m_parentFrameTaskRunners->get(TaskType::UnspecedTimer)
+ m_frameTaskRunners->get(TaskType::UnspecedTimer)
->postDelayedCancellableTask(
BLINK_FROM_HERE,
WTF::bind(&WorkerThread::mayForciblyTerminateExecution,
@@ -430,7 +433,8 @@ bool WorkerThread::isInShutdown() {
}
void WorkerThread::initializeOnWorkerThread(
- std::unique_ptr<WorkerThreadStartupData> startupData) {
+ std::unique_ptr<WorkerThreadStartupData> startupData,
+ FrameTaskRunnersHolder* frameTaskRunners) {
DCHECK(isCurrentThread());
DCHECK_EQ(ThreadState::NotStarted, m_threadState);
@@ -461,6 +465,7 @@ void WorkerThread::initializeOnWorkerThread(
m_consoleMessageStorage = new ConsoleMessageStorage();
m_globalScope = createWorkerGlobalScope(std::move(startupData));
+ FrameTaskRunnerHelper::setTaskRunners(globalScope(), frameTaskRunners);
m_workerReportingProxy.didCreateWorkerGlobalScope(globalScope());
m_workerInspectorController = WorkerInspectorController::create(this);
« no previous file with comments | « third_party/WebKit/Source/core/workers/WorkerThread.h ('k') | third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698