Tracing
本页面介绍 Lynx DevTool 支持的 Tracing CDP domain。
实验性参考
此生成的参考文档仍在完善中。
- CDP events 尚未包含。
- 部分 Lynx 扩展已列出,但尚未提供详细文档。
- 方法说明尚未根据实现自动校验,可能不完整或不准确。
在依赖本参考前,请根据实现及所链接的 upstream CDP reference 验证实际行为。
概览
- 作用域:
global-and-instance - CDP domain:Tracing
标准方法
Lynx 扩展
Tracing.getStartupTracingConfig
Returns the stored startup tracing configuration string.
- Origin:
lynx-extension - Source:
devtool/lynx_devtool/agent/domain_agent/inspector_tracing_agent.cc
参数
无参数。
返回字段
备注
- Dispatches through LynxGlobalDevToolMediator on the global DevTool task runner.
- Reads GlobalDevToolPlatformFacade::GetTraceController()->GetStartupTracingConfig().
- The trace controller stores the configuration as an opaque string. Lynx does not parse or validate it in this CDP method.
- Returns a CDP error with message Failed to get trace controller when no trace controller is available.
- If the global mediator has no default task runner, the current handler does not send an explicit CDP response.
示例
Read startup tracing config
Request:
Response:
Tracing.getStartupTracingFile
Emits a Tracing.tracingComplete event for the stored startup tracing file.
- Origin:
lynx-extension - Source:
devtool/lynx_devtool/agent/domain_agent/inspector_tracing_agent.cc
参数
无参数。
返回字段
无返回字段。
事件
- Tracing.tracingComplete
备注
- Dispatches through LynxGlobalDevToolMediator on the global DevTool task runner.
- Reads GlobalDevToolPlatformFacade::GetTraceController()->GetStartupTracingFilePath().
- When a startup tracing file path exists, the method first sends an empty OK response and then sends Tracing.tracingComplete.
- Tracing.tracingComplete.params.stream is a FileStream handle encoded as a string. Read it with IO.read and close it with IO.close.
- Tracing.tracingComplete.params.dataLossOccurred is true when the file cannot be opened as a stream.
- Tracing.tracingComplete.params.isStartupTracing is true for this method.
- Returns a CDP error with message Startup Tracing is running when no file is available because tracing is still active.
- Returns a CDP error with message Failed to get startup tracing file when no file is available and tracing is not active.
- Returns a CDP error with message Failed to get trace controller when no trace controller is available.
示例
Request the startup tracing file
Request:
Response:
Startup tracing complete event
Response:
Tracing.setStartupTracingConfig
Stores an opaque startup tracing configuration string.
- Origin:
lynx-extension - Source:
devtool/lynx_devtool/agent/domain_agent/inspector_tracing_agent.cc
参数
返回字段
无返回字段。
备注
- Dispatches through LynxGlobalDevToolMediator on the global DevTool task runner.
- Writes params.config to GlobalDevToolPlatformFacade::GetTraceController()->SetStartupTracingConfig().
- The trace controller stores the configuration as an opaque string. Lynx does not parse or validate it in this CDP method.
- Returns an empty OK response when params.config is present.
- Returns a CDP error with message Set Startup Tracing config is null when params.config is missing.
- Returns a CDP error with message Failed to get trace controller when no trace controller is available.
- If the global mediator has no default task runner, the current handler does not send an explicit CDP response.
示例
Store startup tracing config
Request:
Response:
Tracing.takeVMSnapshotByUrl
为指定 URL 对应页面的 MTS 或 BTS 虚拟机创建快照。
- 来源类型:
lynx-extension - 源码:
devtool/lynx_devtool/agent/domain_agent/inspector_tracing_agent.cc
参数
返回字段
无返回字段。
备注
- 通过 LynxGlobalDevToolMediator 在全局 DevTool 任务执行器上分发。
- tracing 会话处于活动状态,且提供了
params.url和params.type时,返回空的成功响应。 - 缺少
url或type参数时,返回 CDP 错误,消息为Argument error。 - tracing 会话未处于活动状态时,返回 CDP 错误,消息为
Tracing is not started。 - 如果全局 mediator 没有默认任务执行器,当前处理函数不会发送显式的 CDP 响应。
示例
为指定 URL 对应的页面创建快照
请求:
响应: