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

Unified Diff: content/public/browser/render_process_host.h

Issue 2929113002: Enable spare RenderProcessHost to be preinitialized. (Closed)
Patch Set: Change creation of storage partition to not break unittests with subtle threading issues Created 3 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/public/browser/render_process_host.h
diff --git a/content/public/browser/render_process_host.h b/content/public/browser/render_process_host.h
index e42a39f90b0f3e85207d0980fede072036d300d8..0a44d0aa7a2a711f88190498c98045302fbc05e8 100644
--- a/content/public/browser/render_process_host.h
+++ b/content/public/browser/render_process_host.h
@@ -378,6 +378,14 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Sender,
virtual bool IsUnused() = 0;
virtual void SetIsUsed() = 0;
+ // 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.
+ // TODO(alexmos): can this be unified with IsUnused()? See also
+ // crbug.com/738634.
+ virtual bool HostHasNotBeenUsed() = 0;
+
// Returns the current number of active views in this process. Excludes
// any RenderViewHosts that are swapped out.
size_t GetActiveViewCount();
@@ -391,6 +399,23 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Sender,
// Static management functions -----------------------------------------------
+ // Possibly start an unbound, spare RenderProcessHost. A subsequent creation
+ // of a RenderProcessHost with a matching browser_context may use this
+ // preinitialized RenderProcessHost, improving performance.
+ //
+ // It is safe to call this multiple times or when it is not certain that the
+ // spare renderer will be used, although calling this too eagerly may reduce
+ // performance as unnecessary RenderProcessHosts are created. The spare
+ // renderer will only be used if it using the default StoragePartition of a
+ // matching BrowserContext.
+ //
+ // The spare RenderProcessHost is meant to be created in a situation where a
+ // navigation is imminent and it is unlikely an existing RenderProcessHost
+ // will be used, for example in a cross-site navigation when a Service Worker
+ // will need to be started.
+ static void WarmupSpareRenderProcessHost(
+ content::BrowserContext* browser_context);
+
// Flag to run the renderer in process. This is primarily
// for debugging purposes. When running "in process", the
// browser maintains a single RenderProcessHost which communicates
« no previous file with comments | « content/browser/renderer_host/render_process_host_unittest.cc ('k') | content/public/test/mock_render_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698