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

Unified Diff: content/browser/browsing_instance.cc

Issue 1797363002: "Top Document Isolation" mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Two new browsertests. Created 4 years, 9 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
Index: content/browser/browsing_instance.cc
diff --git a/content/browser/browsing_instance.cc b/content/browser/browsing_instance.cc
index 1d5f8953769f92efbc770b3ca88331235d4d8002..9090da21044e27cab7a30fabb1a9dc049c9e167f 100644
--- a/content/browser/browsing_instance.cc
+++ b/content/browser/browsing_instance.cc
@@ -36,7 +36,6 @@ SiteInstance* BrowsingInstance::GetSiteInstanceForURL(const GURL& url) {
if (i != site_instance_map_.end())
return i->second;
-
// No current SiteInstance for this site, so let's create one.
SiteInstanceImpl* instance = new SiteInstanceImpl(this);
@@ -45,6 +44,23 @@ SiteInstance* BrowsingInstance::GetSiteInstanceForURL(const GURL& url) {
return instance;
}
+SiteInstance* BrowsingInstance::GetSiteInstanceForThirdPartySubframes(
+ const GURL& url) {
+ // If we already have a site instance for this site, always use it instead
+ // of the site instance for third party subframes.
+ if (HasSiteInstance(url))
Charlie Reis 2016/03/18 21:15:13 I'm going to suggest skipping this. Don't worry a
+ return GetSiteInstanceForURL(url);
+
+ if (!site_instance_for_third_party_subframes_) {
+ SiteInstanceImpl* instance = new SiteInstanceImpl(this);
+ instance->set_is_for_third_party_subframes();
+ instance->SetSite(url);
+ site_instance_for_third_party_subframes_ = instance;
+ }
+
+ return site_instance_for_third_party_subframes_;
+}
+
void BrowsingInstance::RegisterSiteInstance(SiteInstance* site_instance) {
DCHECK(static_cast<SiteInstanceImpl*>(site_instance)
->browsing_instance_.get() ==
@@ -79,6 +95,8 @@ void BrowsingInstance::UnregisterSiteInstance(SiteInstance* site_instance) {
// Matches, so erase it.
site_instance_map_.erase(i);
}
+ if (site_instance_for_third_party_subframes_ == site_instance)
+ site_instance_for_third_party_subframes_ = nullptr;
}
BrowsingInstance::~BrowsingInstance() {

Powered by Google App Engine
This is Rietveld 408576698