/
domain.go
181 lines (159 loc) · 6.07 KB
/
domain.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
// Code generated by cdpgen. DO NOT EDIT.
// Package layertree implements the LayerTree domain.
package layertree
import (
"context"
"github.com/mafredri/cdp/protocol/internal"
"github.com/mafredri/cdp/rpcc"
)
// domainClient is a client for the LayerTree domain.
type domainClient struct{ conn *rpcc.Conn }
// NewClient returns a client for the LayerTree domain with the connection set to conn.
func NewClient(conn *rpcc.Conn) *domainClient {
return &domainClient{conn: conn}
}
// CompositingReasons invokes the LayerTree method. Provides the reasons why
// the given layer was composited.
func (d *domainClient) CompositingReasons(ctx context.Context, args *CompositingReasonsArgs) (reply *CompositingReasonsReply, err error) {
reply = new(CompositingReasonsReply)
if args != nil {
err = rpcc.Invoke(ctx, "LayerTree.compositingReasons", args, reply, d.conn)
} else {
err = rpcc.Invoke(ctx, "LayerTree.compositingReasons", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "LayerTree", Op: "CompositingReasons", Err: err}
}
return
}
// Disable invokes the LayerTree method. Disables compositing tree inspection.
func (d *domainClient) Disable(ctx context.Context) (err error) {
err = rpcc.Invoke(ctx, "LayerTree.disable", nil, nil, d.conn)
if err != nil {
err = &internal.OpError{Domain: "LayerTree", Op: "Disable", Err: err}
}
return
}
// Enable invokes the LayerTree method. Enables compositing tree inspection.
func (d *domainClient) Enable(ctx context.Context) (err error) {
err = rpcc.Invoke(ctx, "LayerTree.enable", nil, nil, d.conn)
if err != nil {
err = &internal.OpError{Domain: "LayerTree", Op: "Enable", Err: err}
}
return
}
// LoadSnapshot invokes the LayerTree method. Returns the snapshot identifier.
func (d *domainClient) LoadSnapshot(ctx context.Context, args *LoadSnapshotArgs) (reply *LoadSnapshotReply, err error) {
reply = new(LoadSnapshotReply)
if args != nil {
err = rpcc.Invoke(ctx, "LayerTree.loadSnapshot", args, reply, d.conn)
} else {
err = rpcc.Invoke(ctx, "LayerTree.loadSnapshot", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "LayerTree", Op: "LoadSnapshot", Err: err}
}
return
}
// MakeSnapshot invokes the LayerTree method. Returns the layer snapshot
// identifier.
func (d *domainClient) MakeSnapshot(ctx context.Context, args *MakeSnapshotArgs) (reply *MakeSnapshotReply, err error) {
reply = new(MakeSnapshotReply)
if args != nil {
err = rpcc.Invoke(ctx, "LayerTree.makeSnapshot", args, reply, d.conn)
} else {
err = rpcc.Invoke(ctx, "LayerTree.makeSnapshot", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "LayerTree", Op: "MakeSnapshot", Err: err}
}
return
}
// ProfileSnapshot invokes the LayerTree method.
func (d *domainClient) ProfileSnapshot(ctx context.Context, args *ProfileSnapshotArgs) (reply *ProfileSnapshotReply, err error) {
reply = new(ProfileSnapshotReply)
if args != nil {
err = rpcc.Invoke(ctx, "LayerTree.profileSnapshot", args, reply, d.conn)
} else {
err = rpcc.Invoke(ctx, "LayerTree.profileSnapshot", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "LayerTree", Op: "ProfileSnapshot", Err: err}
}
return
}
// ReleaseSnapshot invokes the LayerTree method. Releases layer snapshot
// captured by the back-end.
func (d *domainClient) ReleaseSnapshot(ctx context.Context, args *ReleaseSnapshotArgs) (err error) {
if args != nil {
err = rpcc.Invoke(ctx, "LayerTree.releaseSnapshot", args, nil, d.conn)
} else {
err = rpcc.Invoke(ctx, "LayerTree.releaseSnapshot", nil, nil, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "LayerTree", Op: "ReleaseSnapshot", Err: err}
}
return
}
// ReplaySnapshot invokes the LayerTree method. Replays the layer snapshot and
// returns the resulting bitmap.
func (d *domainClient) ReplaySnapshot(ctx context.Context, args *ReplaySnapshotArgs) (reply *ReplaySnapshotReply, err error) {
reply = new(ReplaySnapshotReply)
if args != nil {
err = rpcc.Invoke(ctx, "LayerTree.replaySnapshot", args, reply, d.conn)
} else {
err = rpcc.Invoke(ctx, "LayerTree.replaySnapshot", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "LayerTree", Op: "ReplaySnapshot", Err: err}
}
return
}
// SnapshotCommandLog invokes the LayerTree method. Replays the layer snapshot
// and returns canvas log.
func (d *domainClient) SnapshotCommandLog(ctx context.Context, args *SnapshotCommandLogArgs) (reply *SnapshotCommandLogReply, err error) {
reply = new(SnapshotCommandLogReply)
if args != nil {
err = rpcc.Invoke(ctx, "LayerTree.snapshotCommandLog", args, reply, d.conn)
} else {
err = rpcc.Invoke(ctx, "LayerTree.snapshotCommandLog", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "LayerTree", Op: "SnapshotCommandLog", Err: err}
}
return
}
func (d *domainClient) LayerPainted(ctx context.Context) (LayerPaintedClient, error) {
s, err := rpcc.NewStream(ctx, "LayerTree.layerPainted", d.conn)
if err != nil {
return nil, err
}
return &layerPaintedClient{Stream: s}, nil
}
type layerPaintedClient struct{ rpcc.Stream }
// GetStream returns the original Stream for use with cdp.Sync.
func (c *layerPaintedClient) GetStream() rpcc.Stream { return c.Stream }
func (c *layerPaintedClient) Recv() (*LayerPaintedReply, error) {
event := new(LayerPaintedReply)
if err := c.RecvMsg(event); err != nil {
return nil, &internal.OpError{Domain: "LayerTree", Op: "LayerPainted Recv", Err: err}
}
return event, nil
}
func (d *domainClient) LayerTreeDidChange(ctx context.Context) (DidChangeClient, error) {
s, err := rpcc.NewStream(ctx, "LayerTree.layerTreeDidChange", d.conn)
if err != nil {
return nil, err
}
return &didChangeClient{Stream: s}, nil
}
type didChangeClient struct{ rpcc.Stream }
// GetStream returns the original Stream for use with cdp.Sync.
func (c *didChangeClient) GetStream() rpcc.Stream { return c.Stream }
func (c *didChangeClient) Recv() (*DidChangeReply, error) {
event := new(DidChangeReply)
if err := c.RecvMsg(event); err != nil {
return nil, &internal.OpError{Domain: "LayerTree", Op: "LayerTreeDidChange Recv", Err: err}
}
return event, nil
}