mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
feat: promisify contentTracing recording APIs (#16584)
* feat: promisify contentTracing.startRecording() * feat: promisify contentTracing.stopRecording() * test: convert specs for new promisified apis * chore: deprecate and ensure legacy tests work
This commit is contained in:
@@ -12,7 +12,6 @@ result.
|
||||
**Note:** You should not use this module until the `ready` event of the app
|
||||
module is emitted.
|
||||
|
||||
|
||||
```javascript
|
||||
const { app, contentTracing } = require('electron')
|
||||
|
||||
@@ -67,6 +66,19 @@ Recording begins immediately locally and asynchronously on child processes
|
||||
as soon as they receive the EnableRecording request. The `callback` will be
|
||||
called once all child processes have acknowledged the `startRecording` request.
|
||||
|
||||
**[Deprecated Soon](promisification.md)**
|
||||
|
||||
### `contentTracing.startRecording(options)`
|
||||
|
||||
* `options` ([TraceCategoriesAndOptions](structures/trace-categories-and-options.md) | [TraceConfig](structures/trace-config.md))
|
||||
|
||||
Returns `Promise<void>` - resolved once all child processes have acknowledged the `startRecording` request.
|
||||
|
||||
Start recording on all processes.
|
||||
|
||||
Recording begins immediately locally and asynchronously on child processes
|
||||
as soon as they receive the EnableRecording request.
|
||||
|
||||
### `contentTracing.stopRecording(resultFilePath, callback)`
|
||||
|
||||
* `resultFilePath` String
|
||||
@@ -88,6 +100,25 @@ Trace data will be written into `resultFilePath` if it is not empty or into a
|
||||
temporary file. The actual file path will be passed to `callback` if it's not
|
||||
`null`.
|
||||
|
||||
**[Deprecated Soon](promisification.md)**
|
||||
|
||||
### `contentTracing.stopRecording(resultFilePath)`
|
||||
|
||||
* `resultFilePath` String
|
||||
|
||||
Returns `Promise<String>` - resolves with a file that contains the traced data once all child processes have acknowledged the `stopRecording` request
|
||||
|
||||
Stop recording on all processes.
|
||||
|
||||
Child processes typically cache trace data and only rarely flush and send
|
||||
trace data back to the main process. This helps to minimize the runtime overhead
|
||||
of tracing since sending trace data over IPC can be an expensive operation. So,
|
||||
to end tracing, we must asynchronously ask all child processes to flush any
|
||||
pending trace data.
|
||||
|
||||
Trace data will be written into `resultFilePath` if it is not empty or into a
|
||||
temporary file.
|
||||
|
||||
### `contentTracing.getTraceBufferUsage(callback)`
|
||||
|
||||
* `callback` Function
|
||||
|
||||
Reference in New Issue
Block a user