| Index: third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
|
| diff --git a/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
|
| index 37f2e08f16088c438267b87ece19ea43cb29c7e8..72a392bf68b6a546d000c1fe676cf0f15d889c14 100644
|
| --- a/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
|
| +++ b/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
|
| @@ -4,14 +4,12 @@
|
|
|
| #include "core/workers/ThreadedWorkletObjectProxy.h"
|
|
|
| -#include "bindings/core/v8/SerializedScriptValue.h"
|
| -#include "bindings/core/v8/SourceLocation.h"
|
| -#include "core/dom/Document.h"
|
| #include "core/dom/ExecutionContext.h"
|
| -#include "core/dom/ExecutionContextTask.h"
|
| #include "core/inspector/ConsoleMessage.h"
|
| #include "core/workers/ParentFrameTaskRunners.h"
|
| #include "core/workers/ThreadedWorkletMessagingProxy.h"
|
| +#include "platform/CrossThreadFunctional.h"
|
| +#include "platform/WebTaskRunner.h"
|
| #include "wtf/Functional.h"
|
| #include "wtf/PtrUtil.h"
|
| #include <memory>
|
| @@ -33,18 +31,18 @@ void ThreadedWorkletObjectProxy::reportConsoleMessage(
|
| MessageLevel level,
|
| const String& message,
|
| SourceLocation* location) {
|
| - // TODO(nhiroki): Replace this with getParentFrameTaskRunners().
|
| - // (https://crbug.com/667310)
|
| - getExecutionContext()->postTask(
|
| - BLINK_FROM_HERE, createCrossThreadTask(
|
| - &ThreadedWorkletMessagingProxy::reportConsoleMessage,
|
| - m_messagingProxyWeakPtr, source, level, message,
|
| - passed(location->clone())));
|
| + getParentFrameTaskRunners()
|
| + ->get(TaskType::Internal)
|
| + ->postTask(
|
| + BLINK_FROM_HERE,
|
| + crossThreadBind(&ThreadedWorkletMessagingProxy::reportConsoleMessage,
|
| + m_messagingProxyWeakPtr, source, level, message,
|
| + passed(location->clone())));
|
| }
|
|
|
| void ThreadedWorkletObjectProxy::postMessageToPageInspector(
|
| const String& message) {
|
| - DCHECK(getExecutionContext()->isDocument());
|
| + DCHECK(m_messagingProxyWeakPtr->getExecutionContext()->isDocument());
|
| // The TaskType of Inspector tasks need to be Unthrottled because they need to
|
| // run even on a suspended page.
|
| getParentFrameTaskRunners()
|
| @@ -61,31 +59,26 @@ ThreadedWorkletObjectProxy::getParentFrameTaskRunners() {
|
| }
|
|
|
| void ThreadedWorkletObjectProxy::didCloseWorkerGlobalScope() {
|
| - // TODO(nhiroki): Replace this with getParentFrameTaskRunners().
|
| - // (https://crbug.com/667310)
|
| - getExecutionContext()->postTask(
|
| - BLINK_FROM_HERE, createCrossThreadTask(
|
| - &ThreadedWorkletMessagingProxy::terminateGlobalScope,
|
| - m_messagingProxyWeakPtr));
|
| + getParentFrameTaskRunners()
|
| + ->get(TaskType::Internal)
|
| + ->postTask(
|
| + BLINK_FROM_HERE,
|
| + crossThreadBind(&ThreadedWorkletMessagingProxy::terminateGlobalScope,
|
| + m_messagingProxyWeakPtr));
|
| }
|
|
|
| void ThreadedWorkletObjectProxy::didTerminateWorkerThread() {
|
| // This will terminate the MessagingProxy.
|
| - // TODO(nhiroki): Replace this with getParentFrameTaskRunners().
|
| - // (https://crbug.com/667310)
|
| - getExecutionContext()->postTask(
|
| - BLINK_FROM_HERE,
|
| - createCrossThreadTask(
|
| - &ThreadedWorkletMessagingProxy::workerThreadTerminated,
|
| - m_messagingProxyWeakPtr));
|
| + getParentFrameTaskRunners()
|
| + ->get(TaskType::Internal)
|
| + ->postTask(BLINK_FROM_HERE,
|
| + crossThreadBind(
|
| + &ThreadedWorkletMessagingProxy::workerThreadTerminated,
|
| + m_messagingProxyWeakPtr));
|
| }
|
|
|
| ThreadedWorkletObjectProxy::ThreadedWorkletObjectProxy(
|
| const WeakPtr<ThreadedWorkletMessagingProxy>& messagingProxyWeakPtr)
|
| : m_messagingProxyWeakPtr(messagingProxyWeakPtr) {}
|
|
|
| -ExecutionContext* ThreadedWorkletObjectProxy::getExecutionContext() const {
|
| - return m_messagingProxyWeakPtr->getExecutionContext();
|
| -}
|
| -
|
| } // namespace blink
|
|
|