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

Unified Diff: content/browser/site_instance_impl.cc

Issue 2921063003: Fix process reuse for dedicated processes when over process limit. (Closed)
Patch Set: Cleanup Created 3 years, 6 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/site_instance_impl.cc
diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc
index 0e47c20885ad4e5e8b7396062cf192290c32b3fb..8ed1a7d28e8d64d523d28cfd880a6fdb2e4f2824 100644
--- a/content/browser/site_instance_impl.cc
+++ b/content/browser/site_instance_impl.cc
@@ -211,6 +211,10 @@ bool SiteInstanceImpl::HasWrongProcessForURL(const GURL& url) {
if (IsRendererDebugURL(url))
return false;
+ // Any process can host an about:blank URL.
+ if (url == url::kAboutBlankURL)
alexmos 2017/06/12 17:35:07 Several tests (like DumpAccessibilityTreeTest.Acce
Charlie Reis 2017/06/12 23:08:17 This makes me a bit nervous. In other places, we'
alexmos 2017/06/14 22:39:05 This is a bit tricky. Just to clarify, my intent
Charlie Reis 2017/06/17 23:13:53 Interesting points. I think you're right that we
alexmos 2017/06/19 20:03:58 Comment added - please let me know if it's helpful
Charlie Reis 2017/06/28 00:08:37 Thanks-- that works!
+ return false;
+
// If the site URL is an extension (e.g., for hosted apps or WebUI) but the
// process is not (or vice versa), make sure we notice and fix it.
GURL site_url = GetSiteForURL(browsing_instance_->browser_context(), url);
@@ -454,6 +458,18 @@ void SiteInstanceImpl::LockToOrigin() {
ChildProcessSecurityPolicyImpl::GetInstance();
policy->LockToOrigin(process_->GetID(), site_);
}
+
+ // From now on, this process should be considered "tainted" for future
+ // process reuse decisions:
+ // (1) If |site_| required a dedicated process, this SiteInstance's process
+ // can only host URLs for the same site.
+ // (2) Even if |site_| does not require a dedicated process, this
+ // SiteInstance's process still cannot be reused to host other sites
+ // requiring dedicated sites in the future.
+ // We can get here either when we commit a URL into a SiteInstance that does
+ // not yet have a site, or when we create a process for a SiteInstance with a
+ // predetermined site.
+ process_->UnsetCanBecomeDedicatedProcess();
Charlie Reis 2017/06/12 23:08:17 I found it confusing that this was inside "LockToO
alexmos 2017/06/14 22:39:05 Great questions, and I agree with your concerns.
alexmos 2017/06/15 16:40:54 Hmm, the trybots show that this wasn't as straight
alexmos 2017/06/15 17:27:58 I've just uploaded the fix (PS8), which is essenti
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698