Index: content/browser/renderer_host/render_process_host.cc |
diff --git a/content/browser/renderer_host/render_process_host.cc b/content/browser/renderer_host/render_process_host.cc |
index 958a30dac1a8ade2fc7dc2ac4609b5bb52e24748..3a7d051115ef79dac0577c245d8f681b42c74218 100644 |
--- a/content/browser/renderer_host/render_process_host.cc |
+++ b/content/browser/renderer_host/render_process_host.cc |
@@ -9,7 +9,10 @@ |
#include "base/sys_info.h" |
#include "content/browser/browser_thread.h" |
#include "content/browser/child_process_security_policy.h" |
+#include "content/browser/content_browser_client.h" |
+#include "content/browser/webui/web_ui_factory.h" |
#include "content/common/child_process_info.h" |
+#include "content/common/content_client.h" |
#include "content/common/content_constants.h" |
#include "content/common/content_switches.h" |
#include "content/common/notification_service.h" |
@@ -60,25 +63,6 @@ size_t GetMaxRendererProcessCount() { |
return max_count; |
} |
-// Returns true if the given host is suitable for launching a new view |
-// associated with the given browser context. |
-static bool IsSuitableHost(RenderProcessHost* host, |
- content::BrowserContext* browser_context, |
- RenderProcessHost::Type type) { |
- if (host->browser_context() != browser_context) |
- return false; |
- |
- RenderProcessHost::Type host_type = RenderProcessHost::TYPE_NORMAL; |
- if (ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings(host->id())) |
- host_type = RenderProcessHost::TYPE_WEBUI; |
- if (ChildProcessSecurityPolicy::GetInstance()-> |
- HasExtensionBindings(host->id()) || |
- host->is_extension_process()) |
- host_type = RenderProcessHost::TYPE_EXTENSION; |
- |
- return host_type == type; |
-} |
- |
// the global list of all renderer processes |
IDMap<RenderProcessHost> all_hosts; |
@@ -219,7 +203,8 @@ bool RenderProcessHost::ShouldTryToUseExistingProcessHost() { |
// static |
RenderProcessHost* RenderProcessHost::GetExistingProcessHost( |
- content::BrowserContext* browser_context, Type type) { |
+ content::BrowserContext* browser_context, |
+ const GURL& site_url) { |
// First figure out which existing renderers we can use. |
std::vector<RenderProcessHost*> suitable_renderers; |
suitable_renderers.reserve(all_hosts.size()); |
@@ -227,7 +212,8 @@ RenderProcessHost* RenderProcessHost::GetExistingProcessHost( |
iterator iter(AllHostsIterator()); |
while (!iter.IsAtEnd()) { |
if (run_renderer_in_process() || |
- IsSuitableHost(iter.GetCurrentValue(), browser_context, type)) |
+ (iter.GetCurrentValue()->browser_context() == browser_context && |
+ iter.GetCurrentValue()->IsSuitableHost(site_url))) |
suitable_renderers.push_back(iter.GetCurrentValue()); |
iter.Advance(); |
@@ -242,3 +228,10 @@ RenderProcessHost* RenderProcessHost::GetExistingProcessHost( |
return NULL; |
} |
+ |
+bool RenderProcessHost::IsSuitableHost(const GURL& site_url) { |
+ if (ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings(id_) != |
+ content::WebUIFactory::Get()->HasWebUIScheme(site_url)) |
+ return false; |
+ return true; |
+} |