Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove eager SetSite on the current SiteInstance in session restore c…
…ases This code does not appear to be doing anything useful at this point. This is because in the session restore flow, we already create the restored SiteInstance via CreateForURL from: tab_util::GetSiteInstanceForNewTab() chrome::(anonymous namespace)::CreateRestoredTab() chrome::AddRestoredTab() It appears that the behavior of tab_util::GetSiteInstanceForNewTab() might've evolved, but now it calls CreateForURL() for all URLs except for those where ShouldAssignSiteForURL(url) is false (but this case is also skipped by the logic being removed here). The implementation of CreateForURL() already calls SetSite(), which means that when we get to DetermineSiteInstanceForURL(), `current_instance`'s HasSite() will be true and we will never hit the dest_is_restore logic. Other considerations for removing this logic include: - DetermineSiteInstanceForURL() shouldn't really have side effects. - session restore no longer loads all the restored tabs right away, deferring most of them until the user focuses them. - the process-per-site behavior of restored tabs should also be ensured outside of this function. In particular, GetProcess() is already called before getting to DetermineSiteInstanceForURL on restored SiteInstances, via the following stack: content::RenderProcessHostImpl::GetProcessHostForSiteInstance() content::SiteInstanceImpl::GetProcess() content::RenderFrameHostManager::CreateRenderFrameHost() content::RenderFrameHostManager::InitRoot() content::FrameTree::Init() content::WebContentsImpl::Init() content::WebContents::CreateWithSessionStorage() chrome::(anonymous namespace)::CreateRestoredTab() chrome::AddRestoredTab() Thus, GetProcessHostForSiteInstance() should be able to ensure that process-per-site cases behave correctly. Unfortunately, there's currently an independent bug with that for NTP in crbug.com/1399874, but it should be fixed in a different way; the logic being removed here won't help it due to the reasons explained above. Change-Id: Ia0695a861b01b8c2167e5a32fa10ee92b5675b42 Bug: 1394513, 1399874 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4089811 Reviewed-by: Charlie Reis <creis@chromium.org> Commit-Queue: Alex Moshchuk <alexmos@chromium.org> Cr-Commit-Position: refs/heads/main@{#1084596}
- Loading branch information