Commit fa7f2901 authored by Aaron Colwell's avatar Aaron Colwell Committed by Commit Bot

Remove unused browser_context from SiteInstanceDescriptor.

Removing a field that doesn't appear to be used anywhere and cleaned up
all the call sites.

Bug: 1015882
Change-Id: Ie6ed3db2a56d0416ec61a7f77da454b2fcc15fad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2151683
Commit-Queue: Aaron Colwell <acolwell@chromium.org>
Auto-Submit: Aaron Colwell <acolwell@chromium.org>
Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759675}
parent e636316d
......@@ -1059,7 +1059,7 @@ TEST_F(NavigatorTest, SiteInstanceDescriptionConversion) {
// current one.
GURL kUrlSameSiteAs1("http://www.a.com/foo");
{
SiteInstanceDescriptor descriptor(browser_context(), kUrlSameSiteAs1,
SiteInstanceDescriptor descriptor(kUrlSameSiteAs1,
SiteInstanceRelation::RELATED);
scoped_refptr<SiteInstance> converted_instance =
ConvertToSiteInstance(rfhm, descriptor, nullptr);
......@@ -1071,7 +1071,7 @@ TEST_F(NavigatorTest, SiteInstanceDescriptionConversion) {
GURL kUrlSameSiteAs2("http://www.b.com/foo");
scoped_refptr<SiteInstance> related_instance;
{
SiteInstanceDescriptor descriptor(browser_context(), kUrlSameSiteAs2,
SiteInstanceDescriptor descriptor(kUrlSameSiteAs2,
SiteInstanceRelation::RELATED);
related_instance = ConvertToSiteInstance(rfhm, descriptor, nullptr);
// If kUrlSameSiteAs2 requires a dedicated process on this platform, this
......@@ -1095,7 +1095,7 @@ TEST_F(NavigatorTest, SiteInstanceDescriptionConversion) {
// 5) Convert a descriptor of an unrelated instance with the same site as the
// current one, several times, with and without candidate sites.
{
SiteInstanceDescriptor descriptor(browser_context(), kUrlSameSiteAs1,
SiteInstanceDescriptor descriptor(kUrlSameSiteAs1,
SiteInstanceRelation::UNRELATED);
scoped_refptr<SiteInstance> converted_instance_1 =
ConvertToSiteInstance(rfhm, descriptor, nullptr);
......@@ -1133,7 +1133,7 @@ TEST_F(NavigatorTest, SiteInstanceDescriptionConversion) {
// 6) Convert a descriptor of an unrelated instance with the same site of
// related_instance and using it as a candidate.
{
SiteInstanceDescriptor descriptor(browser_context(), kUrlSameSiteAs2,
SiteInstanceDescriptor descriptor(kUrlSameSiteAs2,
SiteInstanceRelation::UNRELATED);
scoped_refptr<SiteInstance> converted_instance_1 =
ConvertToSiteInstance(rfhm, descriptor, related_instance.get());
......
......@@ -1159,12 +1159,10 @@ void RenderFrameHostManager::OnDidSetAdFrameType(
}
RenderFrameHostManager::SiteInstanceDescriptor::SiteInstanceDescriptor(
BrowserContext* browser_context,
GURL dest_url,
SiteInstanceRelation relation_to_current)
: existing_site_instance(nullptr),
dest_url(dest_url),
browser_context(browser_context),
relation(relation_to_current) {}
void RenderFrameHostManager::RenderProcessGone(
......@@ -1638,7 +1636,6 @@ RenderFrameHostManager::DetermineSiteInstanceForURL(
static_cast<SiteInstanceImpl*>(current_instance);
NavigationControllerImpl& controller =
delegate_->GetControllerForRenderManager();
BrowserContext* browser_context = controller.GetBrowserContext();
// If the entry has an instance already we should usually use it, unless it is
// no longer suitable.
......@@ -1677,7 +1674,7 @@ RenderFrameHostManager::DetermineSiteInstanceForURL(
// have been broken anyway if there were no error. Otherwise, we keep it
// in the same BrowsingInstance to preserve scripting relationships after
// reloads.
return SiteInstanceDescriptor(browser_context, GURL(kUnreachableWebDataURL),
return SiteInstanceDescriptor(GURL(kUnreachableWebDataURL),
force_browsing_instance_swap
? SiteInstanceRelation::UNRELATED
: SiteInstanceRelation::RELATED);
......@@ -1686,8 +1683,7 @@ RenderFrameHostManager::DetermineSiteInstanceForURL(
// If a swap is required, we need to force the SiteInstance AND
// BrowsingInstance to be different ones, using CreateForURL.
if (force_browsing_instance_swap) {
return SiteInstanceDescriptor(browser_context, dest_url,
SiteInstanceRelation::UNRELATED);
return SiteInstanceDescriptor(dest_url, SiteInstanceRelation::UNRELATED);
}
// TODO(https://crbug.com/566091): Don't create OOPIFs on the NTP. Remove
......@@ -1718,14 +1714,16 @@ RenderFrameHostManager::DetermineSiteInstanceForURL(
// existing process for the site, we should use it. We can call
// GetRelatedSiteInstance() for this, which will eagerly set the site and
// thus use the correct process.
DCHECK_EQ(controller.GetBrowserContext(),
current_instance_impl->GetBrowserContext());
bool use_process_per_site =
RenderProcessHost::ShouldUseProcessPerSite(browser_context, dest_url) &&
RenderProcessHost::ShouldUseProcessPerSite(
current_instance_impl->GetBrowserContext(), dest_url) &&
RenderProcessHostImpl::GetSoleProcessHostForURL(
current_instance_impl->GetIsolationContext(), dest_url);
if (current_instance_impl->HasRelatedSiteInstance(dest_url) ||
use_process_per_site) {
return SiteInstanceDescriptor(browser_context, dest_url,
SiteInstanceRelation::RELATED);
return SiteInstanceDescriptor(dest_url, SiteInstanceRelation::RELATED);
}
// For extensions, Web UI URLs (such as the new tab page), and apps we do
......@@ -1733,8 +1731,7 @@ RenderFrameHostManager::DetermineSiteInstanceForURL(
// will have a non-privileged RenderProcessHost. Create a new SiteInstance
// for this URL instead (with the correct process type).
if (!current_instance_impl->IsSuitableForURL(dest_url)) {
return SiteInstanceDescriptor(browser_context, dest_url,
SiteInstanceRelation::RELATED);
return SiteInstanceDescriptor(dest_url, SiteInstanceRelation::RELATED);
}
// Normally the "site" on the SiteInstance is set lazily when the load
......@@ -1827,8 +1824,7 @@ RenderFrameHostManager::DetermineSiteInstanceForURL(
// Start the new renderer in a new SiteInstance, but in the current
// BrowsingInstance.
return SiteInstanceDescriptor(browser_context, dest_url,
SiteInstanceRelation::RELATED);
return SiteInstanceDescriptor(dest_url, SiteInstanceRelation::RELATED);
}
bool RenderFrameHostManager::IsBrowsingInstanceSwapAllowedForPageTransition(
......
......@@ -31,7 +31,6 @@
#include "url/origin.h"
namespace content {
class BrowserContext;
class FrameTreeNode;
class InterstitialPageImpl;
class NavigationControllerImpl;
......@@ -546,8 +545,7 @@ class CONTENT_EXPORT RenderFrameHostManager
: existing_site_instance(site_instance),
relation(SiteInstanceRelation::PREEXISTING) {}
SiteInstanceDescriptor(BrowserContext* browser_context,
GURL dest_url,
SiteInstanceDescriptor(GURL dest_url,
SiteInstanceRelation relation_to_current);
// Set with an existing SiteInstance to be reused.
......@@ -556,10 +554,6 @@ class CONTENT_EXPORT RenderFrameHostManager
// In case |existing_site_instance| is null, specify a destination URL.
GURL dest_url;
// In case |existing_site_instance| is null, specify a BrowsingContext, to
// be used with |dest_url| to resolve the site URL.
BrowserContext* browser_context;
// Specifies how the new site is related to the current BrowsingInstance.
// This is PREEXISTING iff |existing_site_instance| is defined.
SiteInstanceRelation relation;
......
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