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 8966c10d921b29417784fb9969cec339b30ca480..561d7c477deb403346534c0ea2f319bd17e146e2 100644 |
--- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp |
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp |
@@ -174,12 +174,6 @@ void WorkerThread::WillProcessTask() { |
// No tasks should get executed after we have closed. |
DCHECK(!GlobalScope()->IsClosing()); |
- |
- if (IsForciblyTerminated()) { |
- // The script has been terminated forcibly, which means we need to |
- // ask objects in the thread to stop working as soon as possible. |
- PrepareForShutdownOnWorkerThread(); |
- } |
} |
void WorkerThread::DidProcessTask() { |
@@ -192,6 +186,10 @@ void WorkerThread::DidProcessTask() { |
// Stop further worker tasks to run after this point. |
PrepareForShutdownOnWorkerThread(); |
+ } else if (IsForciblyTerminated()) { |
+ // The script has been terminated forcibly, which means we need to |
+ // ask objects in the thread to stop working as soon as possible. |
+ PrepareForShutdownOnWorkerThread(); |
} |
} |