use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum PressureLevel {
#[default]
Moderate,
Critical,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SamplingProfileNode {
pub size: f64,
pub total: f64,
pub stack: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SamplingProfile {
pub samples: Vec<SamplingProfileNode>,
pub modules: Vec<Module>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct Module {
pub name: String,
pub uuid: String,
pub baseAddress: String,
pub size: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DOMCounter {
pub name: String,
pub count: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetDOMCountersReturns {
pub documents: i64,
pub nodes: i64,
pub jsEventListeners: i64,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct GetDOMCountersParams {}
impl GetDOMCountersParams { pub const METHOD: &'static str = "Memory.getDOMCounters"; }
impl crate::CdpCommand for GetDOMCountersParams {
const METHOD: &'static str = "Memory.getDOMCounters";
type Response = GetDOMCountersReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetDOMCountersForLeakDetectionReturns {
pub counters: Vec<DOMCounter>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct GetDOMCountersForLeakDetectionParams {}
impl GetDOMCountersForLeakDetectionParams { pub const METHOD: &'static str = "Memory.getDOMCountersForLeakDetection"; }
impl crate::CdpCommand for GetDOMCountersForLeakDetectionParams {
const METHOD: &'static str = "Memory.getDOMCountersForLeakDetection";
type Response = GetDOMCountersForLeakDetectionReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct PrepareForLeakDetectionParams {}
impl PrepareForLeakDetectionParams { pub const METHOD: &'static str = "Memory.prepareForLeakDetection"; }
impl crate::CdpCommand for PrepareForLeakDetectionParams {
const METHOD: &'static str = "Memory.prepareForLeakDetection";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct ForciblyPurgeJavaScriptMemoryParams {}
impl ForciblyPurgeJavaScriptMemoryParams { pub const METHOD: &'static str = "Memory.forciblyPurgeJavaScriptMemory"; }
impl crate::CdpCommand for ForciblyPurgeJavaScriptMemoryParams {
const METHOD: &'static str = "Memory.forciblyPurgeJavaScriptMemory";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetPressureNotificationsSuppressedParams {
pub suppressed: bool,
}
impl SetPressureNotificationsSuppressedParams { pub const METHOD: &'static str = "Memory.setPressureNotificationsSuppressed"; }
impl crate::CdpCommand for SetPressureNotificationsSuppressedParams {
const METHOD: &'static str = "Memory.setPressureNotificationsSuppressed";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SimulatePressureNotificationParams {
pub level: PressureLevel,
}
impl SimulatePressureNotificationParams { pub const METHOD: &'static str = "Memory.simulatePressureNotification"; }
impl crate::CdpCommand for SimulatePressureNotificationParams {
const METHOD: &'static str = "Memory.simulatePressureNotification";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct StartSamplingParams {
#[serde(skip_serializing_if = "Option::is_none")]
pub samplingInterval: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub suppressRandomness: Option<bool>,
}
impl StartSamplingParams { pub const METHOD: &'static str = "Memory.startSampling"; }
impl crate::CdpCommand for StartSamplingParams {
const METHOD: &'static str = "Memory.startSampling";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct StopSamplingParams {}
impl StopSamplingParams { pub const METHOD: &'static str = "Memory.stopSampling"; }
impl crate::CdpCommand for StopSamplingParams {
const METHOD: &'static str = "Memory.stopSampling";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetAllTimeSamplingProfileReturns {
pub profile: SamplingProfile,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct GetAllTimeSamplingProfileParams {}
impl GetAllTimeSamplingProfileParams { pub const METHOD: &'static str = "Memory.getAllTimeSamplingProfile"; }
impl crate::CdpCommand for GetAllTimeSamplingProfileParams {
const METHOD: &'static str = "Memory.getAllTimeSamplingProfile";
type Response = GetAllTimeSamplingProfileReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetBrowserSamplingProfileReturns {
pub profile: SamplingProfile,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct GetBrowserSamplingProfileParams {}
impl GetBrowserSamplingProfileParams { pub const METHOD: &'static str = "Memory.getBrowserSamplingProfile"; }
impl crate::CdpCommand for GetBrowserSamplingProfileParams {
const METHOD: &'static str = "Memory.getBrowserSamplingProfile";
type Response = GetBrowserSamplingProfileReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetSamplingProfileReturns {
pub profile: SamplingProfile,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct GetSamplingProfileParams {}
impl GetSamplingProfileParams { pub const METHOD: &'static str = "Memory.getSamplingProfile"; }
impl crate::CdpCommand for GetSamplingProfileParams {
const METHOD: &'static str = "Memory.getSamplingProfile";
type Response = GetSamplingProfileReturns;
}