Commit c42c7bb9 authored by Minggang Wang's avatar Minggang Wang Committed by Commit Bot

Do not call Terminate() for the child threads explicitly when shutting

Currently, the worker thread calls the Terminate() of the child threads
during executing PrepareForShutdownOnWorkerThread().

This patch removes the explicit calling, because the nested workers are
observers of the terminating worker's worker global scope, the child
threads will get terminated when notified with ContextDestroyed().

Change-Id: I7b9fd424c5b954b31ff83b1027608e5e24c04bbd
Bug: 1104847
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2377580Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Commit-Queue: Minggang Wang <minggang.wang@intel.com>
Cr-Commit-Position: refs/heads/master@{#803361}
parent 874b217c
...@@ -748,14 +748,17 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() { ...@@ -748,14 +748,17 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() {
GetWorkerReportingProxy().WillDestroyWorkerGlobalScope(); GetWorkerReportingProxy().WillDestroyWorkerGlobalScope();
probe::AllAsyncTasksCanceled(GlobalScope()); probe::AllAsyncTasksCanceled(GlobalScope());
// This will eventually call the |child_threads_|'s Terminate() through
// ContextLifecycleObserver::ContextDestroyed(), because the nested workers
// are observer of the |GlobalScope()| (see the DedicatedWorker class) and
// they initiate thread termination on destruction of the parent context.
GlobalScope()->NotifyContextDestroyed(); GlobalScope()->NotifyContextDestroyed();
worker_scheduler_->Dispose(); worker_scheduler_->Dispose();
// No V8 microtasks should get executed after shutdown is requested. // No V8 microtasks should get executed after shutdown is requested.
GetWorkerBackingThread().BackingThread().RemoveTaskObserver(this); GetWorkerBackingThread().BackingThread().RemoveTaskObserver(this);
for (WorkerThread* child : child_threads_)
child->Terminate();
} }
void WorkerThread::PerformShutdownOnWorkerThread() { void WorkerThread::PerformShutdownOnWorkerThread() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment