Commit d522180f authored by Rakina Zata Amni's avatar Rakina Zata Amni Committed by Commit Bot

Reland "Reuse process on history navigations between same-site cross-BI pages"

This is a reland of b9f1aa01
The CL was previously reverted due to a flaky check on whether a process
is still alive or not, which is fixed in this CL by adding a
RenderFrameDeletedObserver and waiting until the process is actually
deleted before checking. See fix:
https://chromium-review.googlesource.com/c/chromium/src/+/2323086/1..2/content/browser/frame_host/render_frame_host_manager_browsertest.cc
Original change's description:
> Reuse process on history navigations between same-site cross-BI pages
>
> See crbug.com/1096135 for context. When doing same-site navigations, we
> might do a proactive BrowsingInstance swap, but we will reuse the
> renderer process whenever we can. On history navigations between pages
> that are same-site but have different BrowsingInstances (not only on
> cases that are caused by proactive BI swap), we should try to reuse the
> renderer process.
>
> Bug: 1096135
> Change-Id: I58f72bedecbbf94e4e05218bb9c15970a502d8a9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2282553
> Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
> Reviewed-by: Charlie Reis <creis@chromium.org>
> Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#792195}

Bug: 1096135, 1110281
Change-Id: I2c1ad20a73ad194980dfb2ab4caef29d2e1113d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2323086Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Reviewed-by: default avatarCharlie Reis <creis@chromium.org>
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792492}
parent e1e445e8
...@@ -1538,6 +1538,26 @@ RenderFrameHostManager::GetSiteInstanceForNavigation( ...@@ -1538,6 +1538,26 @@ RenderFrameHostManager::GetSiteInstanceForNavigation(
new_instance_impl->ReuseCurrentProcessIfPossible( new_instance_impl->ReuseCurrentProcessIfPossible(
current_instance->GetProcess()); current_instance->GetProcess());
} }
// If this is a same-site history navigation with different BrowsingInstances,
// the original navigation might have done a proactive BrowsingInstance swap,
// which means we should try to reuse the current process (because we did too
// on the original navigation).
bool is_history_navigation = !!dest_instance;
bool swapped_browsing_instance =
!new_instance->IsRelatedSiteInstance(current_instance);
if (IsProactivelySwapBrowsingInstanceOnSameSiteNavigationEnabled() &&
is_history_navigation && swapped_browsing_instance &&
frame_tree_node_->IsMainFrame() &&
IsCurrentlySameSite(
static_cast<RenderFrameHostImpl*>(render_frame_host_.get()),
dest_url)) {
// TODO(crbug.com/1107269): DCHECK for frame_tree_node_->IsMainFrame() once
// we can guarantee all cross-BrowsingInstance history navigations only
// happen on main frames.
new_instance_impl->ReuseCurrentProcessIfPossible(
current_instance->GetProcess());
}
return new_instance; return new_instance;
} }
......
...@@ -359,6 +359,9 @@ void SiteInstanceImpl::ReuseCurrentProcessIfPossible( ...@@ -359,6 +359,9 @@ void SiteInstanceImpl::ReuseCurrentProcessIfPossible(
current_process, GetIsolationContext(), site_info_, IsGuest())) { current_process, GetIsolationContext(), site_info_, IsGuest())) {
return; return;
} }
// TODO(crbug.com/1055779 ): Don't try to reuse process if either of the
// SiteInstances are cross-origin isolated (uses COOP/COEP).
SetProcessInternal(current_process); SetProcessInternal(current_process);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment