forked from chromedp/chromedp
/
types.go
118 lines (97 loc) · 3.86 KB
/
types.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package tracing
import (
"errors"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Code generated by chromedp-gen. DO NOT EDIT.
// MemoryDumpConfig configuration for memory dump. Used only when
// "memory-infra" category is enabled.
type MemoryDumpConfig struct{}
// TraceConfig [no description].
type TraceConfig struct {
RecordMode RecordMode `json:"recordMode,omitempty"` // Controls how the trace buffer stores data.
EnableSampling bool `json:"enableSampling,omitempty"` // Turns on JavaScript stack sampling.
EnableSystrace bool `json:"enableSystrace,omitempty"` // Turns on system tracing.
EnableArgumentFilter bool `json:"enableArgumentFilter,omitempty"` // Turns on argument filter.
IncludedCategories []string `json:"includedCategories,omitempty"` // Included category filters.
ExcludedCategories []string `json:"excludedCategories,omitempty"` // Excluded category filters.
SyntheticDelays []string `json:"syntheticDelays,omitempty"` // Configuration to synthesize the delays in tracing.
MemoryDumpConfig *MemoryDumpConfig `json:"memoryDumpConfig,omitempty"` // Configuration for memory dump triggers. Used only when "memory-infra" category is enabled.
}
// RecordMode controls how the trace buffer stores data.
type RecordMode string
// String returns the RecordMode as string value.
func (t RecordMode) String() string {
return string(t)
}
// RecordMode values.
const (
RecordModeRecordUntilFull RecordMode = "recordUntilFull"
RecordModeRecordContinuously RecordMode = "recordContinuously"
RecordModeRecordAsMuchAsPossible RecordMode = "recordAsMuchAsPossible"
RecordModeEchoToConsole RecordMode = "echoToConsole"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t RecordMode) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t RecordMode) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *RecordMode) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch RecordMode(in.String()) {
case RecordModeRecordUntilFull:
*t = RecordModeRecordUntilFull
case RecordModeRecordContinuously:
*t = RecordModeRecordContinuously
case RecordModeRecordAsMuchAsPossible:
*t = RecordModeRecordAsMuchAsPossible
case RecordModeEchoToConsole:
*t = RecordModeEchoToConsole
default:
in.AddError(errors.New("unknown RecordMode value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *RecordMode) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// TransferMode whether to report trace events as series of dataCollected
// events or to save trace to a stream (defaults to ReportEvents).
type TransferMode string
// String returns the TransferMode as string value.
func (t TransferMode) String() string {
return string(t)
}
// TransferMode values.
const (
TransferModeReportEvents TransferMode = "ReportEvents"
TransferModeReturnAsStream TransferMode = "ReturnAsStream"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t TransferMode) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t TransferMode) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *TransferMode) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch TransferMode(in.String()) {
case TransferModeReportEvents:
*t = TransferModeReportEvents
case TransferModeReturnAsStream:
*t = TransferModeReturnAsStream
default:
in.AddError(errors.New("unknown TransferMode value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *TransferMode) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}