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

Unified Diff: content/browser/browsing_instance.cc

Issue 1777233002: Top document isolation mode prototype (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Doghouse SiteInstance, with bugs 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
« no previous file with comments | « content/browser/browsing_instance.h ('k') | content/browser/site_instance_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browsing_instance.cc
diff --git a/content/browser/browsing_instance.cc b/content/browser/browsing_instance.cc
index 1d5f8953769f92efbc770b3ca88331235d4d8002..d76de7e638263514cb2b2e64f4681aafdd82598d 100644
--- a/content/browser/browsing_instance.cc
+++ b/content/browser/browsing_instance.cc
@@ -36,15 +36,37 @@ SiteInstance* BrowsingInstance::GetSiteInstanceForURL(const GURL& url) {
if (i != site_instance_map_.end())
return i->second;
+ bool use_doghouse = !site_instance_map_.empty() &&
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDogHouseProcess);
+
+ if (use_doghouse) {
+ if (SiteInstance* doghouse = GetDoghouseSiteInstance()) {
+ return doghouse;
+ }
+ }
+
// No current SiteInstance for this site, so let's create one.
SiteInstanceImpl* instance = new SiteInstanceImpl(this);
// Set the site of this new SiteInstance, which will register it with us.
instance->SetSite(url);
+
+ // TODO(xiaochengh): Say something here...
+ instance->SetForDoghouse(use_doghouse);
ncarter (slow) 2016/03/14 17:42:24 I think this choice (of which SiteInstance becomes
return instance;
}
+SiteInstance* BrowsingInstance::GetDoghouseSiteInstance() const {
+ for (SiteInstanceMap::const_iterator i = site_instance_map_.begin();
+ i != site_instance_map_.end(); ++i) {
+ if (i->second->IsForDoghouse())
+ return i->second;
+ }
+ return nullptr;
+}
+
void BrowsingInstance::RegisterSiteInstance(SiteInstance* site_instance) {
DCHECK(static_cast<SiteInstanceImpl*>(site_instance)
->browsing_instance_.get() ==
« no previous file with comments | « content/browser/browsing_instance.h ('k') | content/browser/site_instance_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698