browser_protocol/systeminfo/mod.rs
1//! The SystemInfo domain defines methods and events for querying low-level system information.
2
3use serde::{Serialize, Deserialize};
4use serde_json::Value as JsonValue;
5
6/// Describes a single graphics processor (GPU).
7
8#[derive(Debug, Clone, Serialize, Deserialize, Default)]
9#[serde(rename_all = "camelCase")]
10pub struct GPUDevice {
11 /// PCI ID of the GPU vendor, if available; 0 otherwise.
12
13 pub vendorId: f64,
14 /// PCI ID of the GPU device, if available; 0 otherwise.
15
16 pub deviceId: f64,
17 /// Sub sys ID of the GPU, only available on Windows.
18
19 #[serde(skip_serializing_if = "Option::is_none")]
20 pub subSysId: Option<f64>,
21 /// Revision of the GPU, only available on Windows.
22
23 #[serde(skip_serializing_if = "Option::is_none")]
24 pub revision: Option<f64>,
25 /// String description of the GPU vendor, if the PCI ID is not available.
26
27 pub vendorString: String,
28 /// String description of the GPU device, if the PCI ID is not available.
29
30 pub deviceString: String,
31 /// String description of the GPU driver vendor.
32
33 pub driverVendor: String,
34 /// String description of the GPU driver version.
35
36 pub driverVersion: String,
37}
38
39/// Describes the width and height dimensions of an entity.
40
41#[derive(Debug, Clone, Serialize, Deserialize, Default)]
42#[serde(rename_all = "camelCase")]
43pub struct Size {
44 /// Width in pixels.
45
46 pub width: u64,
47 /// Height in pixels.
48
49 pub height: i64,
50}
51
52/// Describes a supported video decoding profile with its associated minimum and
53/// maximum resolutions.
54
55#[derive(Debug, Clone, Serialize, Deserialize, Default)]
56#[serde(rename_all = "camelCase")]
57pub struct VideoDecodeAcceleratorCapability {
58 /// Video codec profile that is supported, e.g. VP9 Profile 2.
59
60 pub profile: String,
61 /// Maximum video dimensions in pixels supported for this |profile|.
62
63 pub maxResolution: Size,
64 /// Minimum video dimensions in pixels supported for this |profile|.
65
66 pub minResolution: Size,
67}
68
69/// Describes a supported video encoding profile with its associated maximum
70/// resolution and maximum framerate.
71
72#[derive(Debug, Clone, Serialize, Deserialize, Default)]
73#[serde(rename_all = "camelCase")]
74pub struct VideoEncodeAcceleratorCapability {
75 /// Video codec profile that is supported, e.g H264 Main.
76
77 pub profile: String,
78 /// Maximum video dimensions in pixels supported for this |profile|.
79
80 pub maxResolution: Size,
81 /// Maximum encoding framerate in frames per second supported for this
82 /// |profile|, as fraction's numerator and denominator, e.g. 24/1 fps,
83 /// 24000/1001 fps, etc.
84
85 pub maxFramerateNumerator: i64,
86
87 pub maxFramerateDenominator: i64,
88}
89
90/// YUV subsampling type of the pixels of a given image.
91
92#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
93pub enum SubsamplingFormat {
94 #[default]
95 Yuv420,
96 Yuv422,
97 Yuv444,
98}
99
100/// Image format of a given image.
101
102#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
103pub enum ImageType {
104 #[default]
105 Jpeg,
106 Webp,
107 Unknown,
108}
109
110/// Provides information about the GPU(s) on the system.
111
112#[derive(Debug, Clone, Serialize, Deserialize, Default)]
113#[serde(rename_all = "camelCase")]
114pub struct GPUInfo {
115 /// The graphics devices on the system. Element 0 is the primary GPU.
116
117 pub devices: Vec<GPUDevice>,
118 /// An optional dictionary of additional GPU related attributes.
119
120 #[serde(skip_serializing_if = "Option::is_none")]
121 pub auxAttributes: Option<serde_json::Map<String, JsonValue>>,
122 /// An optional dictionary of graphics features and their status.
123
124 #[serde(skip_serializing_if = "Option::is_none")]
125 pub featureStatus: Option<serde_json::Map<String, JsonValue>>,
126 /// An optional array of GPU driver bug workarounds.
127
128 pub driverBugWorkarounds: Vec<String>,
129 /// Supported accelerated video decoding capabilities.
130
131 pub videoDecoding: Vec<VideoDecodeAcceleratorCapability>,
132 /// Supported accelerated video encoding capabilities.
133
134 pub videoEncoding: Vec<VideoEncodeAcceleratorCapability>,
135}
136
137/// Represents process info.
138
139#[derive(Debug, Clone, Serialize, Deserialize, Default)]
140#[serde(rename_all = "camelCase")]
141pub struct ProcessInfo {
142 /// Specifies process type.
143
144 #[serde(rename = "type")]
145 pub type_: String,
146 /// Specifies process id.
147
148 pub id: u64,
149 /// Specifies cumulative CPU usage in seconds across all threads of the
150 /// process since the process start.
151
152 pub cpuTime: f64,
153}
154
155/// Returns information about the system.
156
157#[derive(Debug, Clone, Serialize, Deserialize, Default)]
158#[serde(rename_all = "camelCase")]
159pub struct GetInfoReturns {
160 /// Information about the GPUs on the system.
161
162 pub gpu: GPUInfo,
163 /// A platform-dependent description of the model of the machine. On Mac OS, this is, for
164 /// example, 'MacBookPro'. Will be the empty string if not supported.
165
166 pub modelName: String,
167 /// A platform-dependent description of the version of the machine. On Mac OS, this is, for
168 /// example, '10.1'. Will be the empty string if not supported.
169
170 pub modelVersion: String,
171 /// The command line string used to launch the browser. Will be the empty string if not
172 /// supported.
173
174 pub commandLine: String,
175}
176
177/// Returns information about the feature state.
178
179#[derive(Debug, Clone, Serialize, Deserialize, Default)]
180#[serde(rename_all = "camelCase")]
181pub struct GetFeatureStateParams {
182
183 pub featureState: String,
184}
185
186/// Returns information about the feature state.
187
188#[derive(Debug, Clone, Serialize, Deserialize, Default)]
189#[serde(rename_all = "camelCase")]
190pub struct GetFeatureStateReturns {
191
192 pub featureEnabled: bool,
193}
194
195/// Returns information about all running processes.
196
197#[derive(Debug, Clone, Serialize, Deserialize, Default)]
198#[serde(rename_all = "camelCase")]
199pub struct GetProcessInfoReturns {
200 /// An array of process info blocks.
201
202 pub processInfo: Vec<ProcessInfo>,
203}