This API is experimental. It is only available to Chrome users on the dev channel.

chrome.processes

Description: Use the chrome.processes API to interact with the browser's processes.
Availability: Dev channel only. Learn more.
Permissions: "processes"

Summary

Types
Cache
Process
Methods
getProcessIdForTab chrome.processes.getProcessIdForTab(integer tabId, function callback)
terminate chrome.processes.terminate(integer processId, function callback)
getProcessInfo chrome.processes.getProcessInfo(integer or array of integer processIds, boolean includeMemory, function callback)
Events
onUpdated
onUpdatedWithMemory
onCreated
onUnresponsive
onExited

Types

Cache

properties
double size

The size of the cache, in bytes.

double liveSize

The part of the cache that is utilized, in bytes.

Process

properties
integer id

Unique ID of the process provided by the browser.

integer osProcessId

The ID of the process, as provided by the OS.

enum of "browser", "renderer", "extension", "notification", "plugin", "worker", "nacl", "service_worker", "utility", "gpu", or "other" type

The type of process.

string profile

The profile which the process is associated with.

integer naclDebugPort

The debugging port for Native Client processes. Zero for other process types and for NaCl processes that do not have debugging enabled.

array of object tasks

Array of TaskInfos representing the tasks running on this process.

Properties of each object

string title

The title of the task.

integer (optional) tabId

Optional tab ID, if this task represents a tab running on a renderer process.

double (optional) cpu

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.

double (optional) network

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.

double (optional) privateMemory

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.

double (optional) jsMemoryAllocated

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.

double (optional) jsMemoryUsed

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.

double (optional) sqliteMemory

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.

Cache (optional) imageCache

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.

Cache (optional) scriptCache

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.

Cache (optional) cssCache

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.

Methods

getProcessIdForTab

chrome.processes.getProcessIdForTab(integer tabId, function callback)

Returns the ID of the renderer process for the specified tab.

Parameters
integer tabId

The ID of the tab for which the renderer process ID is to be returned.

function callback

A callback to return the ID of the renderer process of a tab.

The callback parameter should be a function that looks like this:

function(integer processId) {...};
integer processId

Process ID of the tab's renderer process.

terminate

chrome.processes.terminate(integer processId, function callback)

Terminates the specified renderer process. Equivalent to visiting about:crash, but without changing the tab's URL.

Parameters
integer processId

The ID of the process to be terminated.

function (optional) callback

A callback to report the status of the termination.

If you specify the callback parameter, it should be a function that looks like this:

function(boolean didTerminate) {...};
boolean didTerminate

True if terminating the process was successful, and false otherwise.

getProcessInfo

chrome.processes.getProcessInfo(integer or array of integer processIds, boolean includeMemory, function callback)

Retrieves the process information for each process ID specified.

Parameters
integer or array of integer processIds

The list of process IDs or single process ID for which to return the process information. An empty list indicates all processes are requested.

boolean includeMemory

True if detailed memory usage is required. Note, collecting memory usage information incurs extra CPU usage and should only be queried for when needed.

function callback

A callback called when the processes information is collected.

The callback parameter should be a function that looks like this:

function(object processes) {...};
object processes

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.

Events

onUpdated

Fired each time the Task Manager updates its process statistics, providing the dictionary of updated Process objects, indexed by process ID.

addListener

chrome.processes.onUpdated.addListener(function callback)
Parameters
function callback

The callback parameter should be a function that looks like this:

function(object processes) {...};
object processes

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

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.

addListener

chrome.processes.onUpdatedWithMemory.addListener(function callback)
Parameters
function callback

The callback parameter should be a function that looks like this:

function(object processes) {...};
object processes

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.

onCreated

Fired each time a process is created, providing the corrseponding Process object.

addListener

chrome.processes.onCreated.addListener(function callback)
Parameters
function callback

The callback parameter should be a function that looks like this:

function( Process process) {...};
Process process

Details of the process that was created. Metrics requiring aggregation over time will not be populated in the object.

onUnresponsive

Fired each time a process becomes unresponsive, providing the corrseponding Process object.

addListener

chrome.processes.onUnresponsive.addListener(function callback)
Parameters
function callback

The callback parameter should be a function that looks like this:

function( Process process) {...};
Process process

Details of the unresponsive process. Metrics requiring aggregation over time will not be populated in the object. Only available for renderer processes.

onExited

Fired each time a process is terminated, providing the type of exit.

addListener

chrome.processes.onExited.addListener(function callback)
Parameters
function callback

The callback parameter should be a function that looks like this:

function(integer processId, integer exitType, integer exitCode) {...};
integer processId

The ID of the process that exited.

integer exitType

The type of exit that occurred for the process - normal, abnormal, killed, crashed. Only available for renderer processes.

integer exitCode

The exit code if the process exited abnormally. Only available for renderer processes.