Handle race of SwapIn() and browser destroying the speculative MainFrame

When WebContentsImpl destroys, it deletes the speculative main frame,
but the renderer may have taken ownership of it already, and the notice
of such action is in flight to the browser still. This leads to DCHECKs
failing in the renderer. So inform the FrameMsg_Delete IPC what the
intention of the browser is, there are 3 modes:

- Deleting a non-main frame. This is the common case. These frames are
all owned by the browser so it's all good, no races.
- Deleting a speculative main frame at shutdown. This is the race we
address here.
- Deleting a speculative main frame because it's no longer needed. This
race is not handled by this CL but we CHECK() it explicitly now instead
of letting the renderer continue with a missing RenderFrame that it
expects to be present until it crashes somewhere random later.

[email protected], [email protected]

Bug: 957858, 838348
Change-Id: I2110bdaf8b116df48037f69db6cb992fa3796e29
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1594834
Commit-Queue: danakj <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Cr-Commit-Position: refs/heads/master@{#660025}
10 files changed