Temporarily removing all timestamp types

This commit is contained in:
Kenneth Shaw 2017-07-01 15:55:35 +07:00
parent 547875a8f2
commit f27ba717b1
18 changed files with 403 additions and 700 deletions

View File

@ -7,9 +7,7 @@ import (
"strconv"
"strings"
"sync"
"time"
"github.com/knq/sysutil"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
@ -1503,31 +1501,11 @@ func (t LoaderID) String() string {
}
// Timestamp number of seconds since epoch.
type Timestamp time.Time
type Timestamp float64
// Time returns the Timestamp as time.Time value.
func (t Timestamp) Time() time.Time {
return time.Time(t)
}
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t Timestamp) MarshalEasyJSON(out *jwriter.Writer) {
out.Float64(float64(time.Time(t).Sub(sysutil.BootTime())) / float64(time.Second))
}
// MarshalJSON satisfies json.Marshaler.
func (t Timestamp) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *Timestamp) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = Timestamp(sysutil.BootTime().Add(time.Duration(in.Float64() * float64(time.Second))))
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *Timestamp) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
// Float64 returns the Timestamp as float64 value.
func (t Timestamp) Float64() float64 {
return float64(t)
}
// NodeID unique DOM node identifier.

View File

@ -4,7 +4,6 @@ package heapprofiler
import (
json "encoding/json"
cdp "github.com/knq/chromedp/cdp"
runtime "github.com/knq/chromedp/cdp/runtime"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
@ -1125,15 +1124,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeapprofiler14(in *jlexer.Lexe
case "lastSeenObjectId":
out.LastSeenObjectID = int64(in.Int64())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = float64(in.Float64())
default:
in.SkipRecursive()
}
@ -1156,17 +1147,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeapprofiler14(out *jwriter.Wr
out.RawString("\"lastSeenObjectId\":")
out.Int64(int64(in.LastSeenObjectID))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
out.RawByte('}')
}

View File

@ -27,8 +27,8 @@ type EventReportHeapSnapshotProgress struct {
// then one or more heapStatsUpdate events will be sent before a new
// lastSeenObjectId event.
type EventLastSeenObjectID struct {
LastSeenObjectID int64 `json:"lastSeenObjectId,omitempty"`
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"`
LastSeenObjectID int64 `json:"lastSeenObjectId,omitempty"`
Timestamp float64 `json:"timestamp,omitempty"`
}
// EventHeapStatsUpdate if heap objects tracking has been started then

View File

@ -4,7 +4,6 @@ package log
import (
json "encoding/json"
cdp "github.com/knq/chromedp/cdp"
network "github.com/knq/chromedp/cdp/network"
runtime "github.com/knq/chromedp/cdp/runtime"
easyjson "github.com/mailru/easyjson"
@ -376,15 +375,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(in *jlexer.Lexer, out *En
case "text":
out.Text = string(in.String())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = runtime.Timestamp(in.Float64())
case "url":
out.URL = string(in.String())
case "lineNumber":
@ -441,17 +432,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(out *jwriter.Writer, in E
out.RawString("\"text\":")
out.String(string(in.Text))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.URL != "" {
if !first {

View File

@ -1,11 +1,8 @@
package log
// AUTOGENERATED. DO NOT EDIT.
import (
"errors"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/network"
"github.com/knq/chromedp/cdp/runtime"
"github.com/mailru/easyjson"
@ -13,12 +10,14 @@ import (
"github.com/mailru/easyjson/jwriter"
)
// AUTOGENERATED. DO NOT EDIT.
// Entry log entry.
type Entry struct {
Source Source `json:"source,omitempty"` // Log entry source.
Level Level `json:"level,omitempty"` // Log entry severity.
Text string `json:"text,omitempty"` // Logged text.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp when this entry was added.
Timestamp runtime.Timestamp `json:"timestamp,omitempty"` // Timestamp when this entry was added.
URL string `json:"url,omitempty"` // URL of the resource if known.
LineNumber int64 `json:"lineNumber,omitempty"` // Line number in the resource.
StackTrace *runtime.StackTrace `json:"stackTrace,omitempty"` // JavaScript stack trace.

View File

@ -460,15 +460,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork3(in *jlexer.Lexer, out
case "logId":
out.LogID = string(in.String())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = cdp.Timestamp(in.Float64())
case "hashAlgorithm":
out.HashAlgorithm = string(in.String())
case "signatureAlgorithm":
@ -521,17 +513,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork3(out *jwriter.Writer,
out.RawString("\"logId\":")
out.String(string(in.LogID))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.HashAlgorithm != "" {
if !first {
@ -942,15 +930,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork8(in *jlexer.Lexer, out
case "sameSite":
(out.SameSite).UnmarshalEasyJSON(in)
case "expirationDate":
if in.IsNull() {
in.Skip()
out.ExpirationDate = nil
} else {
if out.ExpirationDate == nil {
out.ExpirationDate = new(cdp.Timestamp)
}
(*out.ExpirationDate).UnmarshalEasyJSON(in)
}
out.ExpirationDate = cdp.Timestamp(in.Float64())
default:
in.SkipRecursive()
}
@ -1023,17 +1003,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork8(out *jwriter.Writer,
out.RawString("\"sameSite\":")
(in.SameSite).MarshalEasyJSON(out)
}
if in.ExpirationDate != nil {
if in.ExpirationDate != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"expirationDate\":")
if in.ExpirationDate == nil {
out.RawString("null")
} else {
(*in.ExpirationDate).MarshalEasyJSON(out)
}
out.Float64(float64(in.ExpirationDate))
}
out.RawByte('}')
}
@ -1353,25 +1329,9 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork12(in *jlexer.Lexer, ou
case "issuer":
out.Issuer = string(in.String())
case "validFrom":
if in.IsNull() {
in.Skip()
out.ValidFrom = nil
} else {
if out.ValidFrom == nil {
out.ValidFrom = new(cdp.Timestamp)
}
(*out.ValidFrom).UnmarshalEasyJSON(in)
}
out.ValidFrom = cdp.Timestamp(in.Float64())
case "validTo":
if in.IsNull() {
in.Skip()
out.ValidTo = nil
} else {
if out.ValidTo == nil {
out.ValidTo = new(cdp.Timestamp)
}
(*out.ValidTo).UnmarshalEasyJSON(in)
}
out.ValidTo = cdp.Timestamp(in.Float64())
case "signedCertificateTimestampList":
if in.IsNull() {
in.Skip()
@ -1500,29 +1460,21 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork12(out *jwriter.Writer,
out.RawString("\"issuer\":")
out.String(string(in.Issuer))
}
if in.ValidFrom != nil {
if in.ValidFrom != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"validFrom\":")
if in.ValidFrom == nil {
out.RawString("null")
} else {
(*in.ValidFrom).MarshalEasyJSON(out)
}
out.Float64(float64(in.ValidFrom))
}
if in.ValidTo != nil {
if in.ValidTo != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"validTo\":")
if in.ValidTo == nil {
out.RawString("null")
} else {
(*in.ValidTo).MarshalEasyJSON(out)
}
out.Float64(float64(in.ValidTo))
}
if len(in.SignedCertificateTimestampList) != 0 {
if !first {
@ -3239,25 +3191,9 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork26(in *jlexer.Lexer, ou
case "requestId":
out.RequestID = RequestID(in.String())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = cdp.Timestamp(in.Float64())
case "wallTime":
if in.IsNull() {
in.Skip()
out.WallTime = nil
} else {
if out.WallTime == nil {
out.WallTime = new(cdp.Timestamp)
}
(*out.WallTime).UnmarshalEasyJSON(in)
}
out.WallTime = cdp.Timestamp(in.Float64())
case "request":
if in.IsNull() {
in.Skip()
@ -3290,29 +3226,21 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork26(out *jwriter.Writer,
out.RawString("\"requestId\":")
out.String(string(in.RequestID))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.WallTime != nil {
if in.WallTime != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"wallTime\":")
if in.WallTime == nil {
out.RawString("null")
} else {
(*in.WallTime).MarshalEasyJSON(out)
}
out.Float64(float64(in.WallTime))
}
if in.Request != nil {
if !first {
@ -3374,15 +3302,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork27(in *jlexer.Lexer, ou
case "requestId":
out.RequestID = RequestID(in.String())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = cdp.Timestamp(in.Float64())
case "response":
if in.IsNull() {
in.Skip()
@ -3415,17 +3335,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork27(out *jwriter.Writer,
out.RawString("\"requestId\":")
out.String(string(in.RequestID))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.Response != nil {
if !first {
@ -3487,15 +3403,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork28(in *jlexer.Lexer, ou
case "requestId":
out.RequestID = RequestID(in.String())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = cdp.Timestamp(in.Float64())
case "response":
if in.IsNull() {
in.Skip()
@ -3528,17 +3436,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork28(out *jwriter.Writer,
out.RawString("\"requestId\":")
out.String(string(in.RequestID))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.Response != nil {
if !first {
@ -3600,15 +3504,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork29(in *jlexer.Lexer, ou
case "requestId":
out.RequestID = RequestID(in.String())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = cdp.Timestamp(in.Float64())
case "response":
if in.IsNull() {
in.Skip()
@ -3641,17 +3537,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork29(out *jwriter.Writer,
out.RawString("\"requestId\":")
out.String(string(in.RequestID))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.Response != nil {
if !first {
@ -3713,15 +3605,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork30(in *jlexer.Lexer, ou
case "requestId":
out.RequestID = RequestID(in.String())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = cdp.Timestamp(in.Float64())
case "errorMessage":
out.ErrorMessage = string(in.String())
default:
@ -3746,17 +3630,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork30(out *jwriter.Writer,
out.RawString("\"requestId\":")
out.String(string(in.RequestID))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.ErrorMessage != "" {
if !first {
@ -3915,15 +3795,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork32(in *jlexer.Lexer, ou
case "requestId":
out.RequestID = RequestID(in.String())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = cdp.Timestamp(in.Float64())
default:
in.SkipRecursive()
}
@ -3946,17 +3818,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork32(out *jwriter.Writer,
out.RawString("\"requestId\":")
out.String(string(in.RequestID))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
out.RawByte('}')
}
@ -4010,15 +3878,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork33(in *jlexer.Lexer, ou
case "loaderId":
out.LoaderID = cdp.LoaderID(in.String())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = cdp.Timestamp(in.Float64())
case "type":
(out.Type).UnmarshalEasyJSON(in)
case "response":
@ -4069,17 +3929,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork33(out *jwriter.Writer,
out.RawString("\"loaderId\":")
out.String(string(in.LoaderID))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.Type != "" {
if !first {
@ -4151,15 +4007,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork34(in *jlexer.Lexer, ou
case "newPriority":
(out.NewPriority).UnmarshalEasyJSON(in)
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = cdp.Timestamp(in.Float64())
default:
in.SkipRecursive()
}
@ -4190,17 +4038,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork34(out *jwriter.Writer,
out.RawString("\"newPriority\":")
(in.NewPriority).MarshalEasyJSON(out)
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
out.RawByte('}')
}
@ -4266,25 +4110,9 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork35(in *jlexer.Lexer, ou
(*out.Request).UnmarshalEasyJSON(in)
}
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = cdp.Timestamp(in.Float64())
case "wallTime":
if in.IsNull() {
in.Skip()
out.WallTime = nil
} else {
if out.WallTime == nil {
out.WallTime = new(cdp.Timestamp)
}
(*out.WallTime).UnmarshalEasyJSON(in)
}
out.WallTime = cdp.Timestamp(in.Float64())
case "initiator":
if in.IsNull() {
in.Skip()
@ -4365,29 +4193,21 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork35(out *jwriter.Writer,
(*in.Request).MarshalEasyJSON(out)
}
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.WallTime != nil {
if in.WallTime != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"wallTime\":")
if in.WallTime == nil {
out.RawString("null")
} else {
(*in.WallTime).MarshalEasyJSON(out)
}
out.Float64(float64(in.WallTime))
}
if in.Initiator != nil {
if !first {
@ -4736,15 +4556,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork38(in *jlexer.Lexer, ou
case "requestId":
out.RequestID = RequestID(in.String())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = cdp.Timestamp(in.Float64())
case "encodedDataLength":
out.EncodedDataLength = float64(in.Float64())
default:
@ -4769,17 +4581,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork38(out *jwriter.Writer,
out.RawString("\"requestId\":")
out.String(string(in.RequestID))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.EncodedDataLength != 0 {
if !first {
@ -4837,15 +4645,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork39(in *jlexer.Lexer, ou
case "requestId":
out.RequestID = RequestID(in.String())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = cdp.Timestamp(in.Float64())
case "type":
(out.Type).UnmarshalEasyJSON(in)
case "errorText":
@ -4876,17 +4676,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork39(out *jwriter.Writer,
out.RawString("\"requestId\":")
out.String(string(in.RequestID))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.Type != "" {
if !first {
@ -4968,15 +4764,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork40(in *jlexer.Lexer, ou
case "requestId":
out.RequestID = RequestID(in.String())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = cdp.Timestamp(in.Float64())
case "eventName":
out.EventName = string(in.String())
case "eventId":
@ -5005,17 +4793,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork40(out *jwriter.Writer,
out.RawString("\"requestId\":")
out.String(string(in.RequestID))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.EventName != "" {
if !first {
@ -5089,15 +4873,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork41(in *jlexer.Lexer, ou
case "requestId":
out.RequestID = RequestID(in.String())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = cdp.Timestamp(in.Float64())
case "dataLength":
out.DataLength = int64(in.Int64())
case "encodedDataLength":
@ -5124,17 +4900,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork41(out *jwriter.Writer,
out.RawString("\"requestId\":")
out.String(string(in.RequestID))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.DataLength != 0 {
if !first {

View File

@ -12,7 +12,7 @@ import (
type EventResourceChangedPriority struct {
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
NewPriority ResourcePriority `json:"newPriority,omitempty"` // New priority
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
}
// EventRequestWillBeSent fired when page is about to send HTTP request.
@ -22,8 +22,8 @@ type EventRequestWillBeSent struct {
LoaderID cdp.LoaderID `json:"loaderId,omitempty"` // Loader identifier.
DocumentURL string `json:"documentURL,omitempty"` // URL of the document this request is loaded for.
Request *Request `json:"request,omitempty"` // Request data.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
WallTime *cdp.Timestamp `json:"wallTime,omitempty"` // UTC Timestamp.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
WallTime cdp.Timestamp `json:"wallTime,omitempty"` // UTC Timestamp.
Initiator *Initiator `json:"initiator,omitempty"` // Request initiator.
RedirectResponse *Response `json:"redirectResponse,omitempty"` // Redirect response data.
Type page.ResourceType `json:"type,omitempty"` // Type of this resource.
@ -39,30 +39,30 @@ type EventResponseReceived struct {
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame identifier.
LoaderID cdp.LoaderID `json:"loaderId,omitempty"` // Loader identifier.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
Type page.ResourceType `json:"type,omitempty"` // Resource type.
Response *Response `json:"response,omitempty"` // Response data.
}
// EventDataReceived fired when data chunk was received over the network.
type EventDataReceived struct {
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
DataLength int64 `json:"dataLength,omitempty"` // Data chunk length.
EncodedDataLength int64 `json:"encodedDataLength,omitempty"` // Actual bytes received (might be less than dataLength for compressed encodings).
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
DataLength int64 `json:"dataLength,omitempty"` // Data chunk length.
EncodedDataLength int64 `json:"encodedDataLength,omitempty"` // Actual bytes received (might be less than dataLength for compressed encodings).
}
// EventLoadingFinished fired when HTTP request has finished loading.
type EventLoadingFinished struct {
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
EncodedDataLength float64 `json:"encodedDataLength,omitempty"` // Total number of bytes received for this request.
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
EncodedDataLength float64 `json:"encodedDataLength,omitempty"` // Total number of bytes received for this request.
}
// EventLoadingFailed fired when HTTP request has failed to load.
type EventLoadingFailed struct {
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
Type page.ResourceType `json:"type,omitempty"` // Resource type.
ErrorText string `json:"errorText,omitempty"` // User friendly error message.
Canceled bool `json:"canceled,omitempty"` // True if loading was canceled.
@ -73,8 +73,8 @@ type EventLoadingFailed struct {
// initiate handshake.
type EventWebSocketWillSendHandshakeRequest struct {
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
WallTime *cdp.Timestamp `json:"wallTime,omitempty"` // UTC Timestamp.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
WallTime cdp.Timestamp `json:"wallTime,omitempty"` // UTC Timestamp.
Request *WebSocketRequest `json:"request,omitempty"` // WebSocket request data.
}
@ -82,7 +82,7 @@ type EventWebSocketWillSendHandshakeRequest struct {
// response becomes available.
type EventWebSocketHandshakeResponseReceived struct {
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
Response *WebSocketResponse `json:"response,omitempty"` // WebSocket response data.
}
@ -95,39 +95,39 @@ type EventWebSocketCreated struct {
// EventWebSocketClosed fired when WebSocket is closed.
type EventWebSocketClosed struct {
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
}
// EventWebSocketFrameReceived fired when WebSocket frame is received.
type EventWebSocketFrameReceived struct {
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
Response *WebSocketFrame `json:"response,omitempty"` // WebSocket response data.
}
// EventWebSocketFrameError fired when WebSocket frame error occurs.
type EventWebSocketFrameError struct {
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
ErrorMessage string `json:"errorMessage,omitempty"` // WebSocket frame error message.
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
ErrorMessage string `json:"errorMessage,omitempty"` // WebSocket frame error message.
}
// EventWebSocketFrameSent fired when WebSocket frame is sent.
type EventWebSocketFrameSent struct {
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
Response *WebSocketFrame `json:"response,omitempty"` // WebSocket response data.
}
// EventEventSourceMessageReceived fired when EventSource message is
// received.
type EventEventSourceMessageReceived struct {
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
EventName string `json:"eventName,omitempty"` // Message type.
EventID string `json:"eventId,omitempty"` // Message identifier.
Data string `json:"data,omitempty"` // Message content.
RequestID RequestID `json:"requestId,omitempty"` // Request identifier.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp.
EventName string `json:"eventName,omitempty"` // Message type.
EventID string `json:"eventId,omitempty"` // Message identifier.
Data string `json:"data,omitempty"` // Message content.
}
// EventRequestIntercepted details of an intercepted HTTP request, which must

View File

@ -407,7 +407,7 @@ type SetCookieParams struct {
Secure bool `json:"secure,omitempty"` // Defaults ot false.
HTTPOnly bool `json:"httpOnly,omitempty"` // Defaults to false.
SameSite CookieSameSite `json:"sameSite,omitempty"` // Defaults to browser default behavior.
ExpirationDate *cdp.Timestamp `json:"expirationDate,omitempty"` // If omitted, the cookie becomes a session cookie.
ExpirationDate cdp.Timestamp `json:"expirationDate,omitempty"` // If omitted, the cookie becomes a session cookie.
}
// SetCookie sets a cookie with the given cookie data; may overwrite
@ -456,7 +456,7 @@ func (p SetCookieParams) WithSameSite(sameSite CookieSameSite) *SetCookieParams
}
// WithExpirationDate if omitted, the cookie becomes a session cookie.
func (p SetCookieParams) WithExpirationDate(expirationDate *cdp.Timestamp) *SetCookieParams {
func (p SetCookieParams) WithExpirationDate(expirationDate cdp.Timestamp) *SetCookieParams {
p.ExpirationDate = expirationDate
return &p
}

View File

@ -297,14 +297,14 @@ type Request struct {
// SignedCertificateTimestamp details of a signed certificate timestamp
// (SCT).
type SignedCertificateTimestamp struct {
Status string `json:"status,omitempty"` // Validation status.
Origin string `json:"origin,omitempty"` // Origin.
LogDescription string `json:"logDescription,omitempty"` // Log name / description.
LogID string `json:"logId,omitempty"` // Log ID.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Issuance date.
HashAlgorithm string `json:"hashAlgorithm,omitempty"` // Hash algorithm.
SignatureAlgorithm string `json:"signatureAlgorithm,omitempty"` // Signature algorithm.
SignatureData string `json:"signatureData,omitempty"` // Signature data.
Status string `json:"status,omitempty"` // Validation status.
Origin string `json:"origin,omitempty"` // Origin.
LogDescription string `json:"logDescription,omitempty"` // Log name / description.
LogID string `json:"logId,omitempty"` // Log ID.
Timestamp cdp.Timestamp `json:"timestamp,omitempty"` // Issuance date.
HashAlgorithm string `json:"hashAlgorithm,omitempty"` // Hash algorithm.
SignatureAlgorithm string `json:"signatureAlgorithm,omitempty"` // Signature algorithm.
SignatureData string `json:"signatureData,omitempty"` // Signature data.
}
// SecurityDetails security details about a request.
@ -318,8 +318,8 @@ type SecurityDetails struct {
SubjectName string `json:"subjectName,omitempty"` // Certificate subject name.
SanList []string `json:"sanList,omitempty"` // Subject Alternative Name (SAN) DNS names and IP addresses.
Issuer string `json:"issuer,omitempty"` // Name of the issuing CA.
ValidFrom *cdp.Timestamp `json:"validFrom,omitempty"` // Certificate valid from date.
ValidTo *cdp.Timestamp `json:"validTo,omitempty"` // Certificate valid to (expiration) date
ValidFrom cdp.Timestamp `json:"validFrom,omitempty"` // Certificate valid from date.
ValidTo cdp.Timestamp `json:"validTo,omitempty"` // Certificate valid to (expiration) date
SignedCertificateTimestampList []*SignedCertificateTimestamp `json:"signedCertificateTimestampList,omitempty"` // List of signed certificate timestamps (SCTs).
}

View File

@ -834,15 +834,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage9(in *jlexer.Lexer, out *S
case "scrollOffsetY":
out.ScrollOffsetY = float64(in.Float64())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = float64(in.Float64())
default:
in.SkipRecursive()
}
@ -905,17 +897,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage9(out *jwriter.Writer, in
out.RawString("\"scrollOffsetY\":")
out.Float64(float64(in.ScrollOffsetY))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
out.RawByte('}')
}
@ -3103,15 +3091,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage34(in *jlexer.Lexer, out *
case "mimeType":
out.MimeType = string(in.String())
case "lastModified":
if in.IsNull() {
in.Skip()
out.LastModified = nil
} else {
if out.LastModified == nil {
out.LastModified = new(cdp.Timestamp)
}
(*out.LastModified).UnmarshalEasyJSON(in)
}
out.LastModified = cdp.Timestamp(in.Float64())
case "contentSize":
out.ContentSize = float64(in.Float64())
case "failed":
@ -3156,17 +3136,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage34(out *jwriter.Writer, in
out.RawString("\"mimeType\":")
out.String(string(in.MimeType))
}
if in.LastModified != nil {
if in.LastModified != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"lastModified\":")
if in.LastModified == nil {
out.RawString("null")
} else {
(*in.LastModified).MarshalEasyJSON(out)
}
out.Float64(float64(in.LastModified))
}
if in.ContentSize != 0 {
if !first {
@ -3507,15 +3483,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage38(in *jlexer.Lexer, out *
}
switch key {
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = float64(in.Float64())
default:
in.SkipRecursive()
}
@ -3530,17 +3498,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage38(out *jwriter.Writer, in
out.RawByte('{')
first := true
_ = first
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
out.RawByte('}')
}
@ -4450,15 +4414,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage51(in *jlexer.Lexer, out *
}
switch key {
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = float64(in.Float64())
default:
in.SkipRecursive()
}
@ -4473,17 +4429,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage51(out *jwriter.Writer, in
out.RawByte('{')
first := true
_ = first
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
out.RawByte('}')
}

View File

@ -9,12 +9,12 @@ import (
// EventDomContentEventFired [no description].
type EventDomContentEventFired struct {
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"`
Timestamp float64 `json:"timestamp,omitempty"`
}
// EventLoadEventFired [no description].
type EventLoadEventFired struct {
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"`
Timestamp float64 `json:"timestamp,omitempty"`
}
// EventFrameAttached fired when frame has been attached to its parent.

View File

@ -88,13 +88,13 @@ func (t *ResourceType) UnmarshalJSON(buf []byte) error {
// FrameResource information about the Resource on the page.
type FrameResource struct {
URL string `json:"url,omitempty"` // Resource URL.
Type ResourceType `json:"type,omitempty"` // Type of this resource.
MimeType string `json:"mimeType,omitempty"` // Resource mimeType as determined by the browser.
LastModified *cdp.Timestamp `json:"lastModified,omitempty"` // last-modified timestamp as reported by server.
ContentSize float64 `json:"contentSize,omitempty"` // Resource content size.
Failed bool `json:"failed,omitempty"` // True if the resource failed to load.
Canceled bool `json:"canceled,omitempty"` // True if the resource was canceled during loading.
URL string `json:"url,omitempty"` // Resource URL.
Type ResourceType `json:"type,omitempty"` // Type of this resource.
MimeType string `json:"mimeType,omitempty"` // Resource mimeType as determined by the browser.
LastModified cdp.Timestamp `json:"lastModified,omitempty"` // last-modified timestamp as reported by server.
ContentSize float64 `json:"contentSize,omitempty"` // Resource content size.
Failed bool `json:"failed,omitempty"` // True if the resource failed to load.
Canceled bool `json:"canceled,omitempty"` // True if the resource was canceled during loading.
}
// FrameResourceTree information about the Frame hierarchy along with their
@ -196,13 +196,13 @@ type NavigationEntry struct {
// ScreencastFrameMetadata screencast frame metadata.
type ScreencastFrameMetadata struct {
OffsetTop float64 `json:"offsetTop,omitempty"` // Top offset in DIP.
PageScaleFactor float64 `json:"pageScaleFactor,omitempty"` // Page scale factor.
DeviceWidth float64 `json:"deviceWidth,omitempty"` // Device screen width in DIP.
DeviceHeight float64 `json:"deviceHeight,omitempty"` // Device screen height in DIP.
ScrollOffsetX float64 `json:"scrollOffsetX,omitempty"` // Position of horizontal scroll in CSS pixels.
ScrollOffsetY float64 `json:"scrollOffsetY,omitempty"` // Position of vertical scroll in CSS pixels.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Frame swap timestamp.
OffsetTop float64 `json:"offsetTop,omitempty"` // Top offset in DIP.
PageScaleFactor float64 `json:"pageScaleFactor,omitempty"` // Page scale factor.
DeviceWidth float64 `json:"deviceWidth,omitempty"` // Device screen width in DIP.
DeviceHeight float64 `json:"deviceHeight,omitempty"` // Device screen height in DIP.
ScrollOffsetX float64 `json:"scrollOffsetX,omitempty"` // Position of horizontal scroll in CSS pixels.
ScrollOffsetY float64 `json:"scrollOffsetY,omitempty"` // Position of vertical scroll in CSS pixels.
Timestamp float64 `json:"timestamp,omitempty"` // Frame swap timestamp.
}
// DialogType javascript dialog type.

View File

@ -4,7 +4,6 @@ package runtime
import (
json "encoding/json"
cdp "github.com/knq/chromedp/cdp"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
@ -2362,15 +2361,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRuntime20(in *jlexer.Lexer, ou
}
switch key {
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = Timestamp(in.Float64())
case "exceptionDetails":
if in.IsNull() {
in.Skip()
@ -2395,17 +2386,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime20(out *jwriter.Writer,
out.RawByte('{')
first := true
_ = first
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.ExceptionDetails != nil {
if !first {
@ -2579,15 +2566,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpRuntime22(in *jlexer.Lexer, ou
case "executionContextId":
out.ExecutionContextID = ExecutionContextID(in.Int64())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(cdp.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
out.Timestamp = Timestamp(in.Float64())
case "stackTrace":
if in.IsNull() {
in.Skip()
@ -2653,17 +2632,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpRuntime22(out *jwriter.Writer,
out.RawString("\"executionContextId\":")
out.Int64(int64(in.ExecutionContextID))
}
if in.Timestamp != nil {
if in.Timestamp != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"timestamp\":")
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
out.Float64(float64(in.Timestamp))
}
if in.StackTrace != nil {
if !first {

View File

@ -23,7 +23,7 @@ type EventExecutionContextsCleared struct{}
// EventExceptionThrown issued when exception was thrown and unhandled.
type EventExceptionThrown struct {
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Timestamp of the exception.
Timestamp Timestamp `json:"timestamp,omitempty"` // Timestamp of the exception.
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"`
}
@ -38,7 +38,7 @@ type EventConsoleAPICalled struct {
Type APIType `json:"type,omitempty"` // Type of the call.
Args []*RemoteObject `json:"args,omitempty"` // Call arguments.
ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Identifier of the context where the call was made.
Timestamp *cdp.Timestamp `json:"timestamp,omitempty"` // Call timestamp.
Timestamp Timestamp `json:"timestamp,omitempty"` // Call timestamp.
StackTrace *StackTrace `json:"stackTrace,omitempty"` // Stack trace captured when the call was made.
Context string `json:"context,omitempty"` // Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context.
}

View File

@ -189,6 +189,14 @@ func (e *ExceptionDetails) Error() string {
return fmt.Sprintf("encountered exception '%s' (%d:%d)", e.Text, e.LineNumber, e.ColumnNumber)
}
// Timestamp number of milliseconds since epoch.
type Timestamp float64
// Float64 returns the Timestamp as float64 value.
func (t Timestamp) Float64() float64 {
return float64(t)
}
// CallFrame stack entry for runtime errors and assertions.
type CallFrame struct {
FunctionName string `json:"functionName,omitempty"` // JavaScript function name.

View File

@ -12,9 +12,8 @@
// - add 'Inspector.Message' type as a object with id (integer), method (MethodType), params (interface{}), error (MessageError).
// - add 'Inspector.DetachReason' type and change event 'Inspector.detached''s parameter reason's type.
// - add 'Inspector.ErrorType' type.
// - change 'Runtime.Timestamp' to 'Network.Timestamp'.
// - change any object property or command/event parameter named 'timestamp'
// or has $ref to Network/Runtime.Timestamp to type 'Network.Timestamp'.
// that doesn't have a $ref defined to 'Runtime.Timestamp'.
// - convert object properties and event/command parameters that are enums into independent types.
// - change '*.modifiers' parameters to type Input.Modifier.
// - add 'DOM.NodeType' type and convert "nodeType" parameters to it.
@ -34,6 +33,7 @@ package fixup
import (
"fmt"
"log"
"strings"
"github.com/knq/chromedp/cmd/chromedp-gen/internal"
@ -330,10 +330,10 @@ func FixDomains(domains []*internal.Domain) {
case internal.DomainNetwork:
for _, t := range d.Types {
// change Timestamp to TypeTimestamp and add extra unmarshaling template
if t.ID == "Timestamp" {
/*if t.ID == "Timestamp" {
t.Type = internal.TypeTimestamp
t.Extra += templates.ExtraTimestampTemplate(t, d)
}
t.Extra = templates.ExtraTimestampTemplate(t, d)
}*/
// change Headers to be a map[string]interface{}
if t.ID == "Headers" {
@ -346,8 +346,9 @@ func FixDomains(domains []*internal.Domain) {
var types []*internal.Type
for _, t := range d.Types {
switch t.ID {
case "Timestamp":
continue
/*case "Timestamp":
t.Type = internal.TypeTimestamp
t.Extra += templates.ExtraBootstampTemplate(t, d)*/
case "ExceptionDetails":
t.Extra += templates.ExtraExceptionDetailsTemplate()
@ -438,13 +439,15 @@ func convertObjectProperties(params []*internal.Type, d *internal.Domain, name s
case p.Enum != nil:
r = append(r, fixupEnumParameter(name, p, d))
case (p.Name == "timestamp" || p.Ref == "Network.Timestamp" || p.Ref == "Timestamp") && d.Domain != internal.DomainInput:
r = append(r, &internal.Type{
Name: p.Name,
Ref: "Network.Timestamp",
Description: p.Description,
Optional: p.Optional,
})
case p.Name == "timestamp":
log.Printf(">>> %s.%s.%s", d.Domain, name, p.Name)
r = append(r, p)
/*r = append(r, &internal.Type{
Name: p.Name,
Ref: "Runtime.Timestamp",
Description: p.Description,
Optional: p.Optional,
})*/
case p.Name == "modifiers":
r = append(r, &internal.Type{

View File

@ -6,10 +6,14 @@
// defines its JSON unmarshaling.
{% func ExtraTimestampTemplate(t *internal.Type, d *internal.Domain) %}{%code
typ := t.IDorName()
bootstamp := false
%}
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t {%s= typ %}) MarshalEasyJSON(out *jwriter.Writer) {
out.Float64(float64(time.Time(t).Sub(sysutil.BootTime()))/float64(time.Second))
{% if bootstamp %}
out.Float64(float64(time.Time(t).Sub(sysutil.BootTime()))/float64(time.Second)){% else %}
out.Float64(float64(time.Time(t))/float64(time.Second))
{% endif %}
}
// MarshalJSON satisfies json.Marshaler.
@ -19,7 +23,10 @@ func (t {%s= typ %}) MarshalJSON() ([]byte, error) {
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *{%s= typ %}) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = {%s= typ %}(sysutil.BootTime().Add(time.Duration(in.Float64()*float64(time.Second))))
{% if bootstamp %}
*t = {%s= typ %}(sysutil.BootTime().Add(time.Duration(in.Float64()*float64(time.Second)))){% else %}
*t = {%s= typ %}(time.Duration(in.Float64()*float64(time.Second)))
{% endif %}
}
// UnmarshalJSON satisfies json.Unmarshaler.

View File

@ -29,83 +29,118 @@ var (
func StreamExtraTimestampTemplate(qw422016 *qt422016.Writer, t *internal.Type, d *internal.Domain) {
//line templates/extra.qtpl:8
typ := t.IDorName()
bootstamp := false
//line templates/extra.qtpl:9
//line templates/extra.qtpl:10
qw422016.N().S(`
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t `)
//line templates/extra.qtpl:11
//line templates/extra.qtpl:12
qw422016.N().S(typ)
//line templates/extra.qtpl:11
//line templates/extra.qtpl:12
qw422016.N().S(`) MarshalEasyJSON(out *jwriter.Writer) {
out.Float64(float64(time.Time(t).Sub(sysutil.BootTime()))/float64(time.Second))
`)
//line templates/extra.qtpl:13
if bootstamp {
//line templates/extra.qtpl:13
qw422016.N().S(`
out.Float64(float64(time.Time(t).Sub(sysutil.BootTime()))/float64(time.Second))`)
//line templates/extra.qtpl:14
} else {
//line templates/extra.qtpl:14
qw422016.N().S(`
out.Float64(float64(time.Time(t))/float64(time.Second))
`)
//line templates/extra.qtpl:16
}
//line templates/extra.qtpl:16
qw422016.N().S(`
}
// MarshalJSON satisfies json.Marshaler.
func (t `)
//line templates/extra.qtpl:16
//line templates/extra.qtpl:20
qw422016.N().S(typ)
//line templates/extra.qtpl:16
//line templates/extra.qtpl:20
qw422016.N().S(`) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *`)
//line templates/extra.qtpl:21
//line templates/extra.qtpl:25
qw422016.N().S(typ)
//line templates/extra.qtpl:21
//line templates/extra.qtpl:25
qw422016.N().S(`) UnmarshalEasyJSON(in *jlexer.Lexer) {
`)
//line templates/extra.qtpl:26
if bootstamp {
//line templates/extra.qtpl:26
qw422016.N().S(`
*t = `)
//line templates/extra.qtpl:22
qw422016.N().S(typ)
//line templates/extra.qtpl:22
qw422016.N().S(`(sysutil.BootTime().Add(time.Duration(in.Float64()*float64(time.Second))))
//line templates/extra.qtpl:27
qw422016.N().S(typ)
//line templates/extra.qtpl:27
qw422016.N().S(`(sysutil.BootTime().Add(time.Duration(in.Float64()*float64(time.Second))))`)
//line templates/extra.qtpl:27
} else {
//line templates/extra.qtpl:27
qw422016.N().S(`
*t = `)
//line templates/extra.qtpl:28
qw422016.N().S(typ)
//line templates/extra.qtpl:28
qw422016.N().S(`(time.Duration(in.Float64()*float64(time.Second)))
`)
//line templates/extra.qtpl:29
}
//line templates/extra.qtpl:29
qw422016.N().S(`
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *`)
//line templates/extra.qtpl:26
//line templates/extra.qtpl:33
qw422016.N().S(typ)
//line templates/extra.qtpl:26
//line templates/extra.qtpl:33
qw422016.N().S(`) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
`)
//line templates/extra.qtpl:29
//line templates/extra.qtpl:36
}
//line templates/extra.qtpl:29
//line templates/extra.qtpl:36
func WriteExtraTimestampTemplate(qq422016 qtio422016.Writer, t *internal.Type, d *internal.Domain) {
//line templates/extra.qtpl:29
//line templates/extra.qtpl:36
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:29
//line templates/extra.qtpl:36
StreamExtraTimestampTemplate(qw422016, t, d)
//line templates/extra.qtpl:29
//line templates/extra.qtpl:36
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:29
//line templates/extra.qtpl:36
}
//line templates/extra.qtpl:29
//line templates/extra.qtpl:36
func ExtraTimestampTemplate(t *internal.Type, d *internal.Domain) string {
//line templates/extra.qtpl:29
//line templates/extra.qtpl:36
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:29
//line templates/extra.qtpl:36
WriteExtraTimestampTemplate(qb422016, t, d)
//line templates/extra.qtpl:29
//line templates/extra.qtpl:36
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:29
//line templates/extra.qtpl:36
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:29
//line templates/extra.qtpl:36
return qs422016
//line templates/extra.qtpl:29
//line templates/extra.qtpl:36
}
// ExtraFrameTemplate is a special template for the Page.Frame type, adding FrameState.
//line templates/extra.qtpl:32
//line templates/extra.qtpl:39
func StreamExtraFrameTemplate(qw422016 *qt422016.Writer) {
//line templates/extra.qtpl:32
//line templates/extra.qtpl:39
qw422016.N().S(`
// FrameState is the state of a Frame.
type FrameState uint16
@ -144,40 +179,40 @@ func (fs FrameState) String() string {
// EmptyFrameID is the "non-existent" frame id.
const EmptyFrameID = FrameID("")
`)
//line templates/extra.qtpl:69
//line templates/extra.qtpl:76
}
//line templates/extra.qtpl:69
//line templates/extra.qtpl:76
func WriteExtraFrameTemplate(qq422016 qtio422016.Writer) {
//line templates/extra.qtpl:69
//line templates/extra.qtpl:76
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:69
//line templates/extra.qtpl:76
StreamExtraFrameTemplate(qw422016)
//line templates/extra.qtpl:69
//line templates/extra.qtpl:76
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:69
//line templates/extra.qtpl:76
}
//line templates/extra.qtpl:69
//line templates/extra.qtpl:76
func ExtraFrameTemplate() string {
//line templates/extra.qtpl:69
//line templates/extra.qtpl:76
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:69
//line templates/extra.qtpl:76
WriteExtraFrameTemplate(qb422016)
//line templates/extra.qtpl:69
//line templates/extra.qtpl:76
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:69
//line templates/extra.qtpl:76
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:69
//line templates/extra.qtpl:76
return qs422016
//line templates/extra.qtpl:69
//line templates/extra.qtpl:76
}
// ExtraNodeTemplate is a special template for the DOM.Node type, adding NodeState.
//line templates/extra.qtpl:72
//line templates/extra.qtpl:79
func StreamExtraNodeTemplate(qw422016 *qt422016.Writer) {
//line templates/extra.qtpl:72
//line templates/extra.qtpl:79
qw422016.N().S(`
// AttributeValue returns the named attribute for the node.
func (n *Node) AttributeValue(name string) string {
@ -211,21 +246,21 @@ func (n *Node) xpath(stopAtDocument, stopAtID bool) string {
case stopAtID && id != "":
p = "/"
pos = `)
//line templates/extra.qtpl:72
//line templates/extra.qtpl:79
qw422016.N().S("`")
//line templates/extra.qtpl:72
//line templates/extra.qtpl:79
qw422016.N().S(`[@id='`)
//line templates/extra.qtpl:72
//line templates/extra.qtpl:79
qw422016.N().S("`")
//line templates/extra.qtpl:72
//line templates/extra.qtpl:79
qw422016.N().S(`+id+`)
//line templates/extra.qtpl:72
//line templates/extra.qtpl:79
qw422016.N().S("`")
//line templates/extra.qtpl:72
//line templates/extra.qtpl:79
qw422016.N().S(`']`)
//line templates/extra.qtpl:72
//line templates/extra.qtpl:79
qw422016.N().S("`")
//line templates/extra.qtpl:72
//line templates/extra.qtpl:79
qw422016.N().S(`
case n.Parent != nil:
@ -309,136 +344,136 @@ func (ns NodeState) String() string {
// EmptyNodeID is the "non-existent" node id.
const EmptyNodeID = NodeID(0)
`)
//line templates/extra.qtpl:186
//line templates/extra.qtpl:193
}
//line templates/extra.qtpl:186
//line templates/extra.qtpl:193
func WriteExtraNodeTemplate(qq422016 qtio422016.Writer) {
//line templates/extra.qtpl:186
//line templates/extra.qtpl:193
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:186
//line templates/extra.qtpl:193
StreamExtraNodeTemplate(qw422016)
//line templates/extra.qtpl:186
//line templates/extra.qtpl:193
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:186
//line templates/extra.qtpl:193
}
//line templates/extra.qtpl:186
//line templates/extra.qtpl:193
func ExtraNodeTemplate() string {
//line templates/extra.qtpl:186
//line templates/extra.qtpl:193
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:186
//line templates/extra.qtpl:193
WriteExtraNodeTemplate(qb422016)
//line templates/extra.qtpl:186
//line templates/extra.qtpl:193
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:186
//line templates/extra.qtpl:193
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:186
//line templates/extra.qtpl:193
return qs422016
//line templates/extra.qtpl:186
//line templates/extra.qtpl:193
}
// ExtraFixStringUnmarshaler is a template that forces values to be parsed properly.
//line templates/extra.qtpl:189
//line templates/extra.qtpl:196
func StreamExtraFixStringUnmarshaler(qw422016 *qt422016.Writer, typ, parseFunc, extra string) {
//line templates/extra.qtpl:189
//line templates/extra.qtpl:196
qw422016.N().S(`
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *`)
//line templates/extra.qtpl:191
//line templates/extra.qtpl:198
qw422016.N().S(typ)
//line templates/extra.qtpl:191
//line templates/extra.qtpl:198
qw422016.N().S(`) UnmarshalEasyJSON(in *jlexer.Lexer) {
buf := in.Raw()
if l := len(buf); l > 2 && buf[0] == '"' && buf[l-1] == '"' {
buf = buf[1:l-1]
}
`)
//line templates/extra.qtpl:196
//line templates/extra.qtpl:203
if parseFunc != "" {
//line templates/extra.qtpl:196
//line templates/extra.qtpl:203
qw422016.N().S(`
v, err := strconv.`)
//line templates/extra.qtpl:197
//line templates/extra.qtpl:204
qw422016.N().S(parseFunc)
//line templates/extra.qtpl:197
//line templates/extra.qtpl:204
qw422016.N().S(`(string(buf)`)
//line templates/extra.qtpl:197
//line templates/extra.qtpl:204
qw422016.N().S(extra)
//line templates/extra.qtpl:197
//line templates/extra.qtpl:204
qw422016.N().S(`)
if err != nil {
in.AddError(err)
}
`)
//line templates/extra.qtpl:201
//line templates/extra.qtpl:208
}
//line templates/extra.qtpl:201
//line templates/extra.qtpl:208
qw422016.N().S(`
*t = `)
//line templates/extra.qtpl:202
//line templates/extra.qtpl:209
qw422016.N().S(typ)
//line templates/extra.qtpl:202
//line templates/extra.qtpl:209
qw422016.N().S(`(`)
//line templates/extra.qtpl:202
//line templates/extra.qtpl:209
if parseFunc != "" {
//line templates/extra.qtpl:202
//line templates/extra.qtpl:209
qw422016.N().S(`v`)
//line templates/extra.qtpl:202
//line templates/extra.qtpl:209
} else {
//line templates/extra.qtpl:202
//line templates/extra.qtpl:209
qw422016.N().S(`buf`)
//line templates/extra.qtpl:202
//line templates/extra.qtpl:209
}
//line templates/extra.qtpl:202
//line templates/extra.qtpl:209
qw422016.N().S(`)
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *`)
//line templates/extra.qtpl:206
//line templates/extra.qtpl:213
qw422016.N().S(typ)
//line templates/extra.qtpl:206
//line templates/extra.qtpl:213
qw422016.N().S(`) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
`)
//line templates/extra.qtpl:209
//line templates/extra.qtpl:216
}
//line templates/extra.qtpl:209
//line templates/extra.qtpl:216
func WriteExtraFixStringUnmarshaler(qq422016 qtio422016.Writer, typ, parseFunc, extra string) {
//line templates/extra.qtpl:209
//line templates/extra.qtpl:216
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:209
//line templates/extra.qtpl:216
StreamExtraFixStringUnmarshaler(qw422016, typ, parseFunc, extra)
//line templates/extra.qtpl:209
//line templates/extra.qtpl:216
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:209
//line templates/extra.qtpl:216
}
//line templates/extra.qtpl:209
//line templates/extra.qtpl:216
func ExtraFixStringUnmarshaler(typ, parseFunc, extra string) string {
//line templates/extra.qtpl:209
//line templates/extra.qtpl:216
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:209
//line templates/extra.qtpl:216
WriteExtraFixStringUnmarshaler(qb422016, typ, parseFunc, extra)
//line templates/extra.qtpl:209
//line templates/extra.qtpl:216
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:209
//line templates/extra.qtpl:216
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:209
//line templates/extra.qtpl:216
return qs422016
//line templates/extra.qtpl:209
//line templates/extra.qtpl:216
}
// ExtraExceptionDetailsTemplate is a special template for the Runtime.ExceptionDetails type that
// defines the standard error interface.
//line templates/extra.qtpl:213
//line templates/extra.qtpl:220
func StreamExtraExceptionDetailsTemplate(qw422016 *qt422016.Writer) {
//line templates/extra.qtpl:213
//line templates/extra.qtpl:220
qw422016.N().S(`
// Error satisfies the error interface.
func (e *ExceptionDetails) Error() string {
@ -447,41 +482,41 @@ func (e *ExceptionDetails) Error() string {
return fmt.Sprintf("encountered exception '%s' (%d:%d)", e.Text, e.LineNumber, e.ColumnNumber)
}
`)
//line templates/extra.qtpl:220
//line templates/extra.qtpl:227
}
//line templates/extra.qtpl:220
//line templates/extra.qtpl:227
func WriteExtraExceptionDetailsTemplate(qq422016 qtio422016.Writer) {
//line templates/extra.qtpl:220
//line templates/extra.qtpl:227
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:220
//line templates/extra.qtpl:227
StreamExtraExceptionDetailsTemplate(qw422016)
//line templates/extra.qtpl:220
//line templates/extra.qtpl:227
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:220
//line templates/extra.qtpl:227
}
//line templates/extra.qtpl:220
//line templates/extra.qtpl:227
func ExtraExceptionDetailsTemplate() string {
//line templates/extra.qtpl:220
//line templates/extra.qtpl:227
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:220
//line templates/extra.qtpl:227
WriteExtraExceptionDetailsTemplate(qb422016)
//line templates/extra.qtpl:220
//line templates/extra.qtpl:227
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:220
//line templates/extra.qtpl:227
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:220
//line templates/extra.qtpl:227
return qs422016
//line templates/extra.qtpl:220
//line templates/extra.qtpl:227
}
// ExtraCDPTypes is the template for additional internal type
// declarations.
//line templates/extra.qtpl:224
//line templates/extra.qtpl:231
func StreamExtraCDPTypes(qw422016 *qt422016.Writer) {
//line templates/extra.qtpl:224
//line templates/extra.qtpl:231
qw422016.N().S(`
// Error satisfies the error interface.
@ -515,40 +550,40 @@ type Handler interface {
Release(<-chan interface{})
}
`)
//line templates/extra.qtpl:256
//line templates/extra.qtpl:263
}
//line templates/extra.qtpl:256
//line templates/extra.qtpl:263
func WriteExtraCDPTypes(qq422016 qtio422016.Writer) {
//line templates/extra.qtpl:256
//line templates/extra.qtpl:263
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:256
//line templates/extra.qtpl:263
StreamExtraCDPTypes(qw422016)
//line templates/extra.qtpl:256
//line templates/extra.qtpl:263
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:256
//line templates/extra.qtpl:263
}
//line templates/extra.qtpl:256
//line templates/extra.qtpl:263
func ExtraCDPTypes() string {
//line templates/extra.qtpl:256
//line templates/extra.qtpl:263
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:256
//line templates/extra.qtpl:263
WriteExtraCDPTypes(qb422016)
//line templates/extra.qtpl:256
//line templates/extra.qtpl:263
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:256
//line templates/extra.qtpl:263
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:256
//line templates/extra.qtpl:263
return qs422016
//line templates/extra.qtpl:256
//line templates/extra.qtpl:263
}
// ExtraUtilTemplate generates the decode func for the Message type.
//line templates/extra.qtpl:259
//line templates/extra.qtpl:266
func StreamExtraUtilTemplate(qw422016 *qt422016.Writer, domains []*internal.Domain) {
//line templates/extra.qtpl:259
//line templates/extra.qtpl:266
qw422016.N().S(`
type empty struct{}
var emptyVal = &empty{}
@ -557,66 +592,66 @@ var emptyVal = &empty{}
func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
var v easyjson.Unmarshaler
switch msg.Method {`)
//line templates/extra.qtpl:266
//line templates/extra.qtpl:273
for _, d := range domains {
//line templates/extra.qtpl:266
//line templates/extra.qtpl:273
for _, c := range d.Commands {
//line templates/extra.qtpl:266
//line templates/extra.qtpl:273
qw422016.N().S(`
case cdp.`)
//line templates/extra.qtpl:267
//line templates/extra.qtpl:274
qw422016.N().S(c.CommandMethodType(d))
//line templates/extra.qtpl:267
//line templates/extra.qtpl:274
qw422016.N().S(`:`)
//line templates/extra.qtpl:267
//line templates/extra.qtpl:274
if len(c.Returns) == 0 {
//line templates/extra.qtpl:267
//line templates/extra.qtpl:274
qw422016.N().S(`
return emptyVal, nil`)
//line templates/extra.qtpl:268
//line templates/extra.qtpl:275
} else {
//line templates/extra.qtpl:268
//line templates/extra.qtpl:275
qw422016.N().S(`
v = new(`)
//line templates/extra.qtpl:269
//line templates/extra.qtpl:276
qw422016.N().S(d.PackageRefName())
//line templates/extra.qtpl:269
//line templates/extra.qtpl:276
qw422016.N().S(`.`)
//line templates/extra.qtpl:269
//line templates/extra.qtpl:276
qw422016.N().S(c.CommandReturnsType())
//line templates/extra.qtpl:269
//line templates/extra.qtpl:276
qw422016.N().S(`)`)
//line templates/extra.qtpl:269
//line templates/extra.qtpl:276
}
//line templates/extra.qtpl:269
//line templates/extra.qtpl:276
qw422016.N().S(`
`)
//line templates/extra.qtpl:270
//line templates/extra.qtpl:277
}
//line templates/extra.qtpl:270
//line templates/extra.qtpl:277
for _, e := range d.Events {
//line templates/extra.qtpl:270
//line templates/extra.qtpl:277
qw422016.N().S(`
case cdp.`)
//line templates/extra.qtpl:271
//line templates/extra.qtpl:278
qw422016.N().S(e.EventMethodType(d))
//line templates/extra.qtpl:271
//line templates/extra.qtpl:278
qw422016.N().S(`:
v = new(`)
//line templates/extra.qtpl:272
//line templates/extra.qtpl:279
qw422016.N().S(d.PackageRefName())
//line templates/extra.qtpl:272
//line templates/extra.qtpl:279
qw422016.N().S(`.`)
//line templates/extra.qtpl:272
//line templates/extra.qtpl:279
qw422016.N().S(e.EventType())
//line templates/extra.qtpl:272
//line templates/extra.qtpl:279
qw422016.N().S(`)
`)
//line templates/extra.qtpl:273
//line templates/extra.qtpl:280
}
//line templates/extra.qtpl:273
//line templates/extra.qtpl:280
}
//line templates/extra.qtpl:273
//line templates/extra.qtpl:280
qw422016.N().S(`}
var buf easyjson.RawMessage
@ -639,69 +674,69 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
return v, nil
}
`)
//line templates/extra.qtpl:294
//line templates/extra.qtpl:301
}
//line templates/extra.qtpl:294
//line templates/extra.qtpl:301
func WriteExtraUtilTemplate(qq422016 qtio422016.Writer, domains []*internal.Domain) {
//line templates/extra.qtpl:294
//line templates/extra.qtpl:301
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:294
//line templates/extra.qtpl:301
StreamExtraUtilTemplate(qw422016, domains)
//line templates/extra.qtpl:294
//line templates/extra.qtpl:301
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:294
//line templates/extra.qtpl:301
}
//line templates/extra.qtpl:294
//line templates/extra.qtpl:301
func ExtraUtilTemplate(domains []*internal.Domain) string {
//line templates/extra.qtpl:294
//line templates/extra.qtpl:301
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:294
//line templates/extra.qtpl:301
WriteExtraUtilTemplate(qb422016, domains)
//line templates/extra.qtpl:294
//line templates/extra.qtpl:301
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:294
//line templates/extra.qtpl:301
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:294
//line templates/extra.qtpl:301
return qs422016
//line templates/extra.qtpl:294
//line templates/extra.qtpl:301
}
//line templates/extra.qtpl:296
//line templates/extra.qtpl:303
func StreamExtraMethodTypeDomainDecoder(qw422016 *qt422016.Writer) {
//line templates/extra.qtpl:296
//line templates/extra.qtpl:303
qw422016.N().S(`
// Domain returns the Chrome Debugging Protocol domain of the event or command.
func (t MethodType) Domain() string {
return string(t[:strings.IndexByte(string(t), '.')])
}
`)
//line templates/extra.qtpl:301
//line templates/extra.qtpl:308
}
//line templates/extra.qtpl:301
//line templates/extra.qtpl:308
func WriteExtraMethodTypeDomainDecoder(qq422016 qtio422016.Writer) {
//line templates/extra.qtpl:301
//line templates/extra.qtpl:308
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:301
//line templates/extra.qtpl:308
StreamExtraMethodTypeDomainDecoder(qw422016)
//line templates/extra.qtpl:301
//line templates/extra.qtpl:308
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:301
//line templates/extra.qtpl:308
}
//line templates/extra.qtpl:301
//line templates/extra.qtpl:308
func ExtraMethodTypeDomainDecoder() string {
//line templates/extra.qtpl:301
//line templates/extra.qtpl:308
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:301
//line templates/extra.qtpl:308
WriteExtraMethodTypeDomainDecoder(qb422016)
//line templates/extra.qtpl:301
//line templates/extra.qtpl:308
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:301
//line templates/extra.qtpl:308
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:301
//line templates/extra.qtpl:308
return qs422016
//line templates/extra.qtpl:301
//line templates/extra.qtpl:308
}