Index: third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp |
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp |
index 769ddc7d8a8b247e32c135363c74006ff5354cb9..f13babd45a3a33cd9f3f7eb5ea2cc6a97224caca 100644 |
--- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp |
+++ b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp |
@@ -30,15 +30,16 @@ |
#include "core/workers/InProcessWorkerObjectProxy.h" |
+#include <memory> |
#include "bindings/core/v8/SerializedScriptValue.h" |
#include "bindings/core/v8/SourceLocation.h" |
#include "bindings/core/v8/V8GCController.h" |
#include "core/dom/Document.h" |
#include "core/dom/ExecutionContext.h" |
+#include "core/dom/TaskRunnerHelper.h" |
#include "core/events/MessageEvent.h" |
#include "core/inspector/ConsoleMessage.h" |
#include "core/workers/InProcessWorkerMessagingProxy.h" |
-#include "core/workers/ParentFrameTaskRunners.h" |
#include "core/workers/WorkerGlobalScope.h" |
#include "core/workers/WorkerThread.h" |
#include "platform/CrossThreadFunctional.h" |
@@ -46,7 +47,6 @@ |
#include "public/platform/Platform.h" |
#include "wtf/Functional.h" |
#include "wtf/PtrUtil.h" |
-#include <memory> |
namespace blink { |
@@ -54,11 +54,9 @@ const double kDefaultIntervalInSec = 1; |
const double kMaxIntervalInSec = 30; |
std::unique_ptr<InProcessWorkerObjectProxy> InProcessWorkerObjectProxy::create( |
- const WeakPtr<InProcessWorkerMessagingProxy>& messagingProxyWeakPtr, |
- ParentFrameTaskRunners* parentFrameTaskRunners) { |
+ const WeakPtr<InProcessWorkerMessagingProxy>& messagingProxyWeakPtr) { |
DCHECK(messagingProxyWeakPtr); |
- return WTF::wrapUnique(new InProcessWorkerObjectProxy( |
- messagingProxyWeakPtr, parentFrameTaskRunners)); |
+ return WTF::wrapUnique(new InProcessWorkerObjectProxy(messagingProxyWeakPtr)); |
} |
InProcessWorkerObjectProxy::~InProcessWorkerObjectProxy() {} |
@@ -66,8 +64,7 @@ InProcessWorkerObjectProxy::~InProcessWorkerObjectProxy() {} |
void InProcessWorkerObjectProxy::postMessageToWorkerObject( |
PassRefPtr<SerializedScriptValue> message, |
MessagePortChannelArray channels) { |
- getParentFrameTaskRunners() |
- ->get(TaskType::PostedMessage) |
+ FrameTaskRunnerHelper::get(TaskType::PostedMessage, m_workerGlobalScope.get()) |
->postTask(BLINK_FROM_HERE, |
crossThreadBind( |
&InProcessWorkerMessagingProxy::postMessageToWorkerObject, |
@@ -85,8 +82,7 @@ void InProcessWorkerObjectProxy::processMessageFromWorkerObject( |
MessagePort::entanglePorts(*globalScope, std::move(channels)); |
globalScope->dispatchEvent(MessageEvent::create(ports, std::move(message))); |
- getParentFrameTaskRunners() |
- ->get(TaskType::UnspecedTimer) |
+ FrameTaskRunnerHelper::get(TaskType::UnspecedTimer, globalScope) |
->postTask( |
BLINK_FROM_HERE, |
crossThreadBind( |
@@ -108,8 +104,7 @@ void InProcessWorkerObjectProxy::reportException( |
const String& errorMessage, |
std::unique_ptr<SourceLocation> location, |
int exceptionId) { |
- getParentFrameTaskRunners() |
- ->get(TaskType::UnspecedTimer) |
+ FrameTaskRunnerHelper::get(TaskType::UnspecedTimer, m_workerGlobalScope.get()) |
->postTask( |
BLINK_FROM_HERE, |
crossThreadBind(&InProcessWorkerMessagingProxy::dispatchErrorEvent, |
@@ -120,6 +115,7 @@ void InProcessWorkerObjectProxy::reportException( |
void InProcessWorkerObjectProxy::didCreateWorkerGlobalScope( |
WorkerOrWorkletGlobalScope* globalScope) { |
DCHECK(!m_workerGlobalScope); |
+ ThreadedObjectProxyBase::didCreateWorkerGlobalScope(globalScope); |
m_workerGlobalScope = toWorkerGlobalScope(globalScope); |
m_timer = WTF::makeUnique<TaskRunnerTimer<InProcessWorkerObjectProxy>>( |
Platform::current()->currentThread()->getWebTaskRunner(), this, |
@@ -136,10 +132,8 @@ void InProcessWorkerObjectProxy::willDestroyWorkerGlobalScope() { |
} |
InProcessWorkerObjectProxy::InProcessWorkerObjectProxy( |
- const WeakPtr<InProcessWorkerMessagingProxy>& messagingProxyWeakPtr, |
- ParentFrameTaskRunners* parentFrameTaskRunners) |
- : ThreadedObjectProxyBase(parentFrameTaskRunners), |
- m_messagingProxyWeakPtr(messagingProxyWeakPtr), |
+ const WeakPtr<InProcessWorkerMessagingProxy>& messagingProxyWeakPtr) |
+ : m_messagingProxyWeakPtr(messagingProxyWeakPtr), |
m_defaultIntervalInSec(kDefaultIntervalInSec), |
m_nextIntervalInSec(kDefaultIntervalInSec), |
m_maxIntervalInSec(kMaxIntervalInSec) {} |
@@ -161,8 +155,8 @@ void InProcessWorkerObjectProxy::checkPendingActivity(TimerBase*) { |
m_workerGlobalScope->thread()->isolate(), m_workerGlobalScope); |
if (!hasPendingActivity) { |
// Report all activities are done. |
- getParentFrameTaskRunners() |
- ->get(TaskType::UnspecedTimer) |
+ FrameTaskRunnerHelper::get(TaskType::UnspecedTimer, |
+ m_workerGlobalScope.get()) |
->postTask(BLINK_FROM_HERE, |
crossThreadBind( |
&InProcessWorkerMessagingProxy::pendingActivityFinished, |