Chromium Code Reviews| 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() == |