Index: content/browser/renderer_host/render_process_host_impl.h |
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h |
index 96e664d759ddfc18147963e11f0da001cd67b3e8..f77e17d0c642a59a36d4f3c1d2a8bdf953aa2583 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.h |
+++ b/content/browser/renderer_host/render_process_host_impl.h |
@@ -114,9 +114,20 @@ class CONTENT_EXPORT RenderProcessHostImpl |
public NON_EXPORTED_BASE(mojom::AssociatedInterfaceProvider), |
public NON_EXPORTED_BASE(mojom::RendererHost) { |
public: |
- RenderProcessHostImpl(BrowserContext* browser_context, |
- StoragePartitionImpl* storage_partition_impl, |
- bool is_for_guests_only); |
+ // Use the spare RenderProcessHost if it exists, or create a new one. This |
+ // should be the usual way to get a new RenderProcessHost. |
+ static RenderProcessHost* CreateOrUseSpareRenderProcessHost( |
+ BrowserContext* browser_context, |
+ StoragePartitionImpl* storage_partition_impl, |
+ bool is_for_guests_only); |
+ |
+ // Create a new RenderProcessHost. In most cases |
+ // CreateOrUseSpareRenderProcessHost, above, should be used instead. |
+ static RenderProcessHost* CreateRenderProcessHost( |
+ BrowserContext* browser_context, |
+ StoragePartitionImpl* storage_partition_impl, |
+ bool is_for_guests_only); |
+ |
~RenderProcessHostImpl() override; |
// RenderProcessHost implementation (public portion). |
@@ -337,6 +348,16 @@ class CONTENT_EXPORT RenderProcessHostImpl |
RenderProcessHost* render_process_host, |
const GURL& site_url); |
+ // Return the spare RenderProcessHost, if it exists. There is at most one |
+ // globally-used spare RenderProcessHost at any time. |
+ static RenderProcessHost* GetSpareRenderProcessHostForTesting(); |
+ |
+ // Return true if the host has not been used. This is stronger than IsUnused() |
+ // in that it checks if this RPH has ever been used to render at all, rather |
+ // than just no being suitable to host a URL that requires a dedicated |
+ // process. |
+ bool HostHasNotBeenUsed(); |
Charlie Reis
2017/06/30 21:42:16
Hmm, it's unfortunate to have this name be effecti
alexmos
2017/07/01 00:47:17
I'd need to check this more carefully, but I'm gue
mattcary
2017/07/03 08:03:02
Done. I assigned the TODO to you, alex, to be cons
|
+ |
protected: |
// A proxy for our IPC::Channel that lives on the IO thread. |
std::unique_ptr<IPC::ChannelProxy> channel_; |
@@ -363,6 +384,12 @@ class CONTENT_EXPORT RenderProcessHostImpl |
class ConnectionFilterController; |
class ConnectionFilterImpl; |
+ // Use CreateRenderProcessHost() instead of calling this constructor |
+ // directly. |
+ RenderProcessHostImpl(BrowserContext* browser_context, |
+ StoragePartitionImpl* storage_partition_impl, |
+ bool is_for_guests_only); |
+ |
// Initializes a new IPC::ChannelProxy in |channel_|, which will be connected |
// to the next child process launched for this host, if any. |
void InitializeChannelProxy(); |