2017-01-24 15:09:23 +00:00
// Package heapprofiler provides the Chrome Debugging Protocol
2017-02-12 04:59:33 +00:00
// commands, types, and events for the HeapProfiler domain.
2017-01-24 15:09:23 +00:00
//
// Generated by the chromedp-gen command.
package heapprofiler
// AUTOGENERATED. DO NOT EDIT.
import (
"context"
2017-01-26 07:28:34 +00:00
cdp "github.com/knq/chromedp/cdp"
2017-01-24 15:09:23 +00:00
"github.com/knq/chromedp/cdp/runtime"
"github.com/mailru/easyjson"
)
2017-01-26 07:28:34 +00:00
// EnableParams [no description].
2017-01-24 15:09:23 +00:00
type EnableParams struct { }
2017-01-26 07:28:34 +00:00
// Enable [no description].
2017-01-24 15:09:23 +00:00
func Enable ( ) * EnableParams {
return & EnableParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.enable against the provided context and
// target handler.
func ( p * EnableParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandHeapProfilerEnable , cdp . Empty )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
return nil
case error :
return v
}
case <- ctxt . Done ( ) :
2017-02-12 04:59:33 +00:00
return ctxt . Err ( )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// DisableParams [no description].
2017-01-24 15:09:23 +00:00
type DisableParams struct { }
2017-01-26 07:28:34 +00:00
// Disable [no description].
2017-01-24 15:09:23 +00:00
func Disable ( ) * DisableParams {
return & DisableParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.disable against the provided context and
// target handler.
func ( p * DisableParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandHeapProfilerDisable , cdp . Empty )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
return nil
case error :
return v
}
case <- ctxt . Done ( ) :
2017-02-12 04:59:33 +00:00
return ctxt . Err ( )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// StartTrackingHeapObjectsParams [no description].
2017-01-24 15:09:23 +00:00
type StartTrackingHeapObjectsParams struct {
TrackAllocations bool ` json:"trackAllocations,omitempty" `
}
2017-01-26 07:28:34 +00:00
// StartTrackingHeapObjects [no description].
//
2017-01-24 15:09:23 +00:00
// parameters:
func StartTrackingHeapObjects ( ) * StartTrackingHeapObjectsParams {
return & StartTrackingHeapObjectsParams { }
}
2017-01-26 07:28:34 +00:00
// WithTrackAllocations [no description].
2017-01-24 15:09:23 +00:00
func ( p StartTrackingHeapObjectsParams ) WithTrackAllocations ( trackAllocations bool ) * StartTrackingHeapObjectsParams {
p . TrackAllocations = trackAllocations
return & p
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.startTrackingHeapObjects against the provided context and
// target handler.
func ( p * StartTrackingHeapObjectsParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// marshal
buf , err := easyjson . Marshal ( p )
if err != nil {
return err
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandHeapProfilerStartTrackingHeapObjects , easyjson . RawMessage ( buf ) )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
return nil
case error :
return v
}
case <- ctxt . Done ( ) :
2017-02-12 04:59:33 +00:00
return ctxt . Err ( )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// StopTrackingHeapObjectsParams [no description].
2017-01-24 15:09:23 +00:00
type StopTrackingHeapObjectsParams struct {
ReportProgress bool ` json:"reportProgress,omitempty" ` // If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped.
}
2017-01-26 07:28:34 +00:00
// StopTrackingHeapObjects [no description].
//
2017-01-24 15:09:23 +00:00
// parameters:
func StopTrackingHeapObjects ( ) * StopTrackingHeapObjectsParams {
return & StopTrackingHeapObjectsParams { }
}
// WithReportProgress if true 'reportHeapSnapshotProgress' events will be
// generated while snapshot is being taken when the tracking is stopped.
func ( p StopTrackingHeapObjectsParams ) WithReportProgress ( reportProgress bool ) * StopTrackingHeapObjectsParams {
p . ReportProgress = reportProgress
return & p
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.stopTrackingHeapObjects against the provided context and
// target handler.
func ( p * StopTrackingHeapObjectsParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// marshal
buf , err := easyjson . Marshal ( p )
if err != nil {
return err
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandHeapProfilerStopTrackingHeapObjects , easyjson . RawMessage ( buf ) )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
return nil
case error :
return v
}
case <- ctxt . Done ( ) :
2017-02-12 04:59:33 +00:00
return ctxt . Err ( )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// TakeHeapSnapshotParams [no description].
2017-01-24 15:09:23 +00:00
type TakeHeapSnapshotParams struct {
ReportProgress bool ` json:"reportProgress,omitempty" ` // If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.
}
2017-01-26 07:28:34 +00:00
// TakeHeapSnapshot [no description].
//
2017-01-24 15:09:23 +00:00
// parameters:
func TakeHeapSnapshot ( ) * TakeHeapSnapshotParams {
return & TakeHeapSnapshotParams { }
}
// WithReportProgress if true 'reportHeapSnapshotProgress' events will be
// generated while snapshot is being taken.
func ( p TakeHeapSnapshotParams ) WithReportProgress ( reportProgress bool ) * TakeHeapSnapshotParams {
p . ReportProgress = reportProgress
return & p
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.takeHeapSnapshot against the provided context and
// target handler.
func ( p * TakeHeapSnapshotParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// marshal
buf , err := easyjson . Marshal ( p )
if err != nil {
return err
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandHeapProfilerTakeHeapSnapshot , easyjson . RawMessage ( buf ) )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
return nil
case error :
return v
}
case <- ctxt . Done ( ) :
2017-02-12 04:59:33 +00:00
return ctxt . Err ( )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// CollectGarbageParams [no description].
2017-01-24 15:09:23 +00:00
type CollectGarbageParams struct { }
2017-01-26 07:28:34 +00:00
// CollectGarbage [no description].
2017-01-24 15:09:23 +00:00
func CollectGarbage ( ) * CollectGarbageParams {
return & CollectGarbageParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.collectGarbage against the provided context and
// target handler.
func ( p * CollectGarbageParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandHeapProfilerCollectGarbage , cdp . Empty )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
return nil
case error :
return v
}
case <- ctxt . Done ( ) :
2017-02-12 04:59:33 +00:00
return ctxt . Err ( )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// GetObjectByHeapObjectIDParams [no description].
2017-01-24 15:09:23 +00:00
type GetObjectByHeapObjectIDParams struct {
ObjectID HeapSnapshotObjectID ` json:"objectId" `
ObjectGroup string ` json:"objectGroup,omitempty" ` // Symbolic group name that can be used to release multiple objects.
}
2017-01-26 07:28:34 +00:00
// GetObjectByHeapObjectID [no description].
//
2017-01-24 15:09:23 +00:00
// parameters:
2017-01-26 07:28:34 +00:00
// objectID
func GetObjectByHeapObjectID ( objectID HeapSnapshotObjectID ) * GetObjectByHeapObjectIDParams {
2017-01-24 15:09:23 +00:00
return & GetObjectByHeapObjectIDParams {
2017-01-26 07:28:34 +00:00
ObjectID : objectID ,
2017-01-24 15:09:23 +00:00
}
}
// WithObjectGroup symbolic group name that can be used to release multiple
// objects.
func ( p GetObjectByHeapObjectIDParams ) WithObjectGroup ( objectGroup string ) * GetObjectByHeapObjectIDParams {
p . ObjectGroup = objectGroup
return & p
}
// GetObjectByHeapObjectIDReturns return values.
type GetObjectByHeapObjectIDReturns struct {
Result * runtime . RemoteObject ` json:"result,omitempty" ` // Evaluation result.
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.getObjectByHeapObjectId against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// result - Evaluation result.
2017-02-12 04:59:33 +00:00
func ( p * GetObjectByHeapObjectIDParams ) Do ( ctxt context . Context , h cdp . Handler ) ( result * runtime . RemoteObject , err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// marshal
buf , err := easyjson . Marshal ( p )
if err != nil {
return nil , err
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandHeapProfilerGetObjectByHeapObjectID , easyjson . RawMessage ( buf ) )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return nil , cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
// unmarshal
var r GetObjectByHeapObjectIDReturns
err = easyjson . Unmarshal ( v , & r )
if err != nil {
2017-01-26 07:28:34 +00:00
return nil , cdp . ErrInvalidResult
2017-01-24 15:09:23 +00:00
}
return r . Result , nil
case error :
return nil , v
}
case <- ctxt . Done ( ) :
2017-02-12 04:59:33 +00:00
return nil , ctxt . Err ( )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return nil , cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}
// AddInspectedHeapObjectParams enables console to refer to the node with
// given id via $x (see Command Line API for more details $x functions).
type AddInspectedHeapObjectParams struct {
HeapObjectID HeapSnapshotObjectID ` json:"heapObjectId" ` // Heap snapshot object id to be accessible by means of $x command line API.
}
// AddInspectedHeapObject enables console to refer to the node with given id
// via $x (see Command Line API for more details $x functions).
//
// parameters:
2017-01-26 07:28:34 +00:00
// heapObjectID - Heap snapshot object id to be accessible by means of $x command line API.
func AddInspectedHeapObject ( heapObjectID HeapSnapshotObjectID ) * AddInspectedHeapObjectParams {
2017-01-24 15:09:23 +00:00
return & AddInspectedHeapObjectParams {
2017-01-26 07:28:34 +00:00
HeapObjectID : heapObjectID ,
2017-01-24 15:09:23 +00:00
}
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.addInspectedHeapObject against the provided context and
// target handler.
func ( p * AddInspectedHeapObjectParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// marshal
buf , err := easyjson . Marshal ( p )
if err != nil {
return err
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandHeapProfilerAddInspectedHeapObject , easyjson . RawMessage ( buf ) )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
return nil
case error :
return v
}
case <- ctxt . Done ( ) :
2017-02-12 04:59:33 +00:00
return ctxt . Err ( )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// GetHeapObjectIDParams [no description].
2017-01-24 15:09:23 +00:00
type GetHeapObjectIDParams struct {
ObjectID runtime . RemoteObjectID ` json:"objectId" ` // Identifier of the object to get heap object id for.
}
2017-01-26 07:28:34 +00:00
// GetHeapObjectID [no description].
//
2017-01-24 15:09:23 +00:00
// parameters:
2017-01-26 07:28:34 +00:00
// objectID - Identifier of the object to get heap object id for.
func GetHeapObjectID ( objectID runtime . RemoteObjectID ) * GetHeapObjectIDParams {
2017-01-24 15:09:23 +00:00
return & GetHeapObjectIDParams {
2017-01-26 07:28:34 +00:00
ObjectID : objectID ,
2017-01-24 15:09:23 +00:00
}
}
// GetHeapObjectIDReturns return values.
type GetHeapObjectIDReturns struct {
HeapSnapshotObjectID HeapSnapshotObjectID ` json:"heapSnapshotObjectId,omitempty" ` // Id of the heap snapshot object corresponding to the passed remote object id.
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.getHeapObjectId against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
2017-01-26 07:28:34 +00:00
// heapSnapshotObjectID - Id of the heap snapshot object corresponding to the passed remote object id.
2017-02-12 04:59:33 +00:00
func ( p * GetHeapObjectIDParams ) Do ( ctxt context . Context , h cdp . Handler ) ( heapSnapshotObjectID HeapSnapshotObjectID , err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// marshal
buf , err := easyjson . Marshal ( p )
if err != nil {
return "" , err
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandHeapProfilerGetHeapObjectID , easyjson . RawMessage ( buf ) )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return "" , cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
// unmarshal
var r GetHeapObjectIDReturns
err = easyjson . Unmarshal ( v , & r )
if err != nil {
2017-01-26 07:28:34 +00:00
return "" , cdp . ErrInvalidResult
2017-01-24 15:09:23 +00:00
}
return r . HeapSnapshotObjectID , nil
case error :
return "" , v
}
case <- ctxt . Done ( ) :
2017-02-12 04:59:33 +00:00
return "" , ctxt . Err ( )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return "" , cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// StartSamplingParams [no description].
2017-01-24 15:09:23 +00:00
type StartSamplingParams struct {
SamplingInterval float64 ` json:"samplingInterval,omitempty" ` // Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes.
}
2017-01-26 07:28:34 +00:00
// StartSampling [no description].
//
2017-01-24 15:09:23 +00:00
// parameters:
func StartSampling ( ) * StartSamplingParams {
return & StartSamplingParams { }
}
// WithSamplingInterval average sample interval in bytes. Poisson
// distribution is used for the intervals. The default value is 32768 bytes.
func ( p StartSamplingParams ) WithSamplingInterval ( samplingInterval float64 ) * StartSamplingParams {
p . SamplingInterval = samplingInterval
return & p
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.startSampling against the provided context and
// target handler.
func ( p * StartSamplingParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// marshal
buf , err := easyjson . Marshal ( p )
if err != nil {
return err
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandHeapProfilerStartSampling , easyjson . RawMessage ( buf ) )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
return nil
case error :
return v
}
case <- ctxt . Done ( ) :
2017-02-12 04:59:33 +00:00
return ctxt . Err ( )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// StopSamplingParams [no description].
2017-01-24 15:09:23 +00:00
type StopSamplingParams struct { }
2017-01-26 07:28:34 +00:00
// StopSampling [no description].
2017-01-24 15:09:23 +00:00
func StopSampling ( ) * StopSamplingParams {
return & StopSamplingParams { }
}
// StopSamplingReturns return values.
type StopSamplingReturns struct {
Profile * SamplingHeapProfile ` json:"profile,omitempty" ` // Recorded sampling heap profile.
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.stopSampling against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// profile - Recorded sampling heap profile.
2017-02-12 04:59:33 +00:00
func ( p * StopSamplingParams ) Do ( ctxt context . Context , h cdp . Handler ) ( profile * SamplingHeapProfile , err error ) {
2017-01-24 15:09:23 +00:00
if ctxt == nil {
ctxt = context . Background ( )
}
// execute
2017-01-26 07:28:34 +00:00
ch := h . Execute ( ctxt , cdp . CommandHeapProfilerStopSampling , cdp . Empty )
2017-01-24 15:09:23 +00:00
// read response
select {
case res := <- ch :
if res == nil {
2017-01-26 07:28:34 +00:00
return nil , cdp . ErrChannelClosed
2017-01-24 15:09:23 +00:00
}
switch v := res . ( type ) {
case easyjson . RawMessage :
// unmarshal
var r StopSamplingReturns
err = easyjson . Unmarshal ( v , & r )
if err != nil {
2017-01-26 07:28:34 +00:00
return nil , cdp . ErrInvalidResult
2017-01-24 15:09:23 +00:00
}
return r . Profile , nil
case error :
return nil , v
}
case <- ctxt . Done ( ) :
2017-02-12 04:59:33 +00:00
return nil , ctxt . Err ( )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
return nil , cdp . ErrUnknownResult
2017-01-24 15:09:23 +00:00
}