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

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

Issue 2299883006: [Worker] Call prepareForShutdown ASAP when terminated forcibly (Closed)
Patch Set: fix Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 545efcef7cff5891a8665a58356f24684504ed8b..f91807ed230e21a4e46fd0ffa8c231cc2524234a 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -128,7 +128,8 @@ public:
{
Microtask::performCheckpoint(m_workerThread->isolate());
if (WorkerOrWorkletGlobalScope* global = m_workerThread->globalScope()) {
- if (WorkerOrWorkletScriptController* scriptController = global->scriptController())
+ WorkerOrWorkletScriptController* scriptController = global->scriptController();
+ if (scriptController)
scriptController->getRejectedPromises()->processQueue();
if (global->isClosing()) {
// |m_workerThread| will eventually be requested to terminate.
@@ -136,6 +137,11 @@ public:
// Stop further worker tasks to run after this point.
m_workerThread->prepareForShutdownOnWorkerThread();
+ } else if (scriptController && scriptController->isExecutionTerminating()) {
+ // 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();
}
}
}
« no previous file with comments | « third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698