| 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 41fe1666b95bc4b781c78baddca1784ce08179f0..d4211b68570e79c4107dbd0788b5ecf48ce9a955 100644
|
| --- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp
|
| +++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
|
| @@ -121,28 +121,26 @@ public:
|
| void willProcessTask() override
|
| {
|
| // No tasks should get executed after we have closed.
|
| - DCHECK(!m_workerThread->globalScope() || !m_workerThread->globalScope()->isClosing());
|
| + DCHECK(!m_workerThread->globalScope()->isClosing());
|
| +
|
| + if (m_workerThread->isForciblyTerminated()) {
|
| + // The script has been terminated forcibly, which means we need to
|
| + // ask objects in the thread to stop working as soon as possible.
|
| + m_workerThread->prepareForShutdownOnWorkerThread();
|
| + }
|
| }
|
|
|
| void didProcessTask() override
|
| {
|
| Microtask::performCheckpoint(m_workerThread->isolate());
|
| - if (WorkerOrWorkletGlobalScope* global = m_workerThread->globalScope()) {
|
| - WorkerOrWorkletScriptController* scriptController = global->scriptController();
|
| - if (scriptController)
|
| - scriptController->getRejectedPromises()->processQueue();
|
| - if (global->isClosing()) {
|
| - // |m_workerThread| will eventually be requested to terminate.
|
| - m_workerThread->workerReportingProxy().didCloseWorkerGlobalScope();
|
| -
|
| - // Stop further worker tasks to run after this point.
|
| - m_workerThread->prepareForShutdownOnWorkerThread();
|
| - } else if (m_workerThread->isForciblyTerminated()) {
|
| - // The script has been terminated forcibly, which means we need
|
| - // to ask objects in the thread to stop working as soon as
|
| - // possible.
|
| - m_workerThread->prepareForShutdownOnWorkerThread();
|
| - }
|
| + WorkerOrWorkletGlobalScope* globalScope = m_workerThread->globalScope();
|
| + globalScope->scriptController()->getRejectedPromises()->processQueue();
|
| + if (globalScope->isClosing()) {
|
| + // |m_workerThread| will eventually be requested to terminate.
|
| + m_workerThread->workerReportingProxy().didCloseWorkerGlobalScope();
|
| +
|
| + // Stop further worker tasks to run after this point.
|
| + m_workerThread->prepareForShutdownOnWorkerThread();
|
| }
|
| }
|
|
|
|
|