File: dbus-constants.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (112 lines) | stat: -rw-r--r-- 4,047 bytes parent folder | download | duplicates (9)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// Copyright 2021 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SYSTEM_API_DBUS_RESOURCE_MANAGER_DBUS_CONSTANTS_H_
#define SYSTEM_API_DBUS_RESOURCE_MANAGER_DBUS_CONSTANTS_H_

namespace resource_manager {

const char kResourceManagerInterface[] = "org.chromium.ResourceManager";
const char kResourceManagerServicePath[] = "/org/chromium/ResourceManager";
const char kResourceManagerServiceName[] = "org.chromium.ResourceManager";

// Values.
enum GameMode {
  // Game mode is off.
  OFF = 0,
  // Game mode is on, borealis is the foreground subsystem.
  BOREALIS = 1,
};

enum PressureLevelChrome {
  // There is enough memory to use.
  NONE = 0,
  // Chrome is advised to free buffers that are cheap to re-allocate and not
  // immediately needed.
  MODERATE = 1,
  // Chrome is advised to free all possible memory.
  CRITICAL = 2,
};

enum DiscardType {
  // Only unprotected pages can be discarded.
  UNPROTECTED = 0,
  // Both unprotected and protected pages can be discarded.
  PROTECTED = 1,
};

enum class PressureLevelArcContainer {
  // There is enough memory to use.
  NONE = 0,
  // ARC container is advised to kill cached processes to free memory.
  CACHED = 1,
  // ARC container is advised to kill perceptible processes to free memory.
  PERCEPTIBLE = 2,
  // ARC container is advised to kill foreground processes to free memory.
  FOREGROUND = 3,
};

enum class ProcessState {
  // The process is normal.
  kNormal = 0,
  // The process is background.
  kBackground = 1,
};

enum class ThreadState {
  kUrgentBursty = 0,
  kUrgent = 1,
  kBalanced = 2,
  kEco = 3,
  kUtility = 4,
  kBackground = 5,
  kUrgentBurstyServer = 6,
  kUrgentBurstyClient = 7,
};

// Methods.
const char kGetAvailableMemoryKBMethod[] = "GetAvailableMemoryKB";
const char kGetForegroundAvailableMemoryKBMethod[] =
    "GetForegroundAvailableMemoryKB";
const char kGetMemoryMarginsKBMethod[] = "GetMemoryMarginsKB";
const char kGetComponentMemoryMarginsKBMethod[] = "GetComponentMemoryMarginsKB";
const char kGetGameModeMethod[] = "GetGameMode";
const char kSetGameModeMethod[] = "SetGameMode";
const char kSetGameModeWithTimeoutMethod[] = "SetGameModeWithTimeout";
const char kSetMemoryMarginsMethod[] = "SetMemoryMargins";
// TODO(vovoy): remove method SetMemoryMarginsBps.
const char kSetMemoryMarginsBps[] = "SetMemoryMarginsBps";
const char kSetFullscreenVideoWithTimeout[] = "SetFullscreenVideoWithTimeout";
const char kSetVmBootModeWithTimeoutMethod[] = "SetVmBootModeWithTimeout";
const char kReportBrowserProcessesMethod[] = "ReportBrowserProcesses";
const char kSetProcessStateMethod[] = "SetProcessState";
const char kSetThreadStateMethod[] = "SetThreadState";

// Signals.

// MemoryPressureChrome signal contains 4 arguments:
//   1. pressure_level, BYTE, see also enum PressureLevelChrome.
//   2. reclaim_target_kb, UINT64, memory amount to free in KB to leave the
//   current pressure level.
//   3. Origin time, to avoid discard due to out-of-dated signals.
//   4. discard_type, BYTE, see also enum DiscardType.
//   E.g., argument (PressureLevelChrome::CRITICAL, 10000, origin_time,
//   DiscardType::UNPROTECTED): Chrome should free 10000 KB to leave the
//   critical memory pressure level (to moderate pressure level), only
//   unprotected pages can be discarded.
const char kMemoryPressureChrome[] = "MemoryPressureChrome";

// MemoryPressureArcContainer signal contains 3 arguments:
//   1. pressure_level, BYTE, see also enum PressureLevelArcContainer.
//   2. delta, UINT64, memory amount to free in KB to leave the current
//   pressure level.
//   3. Origin time.
//   E.g. argument (PressureLevelArcContainer::FOREGROUND, 10000, origin_time):
//   ARC container should free 10000 KB to leave the foreground memory pressure
//   level (to perceptible pressure level).
const char kMemoryPressureArcContainer[] = "MemoryPressureArcContainer";

}  // namespace resource_manager

#endif  // SYSTEM_API_DBUS_RESOURCE_MANAGER_DBUS_CONSTANTS_H_