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

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: Fix some includes 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 e6df625995260a1880ca0af522c5ceaff11abee8..77da1c06b773f1a44af3c73af47f9e893e729f3f 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"
@@ -1890,12 +1891,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.
if (ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings(
host->GetID()) !=
WebUIControllerFactoryRegistry::GetInstance()->UseWebUIBindingsForURL(
@@ -1947,13 +1949,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
Charlie Reis 2015/07/21 16:58:23 Can you file a bug for this so it doesn't fall bet
ncarter (slow) 2015/07/22 23:29:08 Done.
+ // 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.
+ if (SiteIsolationPolicy::AreCrossProcessFramesPossible())
return false;
if (run_renderer_in_process())

Powered by Google App Engine
This is Rietveld 408576698