[DevTools] Properly notify devtools agent host when service worker is destroyed
ServiceWorkerDevToolsAgentHost now stores thread-safe reference to ServiceWorkerContextWrapper instead of ServiceWorkerContextCore that could be deleted asynchronously on the service worker core thread. WorkerDestroyed notification is now sent to the observers of ServiceWorkerDevToolsManager iff the worker version is both stopped and doomed. Each worker can be terminated (and restarted) multiple times and will result in a sequence of targetCrashed/targetReloadedAfterCrash events in the protocol but the instance of its ServiceWorkerDevToolsAgentHost will survive restarts and all connected sessions will be preserved. It fixes the events generated in the protocol for service workers from targetCreated, (detachedFromTarget, attachedToTarget, targetReloadedAfterCrash)* to targetCreated, (targetCrashed/targetReloadedAfterCrash)*, targetDestroyed and avoids inadvertent session terminations when workers are stopped and also spurious targetReloadedAfterCrash events. Bug: none Change-Id: I1125604d08b7842f7f8d74751091193b9af2cb59 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2099590 Commit-Queue: Yury Semikhatsky <yurys@chromium.org> Reviewed-by:Tsuyoshi Horo <horo@chromium.org> Reviewed-by:
Dmitry Gozman <dgozman@chromium.org> Cr-Commit-Position: refs/heads/master@{#750975}
Showing
Please register or sign in to comment