Avoid touching ResourceRequestDetectorClient's ref count before it's fully constructed
The first reference to ResourceRequestDetectorClient instance used to be made by base::Bind in its constructor, and posted to another thread. If the PostTask call failed, or the posted task ran immediately after the other thread, the RRDC instance may destroyed before the construction is completed. Though this does not actually causes a crash, as no one use the result of `new ResourceRequestDetectorClient`, this hits an assertion that being added as a false positive case. This CL adds ResourceRequestDetectorClient::Start, and makes the constructor private to ensure no one touches the fragile way. Also, this converts legacy base::Callback to base::OnceCallback, as a drive-by. Bug: 866456 Change-Id: Ifb3d8136f03e2e233cf4b0b2b0ee070db6b3093d Reviewed-on: https://chromium-review.googlesource.com/1149779Reviewed-by:Jialiu Lin <jialiul@chromium.org> Commit-Queue: Taiju Tsuiki <tzik@chromium.org> Cr-Commit-Position: refs/heads/master@{#577961}
Showing
Please register or sign in to comment