forked from chromedp/chromedp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
memory.go
92 lines (78 loc) · 2.95 KB
/
memory.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Package memory provides the Chrome Debugging Protocol
// commands, types, and events for the Memory domain.
//
// Generated by the chromedp-gen command.
package memory
// AUTOGENERATED. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// GetDOMCountersParams [no description].
type GetDOMCountersParams struct{}
// GetDOMCounters [no description].
func GetDOMCounters() *GetDOMCountersParams {
return &GetDOMCountersParams{}
}
// GetDOMCountersReturns return values.
type GetDOMCountersReturns struct {
Documents int64 `json:"documents,omitempty"`
Nodes int64 `json:"nodes,omitempty"`
JsEventListeners int64 `json:"jsEventListeners,omitempty"`
}
// Do executes Memory.getDOMCounters against the provided context and
// target handler.
//
// returns:
// documents
// nodes
// jsEventListeners
func (p *GetDOMCountersParams) Do(ctxt context.Context, h cdp.Handler) (documents int64, nodes int64, jsEventListeners int64, err error) {
// execute
var res GetDOMCountersReturns
err = h.Execute(ctxt, cdp.CommandMemoryGetDOMCounters, nil, &res)
if err != nil {
return 0, 0, 0, err
}
return res.Documents, res.Nodes, res.JsEventListeners, 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.
//
// 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 and
// target handler.
func (p *SetPressureNotificationsSuppressedParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandMemorySetPressureNotificationsSuppressed, 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.
//
// 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 and
// target handler.
func (p *SimulatePressureNotificationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandMemorySimulatePressureNotification, p, nil)
}