• Lowell Manners's avatar
    [bfcache] Don't reuse RenderViewHosts belonging to cached pages. · 75055a13
    Lowell Manners authored
    After a page enters the BackForwardCache, a user may navigate to a new
    page on the same site as the cached page (See
    BackForwardCacheBrowserTest.NavigateToTwoPagesOnSameSite).
    
    In the above case, it's important not to reuse the RenderViewHost(s)
    owned by the frames in the BackForwardCache, because this could lead to
    two main frames (the one in the cache, and the one the user just
    navigated to), existing at the same time for a single RenderViewHost
    (not allowed).
    
    To solve this, we can simply stop reusing RenderViewHosts that belong
    to a page when it enters the BackForwardCache, and begin reusing them
    again when it leaves the BackForwardCache.
    
    This approach also allows us to remove a work-around in
    navigation_controller_impl.cc that was aggressively deleting cached
    frames.
    
    Note: RenderViewHost is owned by RenderFrameHost, this CL changes
    nothing WRT object lifetimes.
    
    Change-Id: I18698fc4f737f3945ab41270bd07d1538ca096a5
    Bug: 993337, 999846
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1833616Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
    Reviewed-by: default avatarArthur Sonzogni <arthursonzogni@chromium.org>
    Commit-Queue: Lowell Manners <lowell@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#705043}
    75055a13
back_forward_cache_browsertest.cc 115 KB