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

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 1208143002: Move existing kSitePerProcess checks to a policy-oracle object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@swapped_out_cmdline_checks
Patch Set: Attempt to fix compile. Created 5 years, 5 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/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index ddb311a1c66e51ce25f600586c17347a6e3adec8..4666d75c5f3ff2a4b2e40f5d5ef9f52dff141365 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -122,6 +122,7 @@
#include "content/common/mojo/channel_init.h"
#include "content/common/mojo/mojo_messages.h"
#include "content/common/resource_messages.h"
+#include "content/common/site_isolation_policy.h"
#include "content/common/view_messages.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/content_browser_client.h"
@@ -1891,12 +1892,13 @@ bool RenderProcessHostImpl::IsSuitableHost(
// Check whether the given host and the intended site_url will be using the
// same StoragePartition, since a RenderProcessHost can only support a single
- // StoragePartition. This is relevant for packaged apps and isolated sites.
+ // StoragePartition. This is relevant for packaged apps.
StoragePartition* dest_partition =
BrowserContext::GetStoragePartitionForSite(browser_context, site_url);
if (!host->InSameStoragePartition(dest_partition))
return false;
+ // TODO(nick): Consult the SiteIsolationPolicy here. https://crbug.com/513036
if (ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings(
host->GetID()) !=
WebUIControllerFactoryRegistry::GetInstance()->UseWebUIBindingsForURL(
@@ -1948,13 +1950,12 @@ RenderProcessHost* RenderProcessHost::FromID(int render_process_id) {
bool RenderProcessHost::ShouldTryToUseExistingProcessHost(
BrowserContext* browser_context, const GURL& url) {
// If --site-per-process is enabled, do not try to reuse renderer processes
- // when over the limit. (We could allow pages from the same site to share, if
- // we knew what the given process was dedicated to. Allowing no sharing is
- // simpler for now.) This may cause resource exhaustion issues if too many
- // sites are open at once.
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kSitePerProcess))
+ // when over the limit.
+ // TODO(nick): This is overly conservative and isn't launchable. Move this
+ // logic into IsSuitableHost, and check |url| against the URL the process is
+ // dedicated to. This will allow pages from the same site to share, and will
+ // also allow non-isolated sites to share processes. https://crbug.com/513036
+ if (SiteIsolationPolicy::AreCrossProcessFramesPossible())
return false;
if (run_renderer_in_process())

Powered by Google App Engine
This is Rietveld 408576698