File: process_reuse_policy.h

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (50 lines) | stat: -rw-r--r-- 2,291 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_BROWSER_PROCESS_REUSE_POLICY_H_
#define CONTENT_BROWSER_PROCESS_REUSE_POLICY_H_

namespace content {

// The policy to apply when selecting a RenderProcessHost for a SiteInstance.
// If no suitable RenderProcessHost for the SiteInstance exists according to the
// policy, and there are processes with unmatched service workers for the site,
// the newest process with an unmatched service worker is reused. If still no
// RenderProcessHost exists, a new RenderProcessHost will be created unless the
// soft process limit has been reached. When the limit has been reached, an
// existing suitable (e.g., same-site if Site Isolation is enabled)
// RenderProcessHost will be chosen randomly to be reused when possible.
enum class ProcessReusePolicy {
  // In this mode, all instances of the site will be hosted in the same
  // RenderProcessHost.
  PROCESS_PER_SITE,

  // In this mode, the subframe's site will be rendered in a RenderProcessHost
  // that is already in use for the site, either for a pending navigation or a
  // committed navigation. If multiple such processes exist, ones that have
  // foreground frames are given priority, and otherwise one is selected
  // randomly.
  REUSE_PENDING_OR_COMMITTED_SITE_SUBFRAME,

  // Similar to REUSE_PENDING_OR_COMMITTED_SITE_SUBFRAME, but only applied to
  // workers. Reuse decisions may vary from those for
  // REUSE_PENDING_OR_COMMITTED_SITE_SUBFRAME.
  REUSE_PENDING_OR_COMMITTED_SITE_WORKER,

  // When used, this is similar to REUSE_PENDING_OR_COMMITTED_SITE_SUBFRAME, but
  // for main frames, and limiting the number of main frames a RenderProcessHost
  // can host to a certain threshold.
  REUSE_PENDING_OR_COMMITTED_SITE_WITH_MAIN_FRAME_THRESHOLD,

  // In this mode, SiteInstances don't proactively reuse processes. An
  // existing process with an unmatched service worker for the site is reused
  // only for navigations, not for service workers. When the process limit has
  // been reached, a randomly chosen RenderProcessHost is reused as in the
  // other policies.
  DEFAULT,
};

}  // namespace content

#endif  // CONTENT_BROWSER_PROCESS_REUSE_POLICY_H_