Fix ResourceDispatcherHostImpl to InvalidateWeakPtrs() on IO thread.
ResourceDispatcherHostImpl is a UI-thread-owned class which also does work on the IO thread. It is built to intrinsically rely on being destroyed only after all threads but the main thread have been torn- down - the BrowserMainLoop invokes a Shutdown() API which posts a task to perform teardown of state which is used on the IO thread, which is thereby guaranteed to have run before the object is deleted. Internally a WeakPtrFactory is also used, to ensure that replies posted to the object on the IO thread are dropped if the object has already performed its IO-thread teardown. However, although the WeakPtrs were bound to tasks run on the IO thread, the factory itself was being left to implicitly InvalidateWeakPtrs() on destruction (i.e. on the UI thread). This CL adds explicit InvalidateWeakPtrs() on the IO thread, during the IO-thread teardown task. Bug: 729716 Change-Id: Idce31d52476df529dd5a877dc06747426c4e19c6 Reviewed-on: https://chromium-review.googlesource.com/1056255 Commit-Queue: Wez <wez@chromium.org> Reviewed-by:Charlie Harrison <csharrison@chromium.org> Reviewed-by:
Matt Menke <mmenke@chromium.org> Cr-Commit-Position: refs/heads/master@{#558332}
Showing
Please register or sign in to comment