headlessexperimental

package
v0.0.0-...-fe04f09 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 8 Imported by: 4

Documentation

Overview

Package headlessexperimental provides the Chrome DevTools Protocol commands, types, and events for the HeadlessExperimental domain.

This domain provides experimental commands only supported in headless mode.

Generated by the cdproto-gen command.

Index

Constants

View Source
const (
	CommandBeginFrame = "HeadlessExperimental.beginFrame"
)

Command names.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeginFrameParams

type BeginFrameParams struct {
	FrameTimeTicks   float64           `json:"frameTimeTicks,omitempty"`   // Timestamp of this BeginFrame in Renderer TimeTicks (milliseconds of uptime). If not set, the current time will be used.
	Interval         float64           `json:"interval,omitempty"`         // The interval between BeginFrames that is reported to the compositor, in milliseconds. Defaults to a 60 frames/second interval, i.e. about 16.666 milliseconds.
	NoDisplayUpdates bool              `json:"noDisplayUpdates,omitempty"` // Whether updates should not be committed and drawn onto the display. False by default. If true, only side effects of the BeginFrame will be run, such as layout and animations, but any visual updates may not be visible on the display or in screenshots.
	Screenshot       *ScreenshotParams `json:"screenshot,omitempty"`       // If set, a screenshot of the frame will be captured and returned in the response. Otherwise, no screenshot will be captured. Note that capturing a screenshot can fail, for example, during renderer initialization. In such a case, no screenshot data will be returned.
}

BeginFrameParams sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a screenshot from the resulting frame. Requires that the target was created with enabled BeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also https://goo.gle/chrome-headless-rendering for more background.

func BeginFrame

func BeginFrame() *BeginFrameParams

BeginFrame sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a screenshot from the resulting frame. Requires that the target was created with enabled BeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also https://goo.gle/chrome-headless-rendering for more background.

See: https://chromedevtools.github.io/devtools-protocol/tot/HeadlessExperimental#method-beginFrame

parameters:

func (*BeginFrameParams) Do

func (p *BeginFrameParams) Do(ctx context.Context) (hasDamage bool, screenshotData []byte, err error)

Do executes HeadlessExperimental.beginFrame against the provided context.

returns:

hasDamage - Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the display. Reported for diagnostic uses, may be removed in the future.
screenshotData - Base64-encoded image data of the screenshot, if one was requested and successfully taken.

func (BeginFrameParams) MarshalEasyJSON

func (v BeginFrameParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (BeginFrameParams) MarshalJSON

func (v BeginFrameParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*BeginFrameParams) UnmarshalEasyJSON

func (v *BeginFrameParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*BeginFrameParams) UnmarshalJSON

func (v *BeginFrameParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (BeginFrameParams) WithFrameTimeTicks

func (p BeginFrameParams) WithFrameTimeTicks(frameTimeTicks float64) *BeginFrameParams

WithFrameTimeTicks timestamp of this BeginFrame in Renderer TimeTicks (milliseconds of uptime). If not set, the current time will be used.

func (BeginFrameParams) WithInterval

func (p BeginFrameParams) WithInterval(interval float64) *BeginFrameParams

WithInterval the interval between BeginFrames that is reported to the compositor, in milliseconds. Defaults to a 60 frames/second interval, i.e. about 16.666 milliseconds.

func (BeginFrameParams) WithNoDisplayUpdates

func (p BeginFrameParams) WithNoDisplayUpdates(noDisplayUpdates bool) *BeginFrameParams

WithNoDisplayUpdates whether updates should not be committed and drawn onto the display. False by default. If true, only side effects of the BeginFrame will be run, such as layout and animations, but any visual updates may not be visible on the display or in screenshots.

func (BeginFrameParams) WithScreenshot

func (p BeginFrameParams) WithScreenshot(screenshot *ScreenshotParams) *BeginFrameParams

WithScreenshot if set, a screenshot of the frame will be captured and returned in the response. Otherwise, no screenshot will be captured. Note that capturing a screenshot can fail, for example, during renderer initialization. In such a case, no screenshot data will be returned.

type BeginFrameReturns

type BeginFrameReturns struct {
	HasDamage      bool   `json:"hasDamage,omitempty"`      // Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the display. Reported for diagnostic uses, may be removed in the future.
	ScreenshotData string `json:"screenshotData,omitempty"` // Base64-encoded image data of the screenshot, if one was requested and successfully taken.
}

BeginFrameReturns return values.

func (BeginFrameReturns) MarshalEasyJSON

func (v BeginFrameReturns) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (BeginFrameReturns) MarshalJSON

func (v BeginFrameReturns) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*BeginFrameReturns) UnmarshalEasyJSON

func (v *BeginFrameReturns) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*BeginFrameReturns) UnmarshalJSON

func (v *BeginFrameReturns) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ScreenshotParams

type ScreenshotParams struct {
	Format           ScreenshotParamsFormat `json:"format,omitempty"`           // Image compression format (defaults to png).
	Quality          int64                  `json:"quality,omitempty"`          // Compression quality from range [0..100] (jpeg and webp only).
	OptimizeForSpeed bool                   `json:"optimizeForSpeed,omitempty"` // Optimize image encoding for speed, not for resulting size (defaults to false)
}

ScreenshotParams encoding options for a screenshot.

See: https://chromedevtools.github.io/devtools-protocol/tot/HeadlessExperimental#type-ScreenshotParams

func (ScreenshotParams) MarshalEasyJSON

func (v ScreenshotParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ScreenshotParams) MarshalJSON

func (v ScreenshotParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ScreenshotParams) UnmarshalEasyJSON

func (v *ScreenshotParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ScreenshotParams) UnmarshalJSON

func (v *ScreenshotParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ScreenshotParamsFormat

type ScreenshotParamsFormat string

ScreenshotParamsFormat image compression format (defaults to png).

See: https://chromedevtools.github.io/devtools-protocol/tot/HeadlessExperimental#type-ScreenshotParams

const (
	ScreenshotParamsFormatJpeg ScreenshotParamsFormat = "jpeg"
	ScreenshotParamsFormatPng  ScreenshotParamsFormat = "png"
	ScreenshotParamsFormatWebp ScreenshotParamsFormat = "webp"
)

ScreenshotParamsFormat values.

func (ScreenshotParamsFormat) MarshalEasyJSON

func (t ScreenshotParamsFormat) MarshalEasyJSON(out *jwriter.Writer)

MarshalEasyJSON satisfies easyjson.Marshaler.

func (ScreenshotParamsFormat) MarshalJSON

func (t ScreenshotParamsFormat) MarshalJSON() ([]byte, error)

MarshalJSON satisfies json.Marshaler.

func (ScreenshotParamsFormat) String

func (t ScreenshotParamsFormat) String() string

String returns the ScreenshotParamsFormat as string value.

func (*ScreenshotParamsFormat) UnmarshalEasyJSON

func (t *ScreenshotParamsFormat) UnmarshalEasyJSON(in *jlexer.Lexer)

UnmarshalEasyJSON satisfies easyjson.Unmarshaler.

func (*ScreenshotParamsFormat) UnmarshalJSON

func (t *ScreenshotParamsFormat) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies json.Unmarshaler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL