| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- // Package memory provides the Chrome DevTools Protocol
- // commands, types, and events for the Memory domain.
- //
- // Generated by the cdproto-gen command.
- package memory
- // Code generated by cdproto-gen. DO NOT EDIT.
- import (
- "context"
- "github.com/chromedp/cdproto/cdp"
- )
- // GetDOMCountersParams retruns current DOM object counters.
- type GetDOMCountersParams struct{}
- // GetDOMCounters retruns current DOM object counters.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/Memory#method-getDOMCounters
- func GetDOMCounters() *GetDOMCountersParams {
- return &GetDOMCountersParams{}
- }
- // GetDOMCountersReturns return values.
- type GetDOMCountersReturns struct {
- Documents int64 `json:"documents,omitempty,omitzero"`
- Nodes int64 `json:"nodes,omitempty,omitzero"`
- JsEventListeners int64 `json:"jsEventListeners,omitempty,omitzero"`
- }
- // Do executes Memory.getDOMCounters against the provided context.
- //
- // returns:
- //
- // documents
- // nodes
- // jsEventListeners
- func (p *GetDOMCountersParams) Do(ctx context.Context) (documents int64, nodes int64, jsEventListeners int64, err error) {
- // execute
- 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
- }
- // GetDOMCountersForLeakDetectionParams retruns DOM object counters after
- // preparing renderer for leak detection.
- type GetDOMCountersForLeakDetectionParams struct{}
- // GetDOMCountersForLeakDetection retruns DOM object counters after preparing
- // renderer for leak detection.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/Memory#method-getDOMCountersForLeakDetection
- func GetDOMCountersForLeakDetection() *GetDOMCountersForLeakDetectionParams {
- return &GetDOMCountersForLeakDetectionParams{}
- }
- // GetDOMCountersForLeakDetectionReturns return values.
- type GetDOMCountersForLeakDetectionReturns struct {
- Counters []*DOMCounter `json:"counters,omitempty,omitzero"` // DOM object counters.
- }
- // Do executes Memory.getDOMCountersForLeakDetection against the provided context.
- //
- // returns:
- //
- // counters - DOM object counters.
- func (p *GetDOMCountersForLeakDetectionParams) Do(ctx context.Context) (counters []*DOMCounter, err error) {
- // execute
- var res GetDOMCountersForLeakDetectionReturns
- err = cdp.Execute(ctx, CommandGetDOMCountersForLeakDetection, nil, &res)
- if err != nil {
- return nil, err
- }
- return res.Counters, nil
- }
- // PrepareForLeakDetectionParams prepares for leak detection by terminating
- // workers, stopping spellcheckers, dropping non-essential internal caches,
- // running garbage collections, etc.
- type PrepareForLeakDetectionParams struct{}
- // PrepareForLeakDetection prepares for leak detection by terminating
- // workers, stopping spellcheckers, dropping non-essential internal caches,
- // running garbage collections, etc.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/Memory#method-prepareForLeakDetection
- func PrepareForLeakDetection() *PrepareForLeakDetectionParams {
- return &PrepareForLeakDetectionParams{}
- }
- // Do executes Memory.prepareForLeakDetection against the provided context.
- func (p *PrepareForLeakDetectionParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandPrepareForLeakDetection, nil, nil)
- }
- // ForciblyPurgeJavaScriptMemoryParams simulate OomIntervention by purging V8
- // memory.
- type ForciblyPurgeJavaScriptMemoryParams struct{}
- // ForciblyPurgeJavaScriptMemory simulate OomIntervention by purging V8
- // memory.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/Memory#method-forciblyPurgeJavaScriptMemory
- func ForciblyPurgeJavaScriptMemory() *ForciblyPurgeJavaScriptMemoryParams {
- return &ForciblyPurgeJavaScriptMemoryParams{}
- }
- // Do executes Memory.forciblyPurgeJavaScriptMemory against the provided context.
- func (p *ForciblyPurgeJavaScriptMemoryParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandForciblyPurgeJavaScriptMemory, nil, nil)
- }
- // SetPressureNotificationsSuppressedParams enable/disable suppressing memory
- // pressure notifications in all processes.
- type SetPressureNotificationsSuppressedParams struct {
- Suppressed bool `json:"suppressed"` // If true, memory pressure notifications will be suppressed.
- }
- // SetPressureNotificationsSuppressed enable/disable suppressing memory
- // pressure notifications in all processes.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/Memory#method-setPressureNotificationsSuppressed
- //
- // parameters:
- //
- // suppressed - If true, memory pressure notifications will be suppressed.
- func SetPressureNotificationsSuppressed(suppressed bool) *SetPressureNotificationsSuppressedParams {
- return &SetPressureNotificationsSuppressedParams{
- Suppressed: suppressed,
- }
- }
- // Do executes Memory.setPressureNotificationsSuppressed against the provided context.
- func (p *SetPressureNotificationsSuppressedParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandSetPressureNotificationsSuppressed, p, nil)
- }
- // SimulatePressureNotificationParams simulate a memory pressure notification
- // in all processes.
- type SimulatePressureNotificationParams struct {
- Level PressureLevel `json:"level"` // Memory pressure level of the notification.
- }
- // SimulatePressureNotification simulate a memory pressure notification in
- // all processes.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/Memory#method-simulatePressureNotification
- //
- // parameters:
- //
- // level - Memory pressure level of the notification.
- func SimulatePressureNotification(level PressureLevel) *SimulatePressureNotificationParams {
- return &SimulatePressureNotificationParams{
- Level: level,
- }
- }
- // Do executes Memory.simulatePressureNotification against the provided context.
- func (p *SimulatePressureNotificationParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandSimulatePressureNotification, p, nil)
- }
- // StartSamplingParams start collecting native memory profile.
- type StartSamplingParams struct {
- SamplingInterval int64 `json:"samplingInterval,omitempty,omitzero"` // Average number of bytes between samples.
- SuppressRandomness bool `json:"suppressRandomness"` // Do not randomize intervals between samples.
- }
- // StartSampling start collecting native memory profile.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/Memory#method-startSampling
- //
- // parameters:
- func StartSampling() *StartSamplingParams {
- return &StartSamplingParams{
- SuppressRandomness: false,
- }
- }
- // WithSamplingInterval average number of bytes between samples.
- func (p StartSamplingParams) WithSamplingInterval(samplingInterval int64) *StartSamplingParams {
- p.SamplingInterval = samplingInterval
- return &p
- }
- // WithSuppressRandomness do not randomize intervals between samples.
- func (p StartSamplingParams) WithSuppressRandomness(suppressRandomness bool) *StartSamplingParams {
- p.SuppressRandomness = suppressRandomness
- return &p
- }
- // Do executes Memory.startSampling against the provided context.
- func (p *StartSamplingParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandStartSampling, p, nil)
- }
- // StopSamplingParams stop collecting native memory profile.
- type StopSamplingParams struct{}
- // StopSampling stop collecting native memory profile.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/Memory#method-stopSampling
- func StopSampling() *StopSamplingParams {
- return &StopSamplingParams{}
- }
- // Do executes Memory.stopSampling against the provided context.
- func (p *StopSamplingParams) Do(ctx context.Context) (err error) {
- return cdp.Execute(ctx, CommandStopSampling, nil, nil)
- }
- // GetAllTimeSamplingProfileParams retrieve native memory allocations profile
- // collected since renderer process startup.
- type GetAllTimeSamplingProfileParams struct{}
- // GetAllTimeSamplingProfile retrieve native memory allocations profile
- // collected since renderer process startup.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/Memory#method-getAllTimeSamplingProfile
- func GetAllTimeSamplingProfile() *GetAllTimeSamplingProfileParams {
- return &GetAllTimeSamplingProfileParams{}
- }
- // GetAllTimeSamplingProfileReturns return values.
- type GetAllTimeSamplingProfileReturns struct {
- Profile *SamplingProfile `json:"profile,omitempty,omitzero"`
- }
- // Do executes Memory.getAllTimeSamplingProfile against the provided context.
- //
- // returns:
- //
- // profile
- func (p *GetAllTimeSamplingProfileParams) Do(ctx context.Context) (profile *SamplingProfile, err error) {
- // execute
- var res GetAllTimeSamplingProfileReturns
- err = cdp.Execute(ctx, CommandGetAllTimeSamplingProfile, nil, &res)
- if err != nil {
- return nil, err
- }
- return res.Profile, nil
- }
- // GetBrowserSamplingProfileParams retrieve native memory allocations profile
- // collected since browser process startup.
- type GetBrowserSamplingProfileParams struct{}
- // GetBrowserSamplingProfile retrieve native memory allocations profile
- // collected since browser process startup.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/Memory#method-getBrowserSamplingProfile
- func GetBrowserSamplingProfile() *GetBrowserSamplingProfileParams {
- return &GetBrowserSamplingProfileParams{}
- }
- // GetBrowserSamplingProfileReturns return values.
- type GetBrowserSamplingProfileReturns struct {
- Profile *SamplingProfile `json:"profile,omitempty,omitzero"`
- }
- // Do executes Memory.getBrowserSamplingProfile against the provided context.
- //
- // returns:
- //
- // profile
- func (p *GetBrowserSamplingProfileParams) Do(ctx context.Context) (profile *SamplingProfile, err error) {
- // execute
- var res GetBrowserSamplingProfileReturns
- err = cdp.Execute(ctx, CommandGetBrowserSamplingProfile, nil, &res)
- if err != nil {
- return nil, err
- }
- return res.Profile, nil
- }
- // GetSamplingProfileParams retrieve native memory allocations profile
- // collected since last startSampling call.
- type GetSamplingProfileParams struct{}
- // GetSamplingProfile retrieve native memory allocations profile collected
- // since last startSampling call.
- //
- // See: https://chromedevtools.github.io/devtools-protocol/tot/Memory#method-getSamplingProfile
- func GetSamplingProfile() *GetSamplingProfileParams {
- return &GetSamplingProfileParams{}
- }
- // GetSamplingProfileReturns return values.
- type GetSamplingProfileReturns struct {
- Profile *SamplingProfile `json:"profile,omitempty,omitzero"`
- }
- // Do executes Memory.getSamplingProfile against the provided context.
- //
- // returns:
- //
- // profile
- func (p *GetSamplingProfileParams) Do(ctx context.Context) (profile *SamplingProfile, err error) {
- // execute
- var res GetSamplingProfileReturns
- err = cdp.Execute(ctx, CommandGetSamplingProfile, nil, &res)
- if err != nil {
- return nil, err
- }
- return res.Profile, nil
- }
- // Command names.
- const (
- CommandGetDOMCounters = "Memory.getDOMCounters"
- CommandGetDOMCountersForLeakDetection = "Memory.getDOMCountersForLeakDetection"
- 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"
- )
|