Worker: Stop disposing of the global scope scheduler in WorkerThread::WillProcessTask()
When forcible termination is requested, WorkerThread::WillProcessTask() calls PrepareForShutdownOnWorkerThread() that disposes of the global scope scheduler, which in turn disposes of the task to be run. This results in crashes. This CL moves PrepareForShutdownOnWorkerThread() call from WillProcessTask() to DidProcessTask() to fix the crashes. This could still cause a crash if the termination request is issued between DidProcessTask() and WillProcessTask() because in the case a task runs and may access an empty handle returned by V8 API. However, such a case would be rare because generally forcible termination is scheduled as a delayed task(*) and DidProcessTask() can have a chance to check IsForciblyTerminated() before it's fired. (*) Forcible termination could synchronously be called in some path, but it'll be removed (see issue 641846). BUG=713914 Review-Url: https://codereview.chromium.org/2849583004 Cr-Commit-Position: refs/heads/master@{#468001}
Showing
Please register or sign in to comment