| 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 338d02a9bc37ebd308355fd70a8c0656abfb183f..6bb5deb6d5ee6a9ced34d80a235c0c00bad84683 100644
|
| --- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
|
| +++ b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
|
| @@ -36,6 +36,7 @@
|
| #include "core/dom/Document.h"
|
| #include "core/dom/ExecutionContext.h"
|
| #include "core/dom/ExecutionContextTask.h"
|
| +#include "core/events/MessageEvent.h"
|
| #include "core/inspector/ConsoleMessage.h"
|
| #include "core/workers/InProcessWorkerMessagingProxy.h"
|
| #include "core/workers/ParentFrameTaskRunners.h"
|
| @@ -74,7 +75,16 @@ void InProcessWorkerObjectProxy::postMessageToWorkerObject(
|
| WTF::passed(std::move(channels))));
|
| }
|
|
|
| -void InProcessWorkerObjectProxy::confirmMessageFromWorkerObject() {
|
| +void InProcessWorkerObjectProxy::processMessageFromWorkerObject(
|
| + PassRefPtr<SerializedScriptValue> message,
|
| + std::unique_ptr<MessagePortChannelArray> channels,
|
| + WorkerThread* workerThread) {
|
| + WorkerGlobalScope* globalScope =
|
| + toWorkerGlobalScope(workerThread->globalScope());
|
| + MessagePortArray* ports =
|
| + MessagePort::entanglePorts(*globalScope, std::move(channels));
|
| + globalScope->dispatchEvent(MessageEvent::create(ports, std::move(message)));
|
| +
|
| getParentFrameTaskRunners()
|
| ->get(TaskType::UnspecedTimer)
|
| ->postTask(
|
| @@ -82,18 +92,16 @@ void InProcessWorkerObjectProxy::confirmMessageFromWorkerObject() {
|
| crossThreadBind(
|
| &InProcessWorkerMessagingProxy::confirmMessageFromWorkerObject,
|
| m_messagingProxyWeakPtr));
|
| +
|
| + startPendingActivityTimer();
|
| }
|
|
|
| -void InProcessWorkerObjectProxy::startPendingActivityTimer() {
|
| - if (m_timer->isActive()) {
|
| - // Reset the next interval duration to check new activity state timely.
|
| - // For example, a long-running activity can be cancelled by a message
|
| - // event.
|
| - m_nextIntervalInSec = kDefaultIntervalInSec;
|
| - return;
|
| - }
|
| - m_timer->startOneShot(m_nextIntervalInSec, BLINK_FROM_HERE);
|
| - m_nextIntervalInSec = std::min(m_nextIntervalInSec * 1.5, m_maxIntervalInSec);
|
| +void InProcessWorkerObjectProxy::processUnhandledException(
|
| + int exceptionId,
|
| + WorkerThread* workerThread) {
|
| + WorkerGlobalScope* globalScope =
|
| + toWorkerGlobalScope(workerThread->globalScope());
|
| + globalScope->exceptionUnhandled(exceptionId);
|
| }
|
|
|
| void InProcessWorkerObjectProxy::reportException(
|
| @@ -135,6 +143,18 @@ InProcessWorkerObjectProxy::InProcessWorkerObjectProxy(
|
| m_nextIntervalInSec(kDefaultIntervalInSec),
|
| m_maxIntervalInSec(kMaxIntervalInSec) {}
|
|
|
| +void InProcessWorkerObjectProxy::startPendingActivityTimer() {
|
| + if (m_timer->isActive()) {
|
| + // Reset the next interval duration to check new activity state timely.
|
| + // For example, a long-running activity can be cancelled by a message
|
| + // event.
|
| + m_nextIntervalInSec = kDefaultIntervalInSec;
|
| + return;
|
| + }
|
| + m_timer->startOneShot(m_nextIntervalInSec, BLINK_FROM_HERE);
|
| + m_nextIntervalInSec = std::min(m_nextIntervalInSec * 1.5, m_maxIntervalInSec);
|
| +}
|
| +
|
| void InProcessWorkerObjectProxy::checkPendingActivity(TimerBase*) {
|
| bool hasPendingActivity = V8GCController::hasPendingActivity(
|
| m_workerGlobalScope->thread()->isolate(), m_workerGlobalScope);
|
|
|