1use serde::{Serialize, Deserialize};
2use serde_json::Value as JsonValue;
3
4#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
7pub enum PressureLevel {
8 #[default]
9 Moderate,
10 Critical,
11}
12
13#[derive(Debug, Clone, Serialize, Deserialize, Default)]
16#[serde(rename_all = "camelCase")]
17pub struct SamplingProfileNode {
18 pub size: f64,
21 pub total: f64,
24 pub stack: Vec<String>,
27}
28
29#[derive(Debug, Clone, Serialize, Deserialize, Default)]
32#[serde(rename_all = "camelCase")]
33pub struct SamplingProfile {
34
35 pub samples: Vec<SamplingProfileNode>,
36
37 pub modules: Vec<Module>,
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize, Default)]
43#[serde(rename_all = "camelCase")]
44pub struct Module {
45 pub name: String,
48 pub uuid: String,
51 pub baseAddress: String,
55 pub size: f64,
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize, Default)]
63#[serde(rename_all = "camelCase")]
64pub struct DOMCounter {
65 pub name: String,
69 pub count: u64,
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize, Default)]
77#[serde(rename_all = "camelCase")]
78pub struct GetDOMCountersReturns {
79
80 pub documents: i64,
81
82 pub nodes: i64,
83
84 pub jsEventListeners: i64,
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize, Default)]
88pub struct GetDOMCountersParams {}
89
90impl GetDOMCountersParams { pub const METHOD: &'static str = "Memory.getDOMCounters"; }
91
92impl crate::CdpCommand for GetDOMCountersParams {
93 const METHOD: &'static str = "Memory.getDOMCounters";
94 type Response = GetDOMCountersReturns;
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize, Default)]
100#[serde(rename_all = "camelCase")]
101pub struct GetDOMCountersForLeakDetectionReturns {
102 pub counters: Vec<DOMCounter>,
105}
106
107#[derive(Debug, Clone, Serialize, Deserialize, Default)]
108pub struct GetDOMCountersForLeakDetectionParams {}
109
110impl GetDOMCountersForLeakDetectionParams { pub const METHOD: &'static str = "Memory.getDOMCountersForLeakDetection"; }
111
112impl crate::CdpCommand for GetDOMCountersForLeakDetectionParams {
113 const METHOD: &'static str = "Memory.getDOMCountersForLeakDetection";
114 type Response = GetDOMCountersForLeakDetectionReturns;
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize, Default)]
118pub struct PrepareForLeakDetectionParams {}
119
120impl PrepareForLeakDetectionParams { pub const METHOD: &'static str = "Memory.prepareForLeakDetection"; }
121
122impl crate::CdpCommand for PrepareForLeakDetectionParams {
123 const METHOD: &'static str = "Memory.prepareForLeakDetection";
124 type Response = crate::EmptyReturns;
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize, Default)]
128pub struct ForciblyPurgeJavaScriptMemoryParams {}
129
130impl ForciblyPurgeJavaScriptMemoryParams { pub const METHOD: &'static str = "Memory.forciblyPurgeJavaScriptMemory"; }
131
132impl crate::CdpCommand for ForciblyPurgeJavaScriptMemoryParams {
133 const METHOD: &'static str = "Memory.forciblyPurgeJavaScriptMemory";
134 type Response = crate::EmptyReturns;
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize, Default)]
140#[serde(rename_all = "camelCase")]
141pub struct SetPressureNotificationsSuppressedParams {
142 pub suppressed: bool,
145}
146
147impl SetPressureNotificationsSuppressedParams { pub const METHOD: &'static str = "Memory.setPressureNotificationsSuppressed"; }
148
149impl crate::CdpCommand for SetPressureNotificationsSuppressedParams {
150 const METHOD: &'static str = "Memory.setPressureNotificationsSuppressed";
151 type Response = crate::EmptyReturns;
152}
153
154#[derive(Debug, Clone, Serialize, Deserialize, Default)]
157#[serde(rename_all = "camelCase")]
158pub struct SimulatePressureNotificationParams {
159 pub level: PressureLevel,
162}
163
164impl SimulatePressureNotificationParams { pub const METHOD: &'static str = "Memory.simulatePressureNotification"; }
165
166impl crate::CdpCommand for SimulatePressureNotificationParams {
167 const METHOD: &'static str = "Memory.simulatePressureNotification";
168 type Response = crate::EmptyReturns;
169}
170
171#[derive(Debug, Clone, Serialize, Deserialize, Default)]
174#[serde(rename_all = "camelCase")]
175pub struct StartSamplingParams {
176 #[serde(skip_serializing_if = "Option::is_none")]
179 pub samplingInterval: Option<i64>,
180 #[serde(skip_serializing_if = "Option::is_none")]
183 pub suppressRandomness: Option<bool>,
184}
185
186impl StartSamplingParams { pub const METHOD: &'static str = "Memory.startSampling"; }
187
188impl crate::CdpCommand for StartSamplingParams {
189 const METHOD: &'static str = "Memory.startSampling";
190 type Response = crate::EmptyReturns;
191}
192
193#[derive(Debug, Clone, Serialize, Deserialize, Default)]
194pub struct StopSamplingParams {}
195
196impl StopSamplingParams { pub const METHOD: &'static str = "Memory.stopSampling"; }
197
198impl crate::CdpCommand for StopSamplingParams {
199 const METHOD: &'static str = "Memory.stopSampling";
200 type Response = crate::EmptyReturns;
201}
202
203#[derive(Debug, Clone, Serialize, Deserialize, Default)]
207#[serde(rename_all = "camelCase")]
208pub struct GetAllTimeSamplingProfileReturns {
209
210 pub profile: SamplingProfile,
211}
212
213#[derive(Debug, Clone, Serialize, Deserialize, Default)]
214pub struct GetAllTimeSamplingProfileParams {}
215
216impl GetAllTimeSamplingProfileParams { pub const METHOD: &'static str = "Memory.getAllTimeSamplingProfile"; }
217
218impl crate::CdpCommand for GetAllTimeSamplingProfileParams {
219 const METHOD: &'static str = "Memory.getAllTimeSamplingProfile";
220 type Response = GetAllTimeSamplingProfileReturns;
221}
222
223#[derive(Debug, Clone, Serialize, Deserialize, Default)]
227#[serde(rename_all = "camelCase")]
228pub struct GetBrowserSamplingProfileReturns {
229
230 pub profile: SamplingProfile,
231}
232
233#[derive(Debug, Clone, Serialize, Deserialize, Default)]
234pub struct GetBrowserSamplingProfileParams {}
235
236impl GetBrowserSamplingProfileParams { pub const METHOD: &'static str = "Memory.getBrowserSamplingProfile"; }
237
238impl crate::CdpCommand for GetBrowserSamplingProfileParams {
239 const METHOD: &'static str = "Memory.getBrowserSamplingProfile";
240 type Response = GetBrowserSamplingProfileReturns;
241}
242
243#[derive(Debug, Clone, Serialize, Deserialize, Default)]
247#[serde(rename_all = "camelCase")]
248pub struct GetSamplingProfileReturns {
249
250 pub profile: SamplingProfile,
251}
252
253#[derive(Debug, Clone, Serialize, Deserialize, Default)]
254pub struct GetSamplingProfileParams {}
255
256impl GetSamplingProfileParams { pub const METHOD: &'static str = "Memory.getSamplingProfile"; }
257
258impl crate::CdpCommand for GetSamplingProfileParams {
259 const METHOD: &'static str = "Memory.getSamplingProfile";
260 type Response = GetSamplingProfileReturns;
261}