Initial BackForwardCache implementation.

− Add the BackForwardCache feature. Disabled by default.
− On cross-process navigations, keep the old RenderFrameHost. Store it in a
  |BackForwardCache| object.
− On history navigation, find the previous document in the BFCache and swap it
  back if possible.
− The BackForwardCache works as a least recently used cache.
  A basic cache eviction is implemented when it is full.

Major things that aren't supported yet:
- Freezing the frame in the BackForwardCache. They are still able to execute
  JavaScript in the background. They can still interact using IPCs with the
  browser process and causes crashes.
- Removing a RenderFrameHost from the BackForwardCache cleanly.
- Handling same-process navigations.

Bug: 914321
Change-Id: I1b83fe59dc4868b5a6093738d2f5c65f67d60a78
Reviewed-on: https://chromium-review.googlesource.com/c/1358434
Commit-Queue: Arthur Sonzogni <[email protected]>
Reviewed-by: Alex Moshchuk <[email protected]>
Reviewed-by: Camille Lamy <[email protected]>
Cr-Commit-Position: refs/heads/master@{#616284}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 9723917..72a0b42 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -676,6 +676,7 @@
   // destroyed.
   RenderFrameHostManager* root = GetRenderManager();
 
+  GetController().back_forward_cache().Flush();
   root->current_frame_host()->SetRenderFrameCreated(false);
   root->current_frame_host()->ResetNavigationRequests();