Ensure NavigationHandle outlives NavigationURLLoader.
NavigationURLLoaderImpl holds raw pointers to objects owned by NavigationHandleImpl, namely AppCacheNavigationHandle. Therefore the handle should outlive the loader. If the handle is destroyed before the loader the following sequence can happen: 1. (UI) |navigation_handle_| is destroyed. This destroys |appcache_handle_| which posts a task to the IO thread to destroy |appcache_handle_->core_|. 2. (Background thread) Another thread (e.g., ServiceWorkerDatabase) posts a task to the IO thread that results in |request_controller_| being called. 3. (UI) |loader_| is destroyed. This posts a task to the IO thread to destroy |request_controller_|. 4. (IO) |appcache_handle_->core_| is destroyed. 5. (IO) The task from 2. runs, and accesses the raw pointer to appcache_handle_->core. No test added because I don't see a good way to test this. Bug: 857005 Change-Id: I7c44312a2072836f53475559ddfe9ca1fdc8e18a Reviewed-on: https://chromium-review.googlesource.com/1132715Reviewed-by:Kinuko Yasuda <kinuko@chromium.org> Commit-Queue: Matt Falkenhagen <falken@chromium.org> Cr-Commit-Position: refs/heads/master@{#574110}
Showing
Please register or sign in to comment