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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 370 |
371 // Posts |task|, if this RenderProcessHost is ready or when it becomes ready | 371 // Posts |task|, if this RenderProcessHost is ready or when it becomes ready |
372 // (see RenderProcessHost::IsReady method). The |task| might not run at all | 372 // (see RenderProcessHost::IsReady method). The |task| might not run at all |
373 // (e.g. if |render_process_host| is destroyed before becoming ready). This | 373 // (e.g. if |render_process_host| is destroyed before becoming ready). This |
374 // function can only be called on the browser's UI thread (and the |task| will | 374 // function can only be called on the browser's UI thread (and the |task| will |
375 // be posted back on the UI thread). | 375 // be posted back on the UI thread). |
376 void PostTaskWhenProcessIsReady(base::OnceClosure task); | 376 void PostTaskWhenProcessIsReady(base::OnceClosure task); |
377 | 377 |
378 // Static management functions ----------------------------------------------- | 378 // Static management functions ----------------------------------------------- |
379 | 379 |
| 380 // Possibly start an unbound, spare RenderProcessHost. A subsequent creation |
| 381 // of a RenderProcessHost with a matching browser_context may use this |
| 382 // preinitialized RenderProcessHost, improving performance. |
| 383 // |
| 384 // It is safe to call this multiple times or when it is not certain that the |
| 385 // spare renderer will be used, although calling this too eagerly may reduce |
| 386 // performance as unnecessary RenderProcessHosts are created. The spare |
| 387 // renderer will only be used if it using the default StoragePartition of a |
| 388 // matching BrowserContext. |
| 389 // |
| 390 // The spare RenderProcessHost is meant to be created in a situation where a |
| 391 // navigation is imminent and it is unlikely an existing RenderProcessHost |
| 392 // will be used, for example in a cross-site navigation when a Service Worker |
| 393 // will need to be started. |
| 394 static void WarmupSpareRenderProcessHost( |
| 395 content::BrowserContext* browser_context); |
| 396 |
380 // Flag to run the renderer in process. This is primarily | 397 // Flag to run the renderer in process. This is primarily |
381 // for debugging purposes. When running "in process", the | 398 // for debugging purposes. When running "in process", the |
382 // browser maintains a single RenderProcessHost which communicates | 399 // browser maintains a single RenderProcessHost which communicates |
383 // to a RenderProcess which is instantiated in the same process | 400 // to a RenderProcess which is instantiated in the same process |
384 // with the Browser. All IPC between the Browser and the | 401 // with the Browser. All IPC between the Browser and the |
385 // Renderer is the same, it's just not crossing a process boundary. | 402 // Renderer is the same, it's just not crossing a process boundary. |
386 | 403 |
387 static bool run_renderer_in_process(); | 404 static bool run_renderer_in_process(); |
388 | 405 |
389 // This also calls out to ContentBrowserClient::GetApplicationLocale and | 406 // This also calls out to ContentBrowserClient::GetApplicationLocale and |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 static void SetMaxRendererProcessCount(size_t count); | 443 static void SetMaxRendererProcessCount(size_t count); |
427 | 444 |
428 // Returns the current maximum number of renderer process hosts kept by the | 445 // Returns the current maximum number of renderer process hosts kept by the |
429 // content module. | 446 // content module. |
430 static size_t GetMaxRendererProcessCount(); | 447 static size_t GetMaxRendererProcessCount(); |
431 }; | 448 }; |
432 | 449 |
433 } // namespace content. | 450 } // namespace content. |
434 | 451 |
435 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ | 452 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ |
OLD | NEW |