service worker: Wrap Register callback so it runs on destruction.
This is a short-term workaround to get a browser test passing when ServiceWorkerOnUI is enabled. When ServiceWorkerContextCore is destroyed (i.e., browser shut down or DeleteAndStartOver() is called), Mojo callbacks can be destroyed without being run, which causes Mojo to DCHECK. In the failing browser test (PendingAppManagerImplBrowserTest.InstallChromeURLFails) the callback for Register gets destroyed when ServiceWorkerJobCoordinator is destroyed and destroys the ServiceWorkerRegisterJob that owns the callback. This test failure happens for Register job on when ServiceWorkerOnUI is enabled, but it looks like this can happen for any Mojo callback that goes through ServiceWorkerContextCore regardless of that feature. Medium to longer term fixes are: - Make the ServiceWorkerProviderHosts destruct before ServiceWorkerJobCoordinator and other objects that can hold callbacks like ServiceWorkerStorage. The provider hosts hold the connections to the renderer, and dropping the connections allows the callbacks to be dropped without DCHECK. - However, that won't help the case of destruction due to DeleteAndStartOver, because currently the provider hosts and Mojo connections survive while the job coordinator and other objects are destroyed. We should drop Mojo connections on shutdown (see issue 877356). Bug: 1002776, 877356, 824858 Change-Id: I8d99e7c37eb51eda7ca2baf5f32be25e1c399b79 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1795645Reviewed-by:Kenichi Ishibashi <bashi@chromium.org> Commit-Queue: Matt Falkenhagen <falken@chromium.org> Auto-Submit: Matt Falkenhagen <falken@chromium.org> Cr-Commit-Position: refs/heads/master@{#695822}
Showing
Please register or sign in to comment