Skip to main content

rustenium_cdp_definitions/browser_protocol/memory/
commands.rs

1use serde::{Deserialize, Serialize};
2#[doc = "Retruns current DOM object counters.\n[getDOMCounters](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-getDOMCounters)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct GetDomCountersParams {}
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6pub enum GetDomCountersMethod {
7    #[serde(rename = "Memory.getDOMCounters")]
8    GetDomCounters,
9}
10#[doc = "Retruns current DOM object counters.\n[getDOMCounters](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-getDOMCounters)"]
11#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12pub struct GetDomCounters {
13    pub method: GetDomCountersMethod,
14    pub params: GetDomCountersParams,
15}
16impl GetDomCounters {
17    pub const IDENTIFIER: &'static str = "Memory.getDOMCounters";
18    pub fn identifier(&self) -> &'static str {
19        Self::IDENTIFIER
20    }
21}
22impl crate::CommandResult for GetDomCounters {
23    type Result = super::results::GetDomCountersResult;
24}
25#[doc = "Retruns DOM object counters after preparing renderer for leak detection.\n[getDOMCountersForLeakDetection](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-getDOMCountersForLeakDetection)"]
26#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
27pub struct GetDomCountersForLeakDetectionParams {}
28#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
29pub enum GetDomCountersForLeakDetectionMethod {
30    #[serde(rename = "Memory.getDOMCountersForLeakDetection")]
31    GetDomCountersForLeakDetection,
32}
33#[doc = "Retruns DOM object counters after preparing renderer for leak detection.\n[getDOMCountersForLeakDetection](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-getDOMCountersForLeakDetection)"]
34#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
35pub struct GetDomCountersForLeakDetection {
36    pub method: GetDomCountersForLeakDetectionMethod,
37    pub params: GetDomCountersForLeakDetectionParams,
38}
39impl GetDomCountersForLeakDetection {
40    pub const IDENTIFIER: &'static str = "Memory.getDOMCountersForLeakDetection";
41    pub fn identifier(&self) -> &'static str {
42        Self::IDENTIFIER
43    }
44}
45impl crate::CommandResult for GetDomCountersForLeakDetection {
46    type Result = super::results::GetDomCountersForLeakDetectionResult;
47}
48#[doc = "Prepares for leak detection by terminating workers, stopping spellcheckers,\ndropping non-essential internal caches, running garbage collections, etc.\n[prepareForLeakDetection](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-prepareForLeakDetection)"]
49#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
50pub struct PrepareForLeakDetectionParams {}
51#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
52pub enum PrepareForLeakDetectionMethod {
53    #[serde(rename = "Memory.prepareForLeakDetection")]
54    PrepareForLeakDetection,
55}
56#[doc = "Prepares for leak detection by terminating workers, stopping spellcheckers,\ndropping non-essential internal caches, running garbage collections, etc.\n[prepareForLeakDetection](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-prepareForLeakDetection)"]
57#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
58pub struct PrepareForLeakDetection {
59    pub method: PrepareForLeakDetectionMethod,
60    pub params: PrepareForLeakDetectionParams,
61}
62impl PrepareForLeakDetection {
63    pub const IDENTIFIER: &'static str = "Memory.prepareForLeakDetection";
64    pub fn identifier(&self) -> &'static str {
65        Self::IDENTIFIER
66    }
67}
68impl crate::CommandResult for PrepareForLeakDetection {
69    type Result = super::results::PrepareForLeakDetectionResult;
70}
71#[doc = "Simulate OomIntervention by purging V8 memory.\n[forciblyPurgeJavaScriptMemory](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-forciblyPurgeJavaScriptMemory)"]
72#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
73pub struct ForciblyPurgeJavaScriptMemoryParams {}
74#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
75pub enum ForciblyPurgeJavaScriptMemoryMethod {
76    #[serde(rename = "Memory.forciblyPurgeJavaScriptMemory")]
77    ForciblyPurgeJavaScriptMemory,
78}
79#[doc = "Simulate OomIntervention by purging V8 memory.\n[forciblyPurgeJavaScriptMemory](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-forciblyPurgeJavaScriptMemory)"]
80#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
81pub struct ForciblyPurgeJavaScriptMemory {
82    pub method: ForciblyPurgeJavaScriptMemoryMethod,
83    pub params: ForciblyPurgeJavaScriptMemoryParams,
84}
85impl ForciblyPurgeJavaScriptMemory {
86    pub const IDENTIFIER: &'static str = "Memory.forciblyPurgeJavaScriptMemory";
87    pub fn identifier(&self) -> &'static str {
88        Self::IDENTIFIER
89    }
90}
91impl crate::CommandResult for ForciblyPurgeJavaScriptMemory {
92    type Result = super::results::ForciblyPurgeJavaScriptMemoryResult;
93}
94#[doc = "Enable/disable suppressing memory pressure notifications in all processes.\n[setPressureNotificationsSuppressed](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-setPressureNotificationsSuppressed)"]
95#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
96pub struct SetPressureNotificationsSuppressedParams {
97    #[doc = "If true, memory pressure notifications will be suppressed."]
98    #[serde(rename = "suppressed")]
99    pub suppressed: bool,
100}
101impl SetPressureNotificationsSuppressedParams {
102    pub fn new(suppressed: impl Into<bool>) -> Self {
103        Self {
104            suppressed: suppressed.into(),
105        }
106    }
107}
108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
109pub enum SetPressureNotificationsSuppressedMethod {
110    #[serde(rename = "Memory.setPressureNotificationsSuppressed")]
111    SetPressureNotificationsSuppressed,
112}
113#[doc = "Enable/disable suppressing memory pressure notifications in all processes.\n[setPressureNotificationsSuppressed](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-setPressureNotificationsSuppressed)"]
114#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
115pub struct SetPressureNotificationsSuppressed {
116    pub method: SetPressureNotificationsSuppressedMethod,
117    pub params: SetPressureNotificationsSuppressedParams,
118}
119impl SetPressureNotificationsSuppressed {
120    pub const IDENTIFIER: &'static str = "Memory.setPressureNotificationsSuppressed";
121    pub fn identifier(&self) -> &'static str {
122        Self::IDENTIFIER
123    }
124}
125impl crate::CommandResult for SetPressureNotificationsSuppressed {
126    type Result = super::results::SetPressureNotificationsSuppressedResult;
127}
128#[doc = "Simulate a memory pressure notification in all processes.\n[simulatePressureNotification](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-simulatePressureNotification)"]
129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
130pub struct SimulatePressureNotificationParams {
131    #[doc = "Memory pressure level of the notification."]
132    #[serde(rename = "level")]
133    pub level: super::types::PressureLevel,
134}
135impl SimulatePressureNotificationParams {
136    pub fn new(level: impl Into<super::types::PressureLevel>) -> Self {
137        Self {
138            level: level.into(),
139        }
140    }
141}
142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
143pub enum SimulatePressureNotificationMethod {
144    #[serde(rename = "Memory.simulatePressureNotification")]
145    SimulatePressureNotification,
146}
147#[doc = "Simulate a memory pressure notification in all processes.\n[simulatePressureNotification](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-simulatePressureNotification)"]
148#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
149pub struct SimulatePressureNotification {
150    pub method: SimulatePressureNotificationMethod,
151    pub params: SimulatePressureNotificationParams,
152}
153impl SimulatePressureNotification {
154    pub const IDENTIFIER: &'static str = "Memory.simulatePressureNotification";
155    pub fn identifier(&self) -> &'static str {
156        Self::IDENTIFIER
157    }
158}
159impl crate::CommandResult for SimulatePressureNotification {
160    type Result = super::results::SimulatePressureNotificationResult;
161}
162#[doc = "Start collecting native memory profile.\n[startSampling](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-startSampling)"]
163#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
164pub struct StartSamplingParams {
165    #[doc = "Average number of bytes between samples."]
166    #[serde(rename = "samplingInterval")]
167    #[serde(skip_serializing_if = "Option::is_none")]
168    #[serde(default)]
169    pub sampling_interval: Option<i64>,
170    #[doc = "Do not randomize intervals between samples."]
171    #[serde(rename = "suppressRandomness")]
172    #[serde(skip_serializing_if = "Option::is_none")]
173    #[serde(default)]
174    pub suppress_randomness: Option<bool>,
175}
176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
177pub enum StartSamplingMethod {
178    #[serde(rename = "Memory.startSampling")]
179    StartSampling,
180}
181#[doc = "Start collecting native memory profile.\n[startSampling](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-startSampling)"]
182#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
183pub struct StartSampling {
184    pub method: StartSamplingMethod,
185    pub params: StartSamplingParams,
186}
187impl StartSampling {
188    pub const IDENTIFIER: &'static str = "Memory.startSampling";
189    pub fn identifier(&self) -> &'static str {
190        Self::IDENTIFIER
191    }
192}
193impl crate::CommandResult for StartSampling {
194    type Result = super::results::StartSamplingResult;
195}
196#[doc = "Stop collecting native memory profile.\n[stopSampling](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-stopSampling)"]
197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
198pub struct StopSamplingParams {}
199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
200pub enum StopSamplingMethod {
201    #[serde(rename = "Memory.stopSampling")]
202    StopSampling,
203}
204#[doc = "Stop collecting native memory profile.\n[stopSampling](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-stopSampling)"]
205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
206pub struct StopSampling {
207    pub method: StopSamplingMethod,
208    pub params: StopSamplingParams,
209}
210impl StopSampling {
211    pub const IDENTIFIER: &'static str = "Memory.stopSampling";
212    pub fn identifier(&self) -> &'static str {
213        Self::IDENTIFIER
214    }
215}
216impl crate::CommandResult for StopSampling {
217    type Result = super::results::StopSamplingResult;
218}
219#[doc = "Retrieve native memory allocations profile\ncollected since renderer process startup.\n[getAllTimeSamplingProfile](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-getAllTimeSamplingProfile)"]
220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
221pub struct GetAllTimeSamplingProfileParams {}
222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
223pub enum GetAllTimeSamplingProfileMethod {
224    #[serde(rename = "Memory.getAllTimeSamplingProfile")]
225    GetAllTimeSamplingProfile,
226}
227#[doc = "Retrieve native memory allocations profile\ncollected since renderer process startup.\n[getAllTimeSamplingProfile](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-getAllTimeSamplingProfile)"]
228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
229pub struct GetAllTimeSamplingProfile {
230    pub method: GetAllTimeSamplingProfileMethod,
231    pub params: GetAllTimeSamplingProfileParams,
232}
233impl GetAllTimeSamplingProfile {
234    pub const IDENTIFIER: &'static str = "Memory.getAllTimeSamplingProfile";
235    pub fn identifier(&self) -> &'static str {
236        Self::IDENTIFIER
237    }
238}
239impl crate::CommandResult for GetAllTimeSamplingProfile {
240    type Result = super::results::GetAllTimeSamplingProfileResult;
241}
242#[doc = "Retrieve native memory allocations profile\ncollected since browser process startup.\n[getBrowserSamplingProfile](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-getBrowserSamplingProfile)"]
243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
244pub struct GetBrowserSamplingProfileParams {}
245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
246pub enum GetBrowserSamplingProfileMethod {
247    #[serde(rename = "Memory.getBrowserSamplingProfile")]
248    GetBrowserSamplingProfile,
249}
250#[doc = "Retrieve native memory allocations profile\ncollected since browser process startup.\n[getBrowserSamplingProfile](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-getBrowserSamplingProfile)"]
251#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
252pub struct GetBrowserSamplingProfile {
253    pub method: GetBrowserSamplingProfileMethod,
254    pub params: GetBrowserSamplingProfileParams,
255}
256impl GetBrowserSamplingProfile {
257    pub const IDENTIFIER: &'static str = "Memory.getBrowserSamplingProfile";
258    pub fn identifier(&self) -> &'static str {
259        Self::IDENTIFIER
260    }
261}
262impl crate::CommandResult for GetBrowserSamplingProfile {
263    type Result = super::results::GetBrowserSamplingProfileResult;
264}
265#[doc = "Retrieve native memory allocations profile collected since last\n`startSampling` call.\n[getSamplingProfile](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-getSamplingProfile)"]
266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
267pub struct GetSamplingProfileParams {}
268#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
269pub enum GetSamplingProfileMethod {
270    #[serde(rename = "Memory.getSamplingProfile")]
271    GetSamplingProfile,
272}
273#[doc = "Retrieve native memory allocations profile collected since last\n`startSampling` call.\n[getSamplingProfile](https://chromedevtools.github.io/devtools-protocol/tot/Memory/#method-getSamplingProfile)"]
274#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
275pub struct GetSamplingProfile {
276    pub method: GetSamplingProfileMethod,
277    pub params: GetSamplingProfileParams,
278}
279impl GetSamplingProfile {
280    pub const IDENTIFIER: &'static str = "Memory.getSamplingProfile";
281    pub fn identifier(&self) -> &'static str {
282        Self::IDENTIFIER
283    }
284}
285impl crate::CommandResult for GetSamplingProfile {
286    type Result = super::results::GetSamplingProfileResult;
287}
288group_enum ! (MemoryCommands { GetDomCounters (GetDomCounters) , GetDomCountersForLeakDetection (GetDomCountersForLeakDetection) , PrepareForLeakDetection (PrepareForLeakDetection) , ForciblyPurgeJavaScriptMemory (ForciblyPurgeJavaScriptMemory) , SetPressureNotificationsSuppressed (SetPressureNotificationsSuppressed) , SimulatePressureNotification (SimulatePressureNotification) , StartSampling (StartSampling) , StopSampling (StopSampling) , GetAllTimeSamplingProfile (GetAllTimeSamplingProfile) , GetBrowserSamplingProfile (GetBrowserSamplingProfile) , GetSamplingProfile (GetSamplingProfile) } + identifiable);