ServiceWorker: Make start worker sequence cancelable
Before this patch, there is no way to gracefully cancel the start sequence when the worker is requested to stop. Therefore, both start and stop sequences can be interleaved. To be more specific, process allocation information can be left in ServiceWorkerProcessManager even after the start sequence is canceled, and the process manager sometimes behaves strangely when attempting to restart the worker. This patch provides a way to cancel the start sequence. <Details of this patch> Roughly speaking, the start sequence consists of two phases: (1) process allocation involving thread hops, and (2) IPC messaging between the browser process and a worker process. We need to make it cancelable in either phase. To achieve that, this patch introduces... * StartTask that is a cancelable task to allocate a worker process and to send a start worker message. * WorkerProcessHandle that is a handle for a worker process managed by ServiceWorkerProcessManager. Its dtor makes sure to release a process. The handle is created by StartTask when a process is allocated, and then passed to EmbeddedWorkerInstance. When the start sequence is aborted during the phase (1), StartTask releases a process on its dtor. When the start sequence is aborted during the phase (2), EmbeddedWorkerInstance releases the process by destroying the process handle. BUG=568915,568465 Review URL: https://codereview.chromium.org/1569773002 Cr-Commit-Position: refs/heads/master@{#369387}
Showing
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment