use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum PressureLevel {
#[serde(rename = "moderate")]
Moderate,
#[serde(rename = "critical")]
Critical,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SamplingProfileNode {
pub size: f64,
pub total: f64,
pub stack: Vec<String>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SamplingProfile {
pub samples: Vec<SamplingProfileNode>,
pub modules: Vec<Module>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Module {
pub name: String,
pub uuid: String,
#[serde(rename = "baseAddress")]
pub base_address: String,
pub size: f64,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DomCounter {
pub name: String,
pub count: i64,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetDomCountersParams {}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetDomCountersReturns {
pub documents: i64,
pub nodes: i64,
#[serde(rename = "jsEventListeners")]
pub js_event_listeners: i64,
}
impl crate::typed::Command for GetDomCountersParams {
const METHOD: &'static str = "Memory.getDOMCounters";
type Returns = GetDomCountersReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetDomCountersForLeakDetectionParams {}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetDomCountersForLeakDetectionReturns {
pub counters: Vec<DomCounter>,
}
impl crate::typed::Command for GetDomCountersForLeakDetectionParams {
const METHOD: &'static str = "Memory.getDOMCountersForLeakDetection";
type Returns = GetDomCountersForLeakDetectionReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct PrepareForLeakDetectionParams {}
impl crate::typed::Command for PrepareForLeakDetectionParams {
const METHOD: &'static str = "Memory.prepareForLeakDetection";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ForciblyPurgeJavaScriptMemoryParams {}
impl crate::typed::Command for ForciblyPurgeJavaScriptMemoryParams {
const METHOD: &'static str = "Memory.forciblyPurgeJavaScriptMemory";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetPressureNotificationsSuppressedParams {
pub suppressed: bool,
}
impl crate::typed::Command for SetPressureNotificationsSuppressedParams {
const METHOD: &'static str = "Memory.setPressureNotificationsSuppressed";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SimulatePressureNotificationParams {
pub level: PressureLevel,
}
impl crate::typed::Command for SimulatePressureNotificationParams {
const METHOD: &'static str = "Memory.simulatePressureNotification";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct StartSamplingParams {
#[serde(
rename = "samplingInterval",
default,
skip_serializing_if = "Option::is_none"
)]
pub sampling_interval: Option<i64>,
#[serde(
rename = "suppressRandomness",
default,
skip_serializing_if = "Option::is_none"
)]
pub suppress_randomness: Option<bool>,
}
impl crate::typed::Command for StartSamplingParams {
const METHOD: &'static str = "Memory.startSampling";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct StopSamplingParams {}
impl crate::typed::Command for StopSamplingParams {
const METHOD: &'static str = "Memory.stopSampling";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetAllTimeSamplingProfileParams {}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetAllTimeSamplingProfileReturns {
pub profile: SamplingProfile,
}
impl crate::typed::Command for GetAllTimeSamplingProfileParams {
const METHOD: &'static str = "Memory.getAllTimeSamplingProfile";
type Returns = GetAllTimeSamplingProfileReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetBrowserSamplingProfileParams {}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetBrowserSamplingProfileReturns {
pub profile: SamplingProfile,
}
impl crate::typed::Command for GetBrowserSamplingProfileParams {
const METHOD: &'static str = "Memory.getBrowserSamplingProfile";
type Returns = GetBrowserSamplingProfileReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetSamplingProfileParams {}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetSamplingProfileReturns {
pub profile: SamplingProfile,
}
impl crate::typed::Command for GetSamplingProfileParams {
const METHOD: &'static str = "Memory.getSamplingProfile";
type Returns = GetSamplingProfileReturns;
}