DefinitelyTyped/github-electron/github-electron.content-tracing.d.ts
2016-03-26 02:11:24 +01:00

92 lines
4.4 KiB
TypeScript

// Type definitions for Electron v0.37.2
// Project: http://electron.atom.io/
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Electron {
/**
* The content-tracing module is used to collect tracing data generated by the underlying Chromium content module.
* This module does not include a web interface so you need to open chrome://tracing/
* in a Chrome browser and load the generated file to view the result.
*/
interface ContentTracing {
/**
* Get a set of category groups. The category groups can change as new code paths are reached.
* @param callback Called once all child processes have acked to the getCategories request.
*/
getCategories(callback: (categoryGroups: any[]) => void): void;
/**
* Start recording on all processes. Recording begins immediately locally, and asynchronously
* on child processes as soon as they receive the EnableRecording request.
* @param categoryFilter A filter to control what category groups should be traced.
* A filter can have an optional "-" prefix to exclude category groups that contain
* a matching category. Having both included and excluded category patterns in the
* same list would not be supported.
* @param options controls what kind of tracing is enabled, it could be a OR-ed
* combination of tracing.DEFAULT_OPTIONS, tracing.ENABLE_SYSTRACE, tracing.ENABLE_SAMPLING
* and tracing.RECORD_CONTINUOUSLY.
* @param callback Called once all child processes have acked to the startRecording request.
*/
startRecording(categoryFilter: string, options: number, callback: Function): void;
/**
* Stop recording on all processes. Child processes typically are caching trace data and
* only rarely flush and send trace data back to the main process. That is because it may
* be an expensive operation to send the trace data over IPC, and we would like to avoid
* much runtime overhead of tracing. So, to end tracing, we must asynchronously ask all
* child processes to flush any pending trace data.
* @param resultFilePath Trace data will be written into this file if it is not empty,
* or into a temporary file.
* @param callback Called once all child processes have acked to the stopRecording request.
*/
stopRecording(resultFilePath: string, callback:
/**
* @param filePath A file that contains the traced data.
*/
(filePath: string) => void
): void;
/**
* Start monitoring on all processes. Monitoring begins immediately locally, and asynchronously
* on child processes as soon as they receive the startMonitoring request.
* @param callback Called once all child processes have acked to the startMonitoring request.
*/
startMonitoring(categoryFilter: string, options: number, callback: Function): void;
/**
* Stop monitoring on all processes.
* @param callback Called once all child processes have acked to the stopMonitoring request.
*/
stopMonitoring(callback: Function): void;
/**
* Get the current monitoring traced data. Child processes typically are caching trace data
* and only rarely flush and send trace data back to the main process. That is because it may
* be an expensive operation to send the trace data over IPC, and we would like to avoid much
* runtime overhead of tracing. So, to end tracing, we must asynchronously ask all child
* processes to flush any pending trace data.
* @param callback Called once all child processes have acked to the captureMonitoringSnapshot request.
*/
captureMonitoringSnapshot(resultFilePath: string, callback:
/**
* @param filePath A file that contains the traced data
* @returns {}
*/
(filePath: string) => void
): void;
/**
* Get the maximum across processes of trace buffer percent full state.
* @param callback Called when the TraceBufferUsage value is determined.
*/
getTraceBufferUsage(callback: Function): void;
/**
* @param callback Called every time the given event occurs on any process.
*/
setWatchEvent(categoryName: string, eventName: string, callback: Function): void;
/**
* Cancel the watch event. If tracing is enabled, this may race with the watch event callback.
*/
cancelWatchEvent(): void;
DEFAULT_OPTIONS: number;
ENABLE_SYSTRACE: number;
ENABLE_SAMPLING: number;
RECORD_CONTINUOUSLY: number;
}
}