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

Side by Side 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 unified diff | Download patch
OLDNEW
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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 // assigned. 371 // assigned.
372 // Note that a process hosting ServiceWorkers will be implicitly handled by 372 // Note that a process hosting ServiceWorkers will be implicitly handled by
373 // (2) during ServiceWorker initialization, and SharedWorkers will be handled 373 // (2) during ServiceWorker initialization, and SharedWorkers will be handled
374 // by (1) since a page needs to commit before it can create a SharedWorker. 374 // by (1) since a page needs to commit before it can create a SharedWorker.
375 // 375 //
376 // While a process is unused, it is still suitable to host a URL that 376 // While a process is unused, it is still suitable to host a URL that
377 // requires a dedicated process. 377 // requires a dedicated process.
378 virtual bool IsUnused() = 0; 378 virtual bool IsUnused() = 0;
379 virtual void SetIsUsed() = 0; 379 virtual void SetIsUsed() = 0;
380 380
381 // Return true if the host has not been used. This is stronger than IsUnused()
382 // in that it checks if this RPH has ever been used to render at all, rather
383 // than just no being suitable to host a URL that requires a dedicated
384 // process.
385 // TODO(alexmos): can this be unified with IsUnused()? See also
386 // crbug.com/738634.
387 virtual bool HostHasNotBeenUsed() = 0;
388
381 // Returns the current number of active views in this process. Excludes 389 // Returns the current number of active views in this process. Excludes
382 // any RenderViewHosts that are swapped out. 390 // any RenderViewHosts that are swapped out.
383 size_t GetActiveViewCount(); 391 size_t GetActiveViewCount();
384 392
385 // Posts |task|, if this RenderProcessHost is ready or when it becomes ready 393 // Posts |task|, if this RenderProcessHost is ready or when it becomes ready
386 // (see RenderProcessHost::IsReady method). The |task| might not run at all 394 // (see RenderProcessHost::IsReady method). The |task| might not run at all
387 // (e.g. if |render_process_host| is destroyed before becoming ready). This 395 // (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 396 // function can only be called on the browser's UI thread (and the |task| will
389 // be posted back on the UI thread). 397 // be posted back on the UI thread).
390 void PostTaskWhenProcessIsReady(base::OnceClosure task); 398 void PostTaskWhenProcessIsReady(base::OnceClosure task);
391 399
392 // Static management functions ----------------------------------------------- 400 // Static management functions -----------------------------------------------
393 401
402 // Possibly start an unbound, spare RenderProcessHost. A subsequent creation
403 // of a RenderProcessHost with a matching browser_context may use this
404 // preinitialized RenderProcessHost, improving performance.
405 //
406 // It is safe to call this multiple times or when it is not certain that the
407 // spare renderer will be used, although calling this too eagerly may reduce
408 // performance as unnecessary RenderProcessHosts are created. The spare
409 // renderer will only be used if it using the default StoragePartition of a
410 // matching BrowserContext.
411 //
412 // The spare RenderProcessHost is meant to be created in a situation where a
413 // navigation is imminent and it is unlikely an existing RenderProcessHost
414 // will be used, for example in a cross-site navigation when a Service Worker
415 // will need to be started.
416 static void WarmupSpareRenderProcessHost(
417 content::BrowserContext* browser_context);
418
394 // Flag to run the renderer in process. This is primarily 419 // Flag to run the renderer in process. This is primarily
395 // for debugging purposes. When running "in process", the 420 // for debugging purposes. When running "in process", the
396 // browser maintains a single RenderProcessHost which communicates 421 // browser maintains a single RenderProcessHost which communicates
397 // to a RenderProcess which is instantiated in the same process 422 // to a RenderProcess which is instantiated in the same process
398 // with the Browser. All IPC between the Browser and the 423 // with the Browser. All IPC between the Browser and the
399 // Renderer is the same, it's just not crossing a process boundary. 424 // Renderer is the same, it's just not crossing a process boundary.
400 425
401 static bool run_renderer_in_process(); 426 static bool run_renderer_in_process();
402 427
403 // This also calls out to ContentBrowserClient::GetApplicationLocale and 428 // This also calls out to ContentBrowserClient::GetApplicationLocale and
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 static void SetMaxRendererProcessCount(size_t count); 465 static void SetMaxRendererProcessCount(size_t count);
441 466
442 // Returns the current maximum number of renderer process hosts kept by the 467 // Returns the current maximum number of renderer process hosts kept by the
443 // content module. 468 // content module.
444 static size_t GetMaxRendererProcessCount(); 469 static size_t GetMaxRendererProcessCount();
445 }; 470 };
446 471
447 } // namespace content. 472 } // namespace content.
448 473
449 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_ 474 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_
OLDNEW
« 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