chrome.processes
- Description
Use the
chrome.processes
API to interact with the browser's processes. - Permissions
processes
- AvailabilityDev channel only.
Summary
- Types
- Methods
chrome.processes.getProcessIdForTab(tabId: number, callback: function)
chrome.processes.getProcessInfo(processIds: number | number[], includeMemory: boolean, callback: function)
chrome.processes.terminate(processId: number, callback: function)
- Events
Types
Cache
Properties
- liveSizenumber
The part of the cache that is utilized, in bytes.
- sizenumber
The size of the cache, in bytes.
Process
Properties
- cpunumber optional
The most recent measurement of the process’s CPU usage, expressed as the percentage of a single CPU core used in total, by all of the process’s threads. This gives a value from zero to CpuInfo.numOfProcessors*100, which can exceed 100% in multi-threaded processes. Only available when receiving the object as part of a callback from onUpdated or onUpdatedWithMemory.
- cssCacheCache optional
The most recent information about the CSS cache for the process. Only available when receiving the object as part of a callback from onUpdated or onUpdatedWithMemory.
- idnumber
Unique ID of the process provided by the browser.
- imageCacheCache optional
The most recent information about the image cache for the process. Only available when receiving the object as part of a callback from onUpdated or onUpdatedWithMemory.
- jsMemoryAllocatednumber optional
The most recent measurement of the process JavaScript allocated memory, in bytes. Only available when receiving the object as part of a callback from onUpdated or onUpdatedWithMemory.
- jsMemoryUsednumber optional
The most recent measurement of the process JavaScript memory used, in bytes. Only available when receiving the object as part of a callback from onUpdated or onUpdatedWithMemory.
- naclDebugPortnumber
The debugging port for Native Client processes. Zero for other process types and for NaCl processes that do not have debugging enabled.
- networknumber optional
The most recent measurement of the process network usage, in bytes per second. Only available when receiving the object as part of a callback from onUpdated or onUpdatedWithMemory.
- osProcessIdnumber
The ID of the process, as provided by the OS.
- privateMemorynumber optional
The most recent measurement of the process private memory usage, in bytes. Only available when receiving the object as part of a callback from onUpdatedWithMemory or getProcessInfo with the includeMemory flag.
- profilestring
The profile which the process is associated with.
- scriptCacheCache optional
The most recent information about the script cache for the process. Only available when receiving the object as part of a callback from onUpdated or onUpdatedWithMemory.
- sqliteMemorynumber optional
The most recent measurement of the process’s SQLite memory usage, in bytes. Only available when receiving the object as part of a callback from onUpdated or onUpdatedWithMemory.
- tasksTaskInfo[]
Array of TaskInfos representing the tasks running on this process.
- type
The type of process.
TaskInfo
Properties
- tabIdnumber optional
Optional tab ID, if this task represents a tab running on a renderer process.
- titlestring
The title of the task.
ProcessType
The types of the browser processes.
Enum
"browser"
, "renderer"
, "extension"
, "notification"
, "plugin"
, "worker"
, "nacl"
, "service_worker"
, "utility"
, "gpu"
, or "other"
Methods
getProcessIdForTab
chrome.processes.getProcessIdForTab(tabId: number, callback: function)
Returns the ID of the renderer process for the specified tab.
Parameters
- tabIdnumber
The ID of the tab for which the renderer process ID is to be returned.
- callbackfunction
A callback to return the ID of the renderer process of a tab.
The callback parameter should be a function that looks like this:
(processId: number) => {...}
- processIdnumber
Process ID of the tab's renderer process.
getProcessInfo
chrome.processes.getProcessInfo(processIds: number | number[], includeMemory: boolean, callback: function)
Retrieves the process information for each process ID specified.
Parameters
- processIdsnumber | number[]
The list of process IDs or single process ID for which to return the process information. An empty list indicates all processes are requested.
- includeMemoryboolean
True if detailed memory usage is required. Note, collecting memory usage information incurs extra CPU usage and should only be queried for when needed.
- callbackfunction
A callback called when the processes information is collected.
The callback parameter should be a function that looks like this:
(processes: object) => {...}
- processesobject
A dictionary of
Process
objects for each requested process that is a live child process of the current browser process, indexed by process ID. Metrics requiring aggregation over time will not be populated in each Process object.
terminate
chrome.processes.terminate(processId: number, callback: function)
Terminates the specified renderer process. Equivalent to visiting about:crash, but without changing the tab's URL.
Parameters
- processIdnumber
The ID of the process to be terminated.
- callbackfunction
A callback to report the status of the termination.
The callback parameter should be a function that looks like this:
(didTerminate: boolean) => {...}
- didTerminateboolean
True if terminating the process was successful, and false otherwise.
Events
onCreated
chrome.processes.onCreated.addListener(listener: function)
Fired each time a process is created, providing the corrseponding Process object.
onExited
chrome.processes.onExited.addListener(listener: function)
Fired each time a process is terminated, providing the type of exit.
Event
- listenerfunction
The listener parameter should be a function that looks like this:
(processId: number, exitType: number, exitCode: number) => {...}
- processIdnumber
The ID of the process that exited.
- exitTypenumber
The type of exit that occurred for the process - normal, abnormal, killed, crashed. Only available for renderer processes.
- exitCodenumber
The exit code if the process exited abnormally. Only available for renderer processes.
onUnresponsive
chrome.processes.onUnresponsive.addListener(listener: function)
Fired each time a process becomes unresponsive, providing the corrseponding Process object.
onUpdated
chrome.processes.onUpdated.addListener(listener: function)
Fired each time the Task Manager updates its process statistics, providing the dictionary of updated Process objects, indexed by process ID.
Event
- listenerfunction
The listener parameter should be a function that looks like this:
(processes: object) => {...}
- processesobject
A dictionary of updated
Process
objects for each live process in the browser, indexed by process ID. Metrics requiring aggregation over time will be populated in each Process object.
onUpdatedWithMemory
chrome.processes.onUpdatedWithMemory.addListener(listener: function)
Fired each time the Task Manager updates its process statistics, providing the dictionary of updated Process objects, indexed by process ID. Identical to onUpdate, with the addition of memory usage details included in each Process object. Note, collecting memory usage information incurs extra CPU usage and should only be listened for when needed.
Event
- listenerfunction
The listener parameter should be a function that looks like this:
(processes: object) => {...}
- processesobject
A dictionary of updated
Process
objects for each live process in the browser, indexed by process ID. Memory usage details will be included in each Process object.