Delay subframe process shutdown to allow subframe unload handlers to execute.

Currently, if a page with an OOPIF navigates cross-process, we
immediately destroy the OOPIF's RenderFrameHost when its parent
commits (see FrameTreeNode::ResetForNewProcess()).  The RFH
destruction triggers a message to the renderer to delete the
RenderFrame, which also causes it to run its unload handler.  However,
if the subframe was the last active frame in its process, the process
will proceed to shut down without waiting for the unload handler to
run at all, and in such a case, the subframe unload handler won't
really be able to do anything, including termination pings.

This CL fixes this by delaying subframe process shutdown in such
situations by one second (which matches the existing unload timeout
that we use for pending delete RenderFrameHosts).

Bug: 852204, 609963
Change-Id: I142ef4e6f59df465c6ed213df02daf492e989c2d
Reviewed-on: https://chromium-review.googlesource.com/1094917
Reviewed-by: Steven Holte <holte@chromium.org>
Reviewed-by: Ɓukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567395}
7 files changed