1#![allow(dead_code)]
3#[allow(unused_imports)]
4use super::types::*;
5#[allow(unused_imports)]
6use derive_builder::Builder;
7#[allow(unused_imports)]
8use serde::{Deserialize, Serialize};
9#[allow(unused_imports)]
10use serde_json::Value as Json;
11#[allow(deprecated)]
12#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
13pub enum PressureLevel {
14 #[serde(rename = "moderate")]
15 Moderate,
16 #[serde(rename = "critical")]
17 Critical,
18}
19#[allow(deprecated)]
20#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
21#[builder(setter(into, strip_option))]
22#[serde(rename_all = "camelCase")]
23#[doc = "Heap profile sample."]
24pub struct SamplingProfileNode {
25 #[serde(default)]
26 #[doc = "Size of the sampled allocation."]
27 pub size: JsFloat,
28 #[serde(default)]
29 #[doc = "Total bytes attributed to this sample."]
30 pub total: JsFloat,
31 #[serde(default)]
32 #[doc = "Execution stack at the point of allocation."]
33 pub stack: Vec<String>,
34}
35#[allow(deprecated)]
36#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
37#[builder(setter(into, strip_option))]
38#[serde(rename_all = "camelCase")]
39#[doc = "Array of heap profile samples."]
40pub struct SamplingProfile {
41 pub samples: Vec<SamplingProfileNode>,
42 pub modules: Vec<Module>,
43}
44#[allow(deprecated)]
45#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
46#[builder(setter(into, strip_option))]
47#[serde(rename_all = "camelCase")]
48#[doc = "Executable module information"]
49pub struct Module {
50 #[serde(default)]
51 #[doc = "Name of the module."]
52 pub name: String,
53 #[serde(default)]
54 #[doc = "UUID of the module."]
55 pub uuid: String,
56 #[serde(default)]
57 #[doc = "Base address where the module is loaded into memory. Encoded as a decimal\n or hexadecimal (0x prefixed) string."]
58 pub base_address: String,
59 #[serde(default)]
60 #[doc = "Size of the module in bytes."]
61 pub size: JsFloat,
62}
63#[allow(deprecated)]
64#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
65#[builder(setter(into, strip_option))]
66#[serde(rename_all = "camelCase")]
67#[doc = "DOM object counter data."]
68pub struct DomCounter {
69 #[serde(default)]
70 #[doc = "Object name. Note: object names should be presumed volatile and clients should not expect\n the returned names to be consistent across runs."]
71 pub name: String,
72 #[serde(default)]
73 #[doc = "Object count."]
74 pub count: JsUInt,
75}
76#[allow(deprecated)]
77#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
78pub struct GetDOMCounters(pub Option<Json>);
79#[allow(deprecated)]
80#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
81pub struct GetDOMCountersForLeakDetection(pub Option<Json>);
82#[allow(deprecated)]
83#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
84pub struct PrepareForLeakDetection(pub Option<Json>);
85#[allow(deprecated)]
86#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
87pub struct ForciblyPurgeJavaScriptMemory(pub Option<Json>);
88#[allow(deprecated)]
89#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
90#[builder(setter(into, strip_option))]
91#[serde(rename_all = "camelCase")]
92#[doc = "Enable/disable suppressing memory pressure notifications in all processes."]
93pub struct SetPressureNotificationsSuppressed {
94 #[serde(default)]
95 #[doc = "If true, memory pressure notifications will be suppressed."]
96 pub suppressed: bool,
97}
98#[allow(deprecated)]
99#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
100#[builder(setter(into, strip_option))]
101#[serde(rename_all = "camelCase")]
102#[doc = "Simulate a memory pressure notification in all processes."]
103pub struct SimulatePressureNotification {
104 #[doc = "Memory pressure level of the notification."]
105 pub level: PressureLevel,
106}
107#[allow(deprecated)]
108#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
109#[builder(setter(into, strip_option))]
110#[serde(rename_all = "camelCase")]
111#[doc = "Start collecting native memory profile."]
112pub struct StartSampling {
113 #[builder(default)]
114 #[serde(skip_serializing_if = "Option::is_none")]
115 #[serde(default)]
116 #[doc = "Average number of bytes between samples."]
117 pub sampling_interval: Option<JsUInt>,
118 #[builder(default)]
119 #[serde(skip_serializing_if = "Option::is_none")]
120 #[serde(default)]
121 #[doc = "Do not randomize intervals between samples."]
122 pub suppress_randomness: Option<bool>,
123}
124#[allow(deprecated)]
125#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
126pub struct StopSampling(pub Option<Json>);
127#[allow(deprecated)]
128#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
129pub struct GetAllTimeSamplingProfile(pub Option<Json>);
130#[allow(deprecated)]
131#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
132pub struct GetBrowserSamplingProfile(pub Option<Json>);
133#[allow(deprecated)]
134#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
135pub struct GetSamplingProfile(pub Option<Json>);
136#[allow(deprecated)]
137#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
138#[serde(rename_all = "camelCase")]
139#[doc = "Retruns current DOM object counters."]
140pub struct GetDOMCountersReturnObject {
141 #[serde(default)]
142 pub documents: JsUInt,
143 #[serde(default)]
144 pub nodes: JsUInt,
145 #[serde(default)]
146 pub js_event_listeners: JsUInt,
147}
148#[allow(deprecated)]
149#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
150#[serde(rename_all = "camelCase")]
151#[doc = "Retruns DOM object counters after preparing renderer for leak detection."]
152pub struct GetDOMCountersForLeakDetectionReturnObject {
153 #[doc = "DOM object counters."]
154 pub counters: Vec<DomCounter>,
155}
156#[allow(deprecated)]
157#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
158#[doc = "Prepares for leak detection by terminating workers, stopping spellcheckers,\n dropping non-essential internal caches, running garbage collections, etc."]
159pub struct PrepareForLeakDetectionReturnObject(pub Option<Json>);
160#[allow(deprecated)]
161#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
162#[doc = "Simulate OomIntervention by purging V8 memory."]
163pub struct ForciblyPurgeJavaScriptMemoryReturnObject(pub Option<Json>);
164#[allow(deprecated)]
165#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
166#[doc = "Enable/disable suppressing memory pressure notifications in all processes."]
167pub struct SetPressureNotificationsSuppressedReturnObject(pub Option<Json>);
168#[allow(deprecated)]
169#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
170#[doc = "Simulate a memory pressure notification in all processes."]
171pub struct SimulatePressureNotificationReturnObject(pub Option<Json>);
172#[allow(deprecated)]
173#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
174#[doc = "Start collecting native memory profile."]
175pub struct StartSamplingReturnObject(pub Option<Json>);
176#[allow(deprecated)]
177#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
178#[doc = "Stop collecting native memory profile."]
179pub struct StopSamplingReturnObject(pub Option<Json>);
180#[allow(deprecated)]
181#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
182#[serde(rename_all = "camelCase")]
183#[doc = "Retrieve native memory allocations profile\n collected since renderer process startup."]
184pub struct GetAllTimeSamplingProfileReturnObject {
185 pub profile: SamplingProfile,
186}
187#[allow(deprecated)]
188#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
189#[serde(rename_all = "camelCase")]
190#[doc = "Retrieve native memory allocations profile\n collected since browser process startup."]
191pub struct GetBrowserSamplingProfileReturnObject {
192 pub profile: SamplingProfile,
193}
194#[allow(deprecated)]
195#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
196#[serde(rename_all = "camelCase")]
197#[doc = "Retrieve native memory allocations profile collected since last\n `startSampling` call."]
198pub struct GetSamplingProfileReturnObject {
199 pub profile: SamplingProfile,
200}
201#[allow(deprecated)]
202impl Method for GetDOMCounters {
203 const NAME: &'static str = "Memory.getDOMCounters";
204 type ReturnObject = GetDOMCountersReturnObject;
205}
206#[allow(deprecated)]
207impl Method for GetDOMCountersForLeakDetection {
208 const NAME: &'static str = "Memory.getDOMCountersForLeakDetection";
209 type ReturnObject = GetDOMCountersForLeakDetectionReturnObject;
210}
211#[allow(deprecated)]
212impl Method for PrepareForLeakDetection {
213 const NAME: &'static str = "Memory.prepareForLeakDetection";
214 type ReturnObject = PrepareForLeakDetectionReturnObject;
215}
216#[allow(deprecated)]
217impl Method for ForciblyPurgeJavaScriptMemory {
218 const NAME: &'static str = "Memory.forciblyPurgeJavaScriptMemory";
219 type ReturnObject = ForciblyPurgeJavaScriptMemoryReturnObject;
220}
221#[allow(deprecated)]
222impl Method for SetPressureNotificationsSuppressed {
223 const NAME: &'static str = "Memory.setPressureNotificationsSuppressed";
224 type ReturnObject = SetPressureNotificationsSuppressedReturnObject;
225}
226#[allow(deprecated)]
227impl Method for SimulatePressureNotification {
228 const NAME: &'static str = "Memory.simulatePressureNotification";
229 type ReturnObject = SimulatePressureNotificationReturnObject;
230}
231#[allow(deprecated)]
232impl Method for StartSampling {
233 const NAME: &'static str = "Memory.startSampling";
234 type ReturnObject = StartSamplingReturnObject;
235}
236#[allow(deprecated)]
237impl Method for StopSampling {
238 const NAME: &'static str = "Memory.stopSampling";
239 type ReturnObject = StopSamplingReturnObject;
240}
241#[allow(deprecated)]
242impl Method for GetAllTimeSamplingProfile {
243 const NAME: &'static str = "Memory.getAllTimeSamplingProfile";
244 type ReturnObject = GetAllTimeSamplingProfileReturnObject;
245}
246#[allow(deprecated)]
247impl Method for GetBrowserSamplingProfile {
248 const NAME: &'static str = "Memory.getBrowserSamplingProfile";
249 type ReturnObject = GetBrowserSamplingProfileReturnObject;
250}
251#[allow(deprecated)]
252impl Method for GetSamplingProfile {
253 const NAME: &'static str = "Memory.getSamplingProfile";
254 type ReturnObject = GetSamplingProfileReturnObject;
255}
256#[allow(dead_code)]
257pub mod events {
258 #[allow(unused_imports)]
259 use super::super::types::*;
260 #[allow(unused_imports)]
261 use derive_builder::Builder;
262 #[allow(unused_imports)]
263 use serde::{Deserialize, Serialize};
264 #[allow(unused_imports)]
265 use serde_json::Value as Json;
266}