OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ |
6 #define CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 384 |
385 // Posts |task|, if this RenderProcessHost is ready or when it becomes ready | 385 // Posts |task|, if this RenderProcessHost is ready or when it becomes ready |
386 // (see RenderProcessHost::IsReady method). The |task| might not run at all | 386 // (see RenderProcessHost::IsReady method). The |task| might not run at all |
387 // (e.g. if |render_process_host| is destroyed before becoming ready). This | 387 // (e.g. if |render_process_host| is destroyed before becoming ready). This |
388 // function can only be called on the browser's UI thread (and the |task| will | 388 // function can only be called on the browser's UI thread (and the |task| will |
389 // be posted back on the UI thread). | 389 // be posted back on the UI thread). |
390 void PostTaskWhenProcessIsReady(base::OnceClosure task); | 390 void PostTaskWhenProcessIsReady(base::OnceClosure task); |
391 | 391 |
392 // Static management functions ----------------------------------------------- | 392 // Static management functions ----------------------------------------------- |
393 | 393 |
| 394 // Possibly start an unbound, spare RenderProcessHost. A subsequent creation |
| 395 // of a RenderProcessHost with a matching browser_context may use this |
| 396 // preinitialized RenderProcessHost, improving performance. |
| 397 // |
| 398 // It is safe to call this multiple times or when it is not certain that the |
| 399 // spare renderer will be used, although calling this too eagerly may reduce |
| 400 // performance as unnecessary RenderProcessHosts are created. The spare |
| 401 // renderer will only be used if it using the default StoragePartition of a |
| 402 // matching BrowserContext. |
| 403 // |
| 404 // The spare RenderProcessHost is meant to be created in a situation where a |
| 405 // navigation is imminent and it is unlikely an existing RenderProcessHost |
| 406 // will be used, for example in a cross-site navigation when a Service Worker |
| 407 // will need to be started. |
| 408 static void WarmupSpareRenderProcessHost( |
| 409 content::BrowserContext* browser_context); |
| 410 |
394 // Flag to run the renderer in process. This is primarily | 411 // Flag to run the renderer in process. This is primarily |
395 // for debugging purposes. When running "in process", the | 412 // for debugging purposes. When running "in process", the |
396 // browser maintains a single RenderProcessHost which communicates | 413 // browser maintains a single RenderProcessHost which communicates |
397 // to a RenderProcess which is instantiated in the same process | 414 // to a RenderProcess which is instantiated in the same process |
398 // with the Browser. All IPC between the Browser and the | 415 // with the Browser. All IPC between the Browser and the |
399 // Renderer is the same, it's just not crossing a process boundary. | 416 // Renderer is the same, it's just not crossing a process boundary. |
400 | 417 |
401 static bool run_renderer_in_process(); | 418 static bool run_renderer_in_process(); |
402 | 419 |
403 // This also calls out to ContentBrowserClient::GetApplicationLocale and | 420 // This also calls out to ContentBrowserClient::GetApplicationLocale and |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 static void SetMaxRendererProcessCount(size_t count); | 457 static void SetMaxRendererProcessCount(size_t count); |
441 | 458 |
442 // Returns the current maximum number of renderer process hosts kept by the | 459 // Returns the current maximum number of renderer process hosts kept by the |
443 // content module. | 460 // content module. |
444 static size_t GetMaxRendererProcessCount(); | 461 static size_t GetMaxRendererProcessCount(); |
445 }; | 462 }; |
446 | 463 |
447 } // namespace content. | 464 } // namespace content. |
448 | 465 |
449 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ | 466 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ |
OLD | NEW |