Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(944)

Unified Diff: content/browser/site_instance_impl.cc

Issue 2803673006: PlzNavigate: ensure we don't create extra-processes for ServiceWorkers (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/site_instance_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/site_instance_impl.cc
diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc
index a4c886260e008f39fc30ab153d898df9fd09f2d0..94186205015aa3a4d86d68e7352f7209620d122b 100644
--- a/content/browser/site_instance_impl.cc
+++ b/content/browser/site_instance_impl.cc
@@ -44,6 +44,7 @@ SiteInstanceImpl::~SiteInstanceImpl() {
// (within the same BrowsingInstance) can safely create a new SiteInstance.
if (has_site_)
browsing_instance_->UnregisterSiteInstance(this);
+ browsing_instance_->UnregisterUsedFor(this, sites_displayed_);
}
scoped_refptr<SiteInstanceImpl> SiteInstanceImpl::Create(
@@ -61,6 +62,17 @@ scoped_refptr<SiteInstanceImpl> SiteInstanceImpl::CreateForURL(
return instance->GetSiteInstanceForURL(url);
}
+// static
+scoped_refptr<SiteInstanceImpl> SiteInstanceImpl::FindOrCreateForURL(
+ BrowserContext* browser_context,
+ const GURL& url) {
+ scoped_refptr<SiteInstanceImpl> instance_found =
+ BrowsingInstance::FindSiteInstance(browser_context, url);
+ if (instance_found)
+ return instance_found;
+ return CreateForURL(browser_context, url);
+}
+
int32_t SiteInstanceImpl::GetId() {
return id_;
}
@@ -269,6 +281,13 @@ bool SiteInstanceImpl::HasSite() const {
return has_site_;
}
+void SiteInstanceImpl::UsedFor(const GURL& url) {
+ std::string site = GetSiteForURL(browsing_instance_->browser_context_, url)
+ .possibly_invalid_spec();
+ sites_displayed_.insert(site);
+ browsing_instance_->RegisterUsedFor(this, site);
+}
+
bool SiteInstanceImpl::HasRelatedSiteInstance(const GURL& url) {
return browsing_instance_->HasSiteInstance(url);
}
« no previous file with comments | « content/browser/site_instance_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698