Skip to main content

cdp_driver/protocol/
system_info.rs

1// @generated by `just generate-methods` from protocol/*.json.
2// Do not edit by hand; edit xtask/ and regenerate.
3
4//! The SystemInfo domain defines methods and events for querying low-level
5//! system information.
6//!
7//! Types, command parameters and event payloads for the `SystemInfo`
8//! domain. The method-name constants for the same domain are in
9//! [`crate::methods`].
10//!
11//! This domain is experimental and may change without notice.
12
13use serde::{Deserialize, Serialize};
14
15/// Describes a single graphics processor (GPU).
16#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
17pub struct GpuDevice {
18    /// PCI ID of the GPU vendor, if available; 0 otherwise.
19    #[serde(rename = "vendorId")]
20    pub vendor_id: f64,
21    /// PCI ID of the GPU device, if available; 0 otherwise.
22    #[serde(rename = "deviceId")]
23    pub device_id: f64,
24    /// Sub sys ID of the GPU, only available on Windows.
25    #[serde(rename = "subSysId", default, skip_serializing_if = "Option::is_none")]
26    pub sub_sys_id: Option<f64>,
27    /// Revision of the GPU, only available on Windows.
28    #[serde(default, skip_serializing_if = "Option::is_none")]
29    pub revision: Option<f64>,
30    /// String description of the GPU vendor, if the PCI ID is not available.
31    #[serde(rename = "vendorString")]
32    pub vendor_string: String,
33    /// String description of the GPU device, if the PCI ID is not available.
34    #[serde(rename = "deviceString")]
35    pub device_string: String,
36    /// String description of the GPU driver vendor.
37    #[serde(rename = "driverVendor")]
38    pub driver_vendor: String,
39    /// String description of the GPU driver version.
40    #[serde(rename = "driverVersion")]
41    pub driver_version: String,
42}
43
44/// Describes the width and height dimensions of an entity.
45#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
46pub struct Size {
47    /// Width in pixels.
48    pub width: i64,
49    /// Height in pixels.
50    pub height: i64,
51}
52
53/// Describes a supported video decoding profile with its associated minimum
54/// and maximum resolutions.
55#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
56pub struct VideoDecodeAcceleratorCapability {
57    /// Video codec profile that is supported, e.g. VP9 Profile 2.
58    pub profile: String,
59    /// Maximum video dimensions in pixels supported for this |profile|.
60    #[serde(rename = "maxResolution")]
61    pub max_resolution: Size,
62    /// Minimum video dimensions in pixels supported for this |profile|.
63    #[serde(rename = "minResolution")]
64    pub min_resolution: Size,
65}
66
67/// Describes a supported video encoding profile with its associated maximum
68/// resolution and maximum framerate.
69#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
70pub struct VideoEncodeAcceleratorCapability {
71    /// Video codec profile that is supported, e.g H264 Main.
72    pub profile: String,
73    /// Maximum video dimensions in pixels supported for this |profile|.
74    #[serde(rename = "maxResolution")]
75    pub max_resolution: Size,
76    /// Maximum encoding framerate in frames per second supported for this
77    /// |profile|, as fraction's numerator and denominator, e.g. 24/1 fps,
78    /// 24000/1001 fps, etc.
79    #[serde(rename = "maxFramerateNumerator")]
80    pub max_framerate_numerator: i64,
81    #[serde(rename = "maxFramerateDenominator")]
82    pub max_framerate_denominator: i64,
83}
84
85/// YUV subsampling type of the pixels of a given image.
86#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
87pub enum SubsamplingFormat {
88    /// `yuv420`
89    #[serde(rename = "yuv420")]
90    Yuv420,
91    /// `yuv422`
92    #[serde(rename = "yuv422")]
93    Yuv422,
94    /// `yuv444`
95    #[serde(rename = "yuv444")]
96    Yuv444,
97    /// A value this vendored schema does not list. Chrome adds values ahead of
98    /// the published protocol, so an unrecognised one is kept as it arrived
99    /// rather than failing the payload it came in.
100    #[serde(untagged)]
101    Unrecognized(String),
102}
103
104/// Image format of a given image.
105#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
106pub enum ImageType {
107    /// `jpeg`
108    #[serde(rename = "jpeg")]
109    Jpeg,
110    /// `webp`
111    #[serde(rename = "webp")]
112    Webp,
113    /// `unknown`
114    #[serde(rename = "unknown")]
115    Unknown,
116    /// A value this vendored schema does not list. Chrome adds values ahead of
117    /// the published protocol, so an unrecognised one is kept as it arrived
118    /// rather than failing the payload it came in.
119    #[serde(untagged)]
120    Unrecognized(String),
121}
122
123/// Provides information about the GPU(s) on the system.
124#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
125pub struct GpuInfo {
126    /// The graphics devices on the system. Element 0 is the primary GPU.
127    pub devices: Vec<GpuDevice>,
128    /// An optional dictionary of additional GPU related attributes.
129    #[serde(
130        rename = "auxAttributes",
131        default,
132        skip_serializing_if = "Option::is_none"
133    )]
134    pub aux_attributes: Option<serde_json::Value>,
135    /// An optional dictionary of graphics features and their status.
136    #[serde(
137        rename = "featureStatus",
138        default,
139        skip_serializing_if = "Option::is_none"
140    )]
141    pub feature_status: Option<serde_json::Value>,
142    /// An optional array of GPU driver bug workarounds.
143    #[serde(rename = "driverBugWorkarounds")]
144    pub driver_bug_workarounds: Vec<String>,
145    /// Supported accelerated video decoding capabilities.
146    #[serde(rename = "videoDecoding")]
147    pub video_decoding: Vec<VideoDecodeAcceleratorCapability>,
148    /// Supported accelerated video encoding capabilities.
149    #[serde(rename = "videoEncoding")]
150    pub video_encoding: Vec<VideoEncodeAcceleratorCapability>,
151}
152
153/// Represents process info.
154#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
155pub struct ProcessInfo {
156    /// Specifies process type.
157    pub r#type: String,
158    /// Specifies process id.
159    pub id: i64,
160    /// Specifies cumulative CPU usage in seconds across all threads of the
161    /// process since the process start.
162    #[serde(rename = "cpuTime")]
163    pub cpu_time: f64,
164}
165
166/// Returns information about the system.
167///
168/// Parameters of `SystemInfo.getInfo`.
169#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
170pub struct GetInfoParams {}
171
172/// What `SystemInfo.getInfo` answers with.
173#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
174pub struct GetInfoReturns {
175    /// Information about the GPUs on the system.
176    pub gpu: GpuInfo,
177    /// A platform-dependent description of the model of the machine. On Mac OS,
178    /// this is, for example, 'MacBookPro'. Will be the empty string if not
179    /// supported.
180    #[serde(rename = "modelName")]
181    pub model_name: String,
182    /// A platform-dependent description of the version of the machine. On Mac OS,
183    /// this is, for example, '10.1'. Will be the empty string if not supported.
184    #[serde(rename = "modelVersion")]
185    pub model_version: String,
186    /// The command line string used to launch the browser. Will be the empty
187    /// string if not supported.
188    #[serde(rename = "commandLine")]
189    pub command_line: String,
190}
191
192impl crate::typed::Command for GetInfoParams {
193    const METHOD: &'static str = "SystemInfo.getInfo";
194    type Returns = GetInfoReturns;
195}
196
197/// Returns information about the feature state.
198///
199/// Parameters of `SystemInfo.getFeatureState`.
200#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
201pub struct GetFeatureStateParams {
202    #[serde(rename = "featureState")]
203    pub feature_state: String,
204}
205
206/// What `SystemInfo.getFeatureState` answers with.
207#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
208pub struct GetFeatureStateReturns {
209    #[serde(rename = "featureEnabled")]
210    pub feature_enabled: bool,
211}
212
213impl crate::typed::Command for GetFeatureStateParams {
214    const METHOD: &'static str = "SystemInfo.getFeatureState";
215    type Returns = GetFeatureStateReturns;
216}
217
218/// Returns information about all running processes.
219///
220/// Parameters of `SystemInfo.getProcessInfo`.
221#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
222pub struct GetProcessInfoParams {}
223
224/// What `SystemInfo.getProcessInfo` answers with.
225#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
226pub struct GetProcessInfoReturns {
227    /// An array of process info blocks.
228    #[serde(rename = "processInfo")]
229    pub process_info: Vec<ProcessInfo>,
230}
231
232impl crate::typed::Command for GetProcessInfoParams {
233    const METHOD: &'static str = "SystemInfo.getProcessInfo";
234    type Returns = GetProcessInfoReturns;
235}