1use serde::{Deserialize, Serialize};
13
14#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
16pub enum PressureLevel {
17 #[serde(rename = "moderate")]
19 Moderate,
20 #[serde(rename = "critical")]
22 Critical,
23 #[serde(untagged)]
27 Unrecognized(String),
28}
29
30#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
32pub struct SamplingProfileNode {
33 pub size: f64,
35 pub total: f64,
37 pub stack: Vec<String>,
39}
40
41#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
43pub struct SamplingProfile {
44 pub samples: Vec<SamplingProfileNode>,
45 pub modules: Vec<Module>,
46}
47
48#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
50pub struct Module {
51 pub name: String,
53 pub uuid: String,
55 #[serde(rename = "baseAddress")]
58 pub base_address: String,
59 pub size: f64,
61}
62
63#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
65pub struct DomCounter {
66 pub name: String,
69 pub count: i64,
71}
72
73#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
77pub struct GetDomCountersParams {}
78
79#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
81pub struct GetDomCountersReturns {
82 pub documents: i64,
83 pub nodes: i64,
84 #[serde(rename = "jsEventListeners")]
85 pub js_event_listeners: i64,
86}
87
88impl crate::typed::Command for GetDomCountersParams {
89 const METHOD: &'static str = "Memory.getDOMCounters";
90 type Returns = GetDomCountersReturns;
91}
92
93#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
97pub struct GetDomCountersForLeakDetectionParams {}
98
99#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
101pub struct GetDomCountersForLeakDetectionReturns {
102 pub counters: Vec<DomCounter>,
104}
105
106impl crate::typed::Command for GetDomCountersForLeakDetectionParams {
107 const METHOD: &'static str = "Memory.getDOMCountersForLeakDetection";
108 type Returns = GetDomCountersForLeakDetectionReturns;
109}
110
111#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
117pub struct PrepareForLeakDetectionParams {}
118
119impl crate::typed::Command for PrepareForLeakDetectionParams {
120 const METHOD: &'static str = "Memory.prepareForLeakDetection";
121 type Returns = crate::typed::NoReturns;
122}
123
124#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
128pub struct ForciblyPurgeJavaScriptMemoryParams {}
129
130impl crate::typed::Command for ForciblyPurgeJavaScriptMemoryParams {
131 const METHOD: &'static str = "Memory.forciblyPurgeJavaScriptMemory";
132 type Returns = crate::typed::NoReturns;
133}
134
135#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
139pub struct SetPressureNotificationsSuppressedParams {
140 pub suppressed: bool,
142}
143
144impl crate::typed::Command for SetPressureNotificationsSuppressedParams {
145 const METHOD: &'static str = "Memory.setPressureNotificationsSuppressed";
146 type Returns = crate::typed::NoReturns;
147}
148
149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
153pub struct SimulatePressureNotificationParams {
154 pub level: PressureLevel,
156}
157
158impl crate::typed::Command for SimulatePressureNotificationParams {
159 const METHOD: &'static str = "Memory.simulatePressureNotification";
160 type Returns = crate::typed::NoReturns;
161}
162
163#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
167pub struct StartSamplingParams {
168 #[serde(
170 rename = "samplingInterval",
171 default,
172 skip_serializing_if = "Option::is_none"
173 )]
174 pub sampling_interval: Option<i64>,
175 #[serde(
177 rename = "suppressRandomness",
178 default,
179 skip_serializing_if = "Option::is_none"
180 )]
181 pub suppress_randomness: Option<bool>,
182}
183
184impl crate::typed::Command for StartSamplingParams {
185 const METHOD: &'static str = "Memory.startSampling";
186 type Returns = crate::typed::NoReturns;
187}
188
189#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
193pub struct StopSamplingParams {}
194
195impl crate::typed::Command for StopSamplingParams {
196 const METHOD: &'static str = "Memory.stopSampling";
197 type Returns = crate::typed::NoReturns;
198}
199
200#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
205pub struct GetAllTimeSamplingProfileParams {}
206
207#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
209pub struct GetAllTimeSamplingProfileReturns {
210 pub profile: SamplingProfile,
211}
212
213impl crate::typed::Command for GetAllTimeSamplingProfileParams {
214 const METHOD: &'static str = "Memory.getAllTimeSamplingProfile";
215 type Returns = GetAllTimeSamplingProfileReturns;
216}
217
218#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
223pub struct GetBrowserSamplingProfileParams {}
224
225#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
227pub struct GetBrowserSamplingProfileReturns {
228 pub profile: SamplingProfile,
229}
230
231impl crate::typed::Command for GetBrowserSamplingProfileParams {
232 const METHOD: &'static str = "Memory.getBrowserSamplingProfile";
233 type Returns = GetBrowserSamplingProfileReturns;
234}
235
236#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
241pub struct GetSamplingProfileParams {}
242
243#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
245pub struct GetSamplingProfileReturns {
246 pub profile: SamplingProfile,
247}
248
249impl crate::typed::Command for GetSamplingProfileParams {
250 const METHOD: &'static str = "Memory.getSamplingProfile";
251 type Returns = GetSamplingProfileReturns;
252}