package memory
import (
"context"
"github.com/chromedp/cdproto/cdp"
)
type GetDOMCountersParams struct {}
func GetDOMCounters () *GetDOMCountersParams {
return &GetDOMCountersParams {}
}
type GetDOMCountersReturns struct {
Documents int64 `json:"documents,omitempty"`
Nodes int64 `json:"nodes,omitempty"`
JsEventListeners int64 `json:"jsEventListeners,omitempty"`
}
func (p *GetDOMCountersParams ) Do (ctx context .Context ) (documents int64 , nodes int64 , jsEventListeners int64 , err error ) {
var res GetDOMCountersReturns
err = cdp .Execute (ctx , CommandGetDOMCounters , nil , &res )
if err != nil {
return 0 , 0 , 0 , err
}
return res .Documents , res .Nodes , res .JsEventListeners , nil
}
type PrepareForLeakDetectionParams struct {}
func PrepareForLeakDetection () *PrepareForLeakDetectionParams {
return &PrepareForLeakDetectionParams {}
}
func (p *PrepareForLeakDetectionParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandPrepareForLeakDetection , nil , nil )
}
type ForciblyPurgeJavaScriptMemoryParams struct {}
func ForciblyPurgeJavaScriptMemory () *ForciblyPurgeJavaScriptMemoryParams {
return &ForciblyPurgeJavaScriptMemoryParams {}
}
func (p *ForciblyPurgeJavaScriptMemoryParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandForciblyPurgeJavaScriptMemory , nil , nil )
}
type SetPressureNotificationsSuppressedParams struct {
Suppressed bool `json:"suppressed"`
}
func SetPressureNotificationsSuppressed (suppressed bool ) *SetPressureNotificationsSuppressedParams {
return &SetPressureNotificationsSuppressedParams {
Suppressed : suppressed ,
}
}
func (p *SetPressureNotificationsSuppressedParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetPressureNotificationsSuppressed , p , nil )
}
type SimulatePressureNotificationParams struct {
Level PressureLevel `json:"level"`
}
func SimulatePressureNotification (level PressureLevel ) *SimulatePressureNotificationParams {
return &SimulatePressureNotificationParams {
Level : level ,
}
}
func (p *SimulatePressureNotificationParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSimulatePressureNotification , p , nil )
}
type StartSamplingParams struct {
SamplingInterval int64 `json:"samplingInterval,omitempty"`
SuppressRandomness bool `json:"suppressRandomness,omitempty"`
}
func StartSampling () *StartSamplingParams {
return &StartSamplingParams {}
}
func (p StartSamplingParams ) WithSamplingInterval (samplingInterval int64 ) *StartSamplingParams {
p .SamplingInterval = samplingInterval
return &p
}
func (p StartSamplingParams ) WithSuppressRandomness (suppressRandomness bool ) *StartSamplingParams {
p .SuppressRandomness = suppressRandomness
return &p
}
func (p *StartSamplingParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandStartSampling , p , nil )
}
type StopSamplingParams struct {}
func StopSampling () *StopSamplingParams {
return &StopSamplingParams {}
}
func (p *StopSamplingParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandStopSampling , nil , nil )
}
type GetAllTimeSamplingProfileParams struct {}
func GetAllTimeSamplingProfile () *GetAllTimeSamplingProfileParams {
return &GetAllTimeSamplingProfileParams {}
}
type GetAllTimeSamplingProfileReturns struct {
Profile *SamplingProfile `json:"profile,omitempty"`
}
func (p *GetAllTimeSamplingProfileParams ) Do (ctx context .Context ) (profile *SamplingProfile , err error ) {
var res GetAllTimeSamplingProfileReturns
err = cdp .Execute (ctx , CommandGetAllTimeSamplingProfile , nil , &res )
if err != nil {
return nil , err
}
return res .Profile , nil
}
type GetBrowserSamplingProfileParams struct {}
func GetBrowserSamplingProfile () *GetBrowserSamplingProfileParams {
return &GetBrowserSamplingProfileParams {}
}
type GetBrowserSamplingProfileReturns struct {
Profile *SamplingProfile `json:"profile,omitempty"`
}
func (p *GetBrowserSamplingProfileParams ) Do (ctx context .Context ) (profile *SamplingProfile , err error ) {
var res GetBrowserSamplingProfileReturns
err = cdp .Execute (ctx , CommandGetBrowserSamplingProfile , nil , &res )
if err != nil {
return nil , err
}
return res .Profile , nil
}
type GetSamplingProfileParams struct {}
func GetSamplingProfile () *GetSamplingProfileParams {
return &GetSamplingProfileParams {}
}
type GetSamplingProfileReturns struct {
Profile *SamplingProfile `json:"profile,omitempty"`
}
func (p *GetSamplingProfileParams ) Do (ctx context .Context ) (profile *SamplingProfile , err error ) {
var res GetSamplingProfileReturns
err = cdp .Execute (ctx , CommandGetSamplingProfile , nil , &res )
if err != nil {
return nil , err
}
return res .Profile , nil
}
const (
CommandGetDOMCounters = "Memory.getDOMCounters"
CommandPrepareForLeakDetection = "Memory.prepareForLeakDetection"
CommandForciblyPurgeJavaScriptMemory = "Memory.forciblyPurgeJavaScriptMemory"
CommandSetPressureNotificationsSuppressed = "Memory.setPressureNotificationsSuppressed"
CommandSimulatePressureNotification = "Memory.simulatePressureNotification"
CommandStartSampling = "Memory.startSampling"
CommandStopSampling = "Memory.stopSampling"
CommandGetAllTimeSamplingProfile = "Memory.getAllTimeSamplingProfile"
CommandGetBrowserSamplingProfile = "Memory.getBrowserSamplingProfile"
CommandGetSamplingProfile = "Memory.getSamplingProfile"
)
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .