Allow PaymentAppContextImpl destruction after ShutdownOnIO.
Today, PaymentAppContext::Shutdown() is called from ~StoragePartitionImpl() after the UI thread is done running tasks and before the IO thread is done running tasks. ShutdownOnIO() is successfully posted to the IO thread. After it runs, it tries to send the DidShutdown() reply to the UI thread, which fails. Because of how PostTaskAndReply is implemented, the PaymentAppContext is leaked (cf. https://cs.chromium.org/chromium/src/base/threading/post_task_and_reply_impl.cc?l=89&rcl=0fe5265959e1da13c1521fd7f5f6275a3b83c614). We now want to change PostTaskAndReply() to avoid leaking the reply callback and its arguments when the reply thread can't run tasks. To make that possible, we need to change the DCHECK in ~PaymentAppContextImpl() so that it only fails if ShutdownOnIO() didn't run, not if DidShutdown() didn't run. Bug: 807013 Change-Id: Ie893c70d423fed7c617cec31f01dfe1763501913 Reviewed-on: https://chromium-review.googlesource.com/929592Reviewed-by:Rouslan Solomakhin <rouslan@chromium.org> Commit-Queue: François Doray <fdoray@chromium.org> Cr-Commit-Position: refs/heads/master@{#538853}
Showing
Please register or sign in to comment