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

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

Issue 2861433002: Implement ProcessReusePolicy for SiteInstances (Closed)
Patch Set: Rebase Created 3 years, 8 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.h
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h
index 5a18d331b35d3e7c473a174fc3d3185d0686fb6a..0e89ed8b63c844b8faa9b6fc874639c208b4e026 100644
--- a/content/browser/renderer_host/render_process_host_impl.h
+++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -71,10 +71,12 @@ class PermissionServiceContext;
class PeerConnectionTrackerHost;
class PushMessagingManager;
class RenderFrameMessageFilter;
+class RenderProcessHostFactory;
class RenderWidgetHelper;
class RenderWidgetHost;
class RenderWidgetHostImpl;
class ResourceMessageFilter;
+class SiteInstanceImpl;
class StoragePartition;
class StoragePartitionImpl;
@@ -256,6 +258,31 @@ class CONTENT_EXPORT RenderProcessHostImpl
RenderProcessHost* process,
const GURL& url);
+ // The policy to apply when selecting a RenderProcessHost for a site.
Charlie Reis 2017/05/03 23:28:00 I'm unclear if this is just about process-per-site
clamy 2017/05/04 15:56:19 I have rephrased the comment.
+ enum class ProcessReusePolicy {
Charlie Reis 2017/05/03 23:28:00 It's a bit odd that this enum is not used in any A
clamy 2017/05/04 15:56:19 Done.
+ // Do not attempt to reuse an existing RenderProcessHost.
+ DONT,
Charlie Reis 2017/05/03 23:28:00 Let's clarify if this really means "never reuse, e
nasko 2017/05/03 23:46:17 nit: DO_NOT
clamy 2017/05/04 15:56:19 I initially thought we might want to change Render
+
+ // In this mode, all instances of the site will be rendered in the same
Charlie Reis 2017/05/03 23:28:00 Is the idea to also use this value for ServiceWork
nasko 2017/05/03 23:46:17 nit: s/rendererd/hosted/?
clamy 2017/05/04 15:56:19 Done. For the naming question, I'm planning a dif
Charlie Reis 2017/05/04 23:12:23 Works for me, thanks.
+ // RenderProcessHost.
+ PROCESS_PER_SITE,
+
+ // In this mode, subframes will be rendered in a designated
+ // RenderProcessHost.
+ USE_DEFAULT_SUBFRAME_INSTANCE,
Charlie Reis 2017/05/03 23:28:00 s/INSTANCE/PROCESS/, perhaps? There are multiple
clamy 2017/05/04 15:56:19 Done.
+
+ // By default, a new RenderProcessHost will be created unless the process
+ // limit has been reached.
Charlie Reis 2017/05/03 23:28:00 Let's mention that reuse after the limit is random
clamy 2017/05/04 15:56:19 Done.
+ DEFAULT,
+ };
+
+ // Returns a suitable RenderProcessHost to use for |site_instance|. Depending
+ // on the SiteInstance ProcessReusePolicy and its url, this may be an existing
Charlie Reis 2017/05/03 23:28:00 nit: SiteInstance's
clamy 2017/05/04 15:56:19 Done.
+ // RenderProcessHost or a new one.
+ static RenderProcessHost* GetProcessHostForSiteInstance(
+ BrowserContext* browser_context,
+ SiteInstanceImpl* site_instance);
+
static base::MessageLoop* GetInProcessRendererThreadForTesting();
// This forces a renderer that is running "in process" to shut down.
@@ -295,6 +322,13 @@ class CONTENT_EXPORT RenderProcessHostImpl
void OnAudioStreamRemoved() override;
int get_audio_stream_count_for_testing() const { return audio_stream_count_; }
+ // Sets the global factory used to create new RenderProcessHosts. It may be
+ // nullptr, in which case the default RenderProcessHost will be created (this
+ // is the behavior if you don't call this function). The factory must be set
+ // back to nullptr before it's destroyed; ownership is not transferred.
+ static void set_render_process_host_factory(
Charlie Reis 2017/05/03 23:28:00 Thanks-- this makes more sense here.
+ const RenderProcessHostFactory* rph_factory);
+
protected:
// A proxy for our IPC::Channel that lives on the IO thread.
std::unique_ptr<IPC::ChannelProxy> channel_;
@@ -388,6 +422,12 @@ class CONTENT_EXPORT RenderProcessHostImpl
// GpuSwitchingObserver implementation.
void OnGpuSwitched() override;
+ // Returns the default subframe RenderProcessHost to use for |site_instance|.
+ static RenderProcessHost* GetDefaultSubframeProcessHost(
+ BrowserContext* browser_context,
+ SiteInstanceImpl* site_instance,
+ bool is_for_guests_only);
+
#if BUILDFLAG(ENABLE_WEBRTC)
void OnRegisterAecDumpConsumer(int id);
void OnUnregisterAecDumpConsumer(int id);

Powered by Google App Engine
This is Rietveld 408576698