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 248ed1d8b17158adeb873798ca038fb954fa0f68..be60f684bb326881d12359a29d09e109c1855e66 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -144,6 +144,7 @@ |
#include "content/public/common/resource_type.h" |
#include "content/public/common/result_codes.h" |
#include "content/public/common/sandboxed_process_launcher_delegate.h" |
+#include "content/public/common/site_isolation_policy.h" |
#include "content/public/common/url_constants.h" |
#include "device/battery/battery_monitor_impl.h" |
#include "device/vibration/vibration_manager_impl.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. |
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. |
+ if (SiteIsolationPolicy::AreCrossProcessFramesPossible()) |
return false; |
if (run_renderer_in_process()) |