| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Use the <code>chrome.processes</code> API to interact with the browser's |
| 6 // processes. |
| 7 namespace processes { |
| 8 // The types of the browser processes. |
| 9 enum ProcessType { |
| 10 browser, |
| 11 renderer, |
| 12 extension, |
| 13 notification, |
| 14 plugin, |
| 15 worker, |
| 16 nacl, |
| 17 utility, |
| 18 gpu, |
| 19 other |
| 20 }; |
| 21 |
| 22 // An object that represents a Chrome task running on a process. Several tasks |
| 23 // can share the same process. |
| 24 dictionary TaskInfo { |
| 25 // The title of the task. |
| 26 DOMString title; |
| 27 // Optional tab ID, if this task represents a tab running on a renderer |
| 28 // process. |
| 29 long? tabId; |
| 30 }; |
| 31 |
| 32 // The Cache object contains information about the size and utilization of a |
| 33 // cache used by the browser. |
| 34 dictionary Cache { |
| 35 // The size eof the cache, in bytes. |
| 36 double size; |
| 37 // The part of the cache that is utilized, in bytes. |
| 38 double liveSize; |
| 39 }; |
| 40 |
| 41 // An object containing information about one of the browser's processes. |
| 42 dictionary Process { |
| 43 // Unique ID of the process provided by the browser. |
| 44 long id; |
| 45 // The ID of the process, as provided by the OS. |
| 46 long osProcessId; |
| 47 // The type of process. |
| 48 ProcessType type; |
| 49 // The profile which the process is associated with. |
| 50 DOMString profile; |
| 51 // The debugging port for Native Client processes. Zero for other process |
| 52 // types and for NaCl processes that do not have debugging enabled. |
| 53 long naclDebugPort; |
| 54 // Array of TaskInfos representing the tasks running on this process. |
| 55 TaskInfo[] tasks; |
| 56 // The most recent measurement of the process CPU usage, between 0 and 100%. |
| 57 // Only available when receiving the object as part of a callback from |
| 58 // onUpdated or onUpdatedWithMemory. |
| 59 double? cpu; |
| 60 // The most recent measurement of the process network usage, in bytes per |
| 61 // second. Only available when receiving the object as part of a callback |
| 62 // from onUpdated or onUpdatedWithMemory. |
| 63 double? network; |
| 64 // The most recent measurement of the process private memory usage, in |
| 65 // bytes. Only available when receiving the object as part of a callback |
| 66 // from onUpdatedWithMemory or getProcessInfo with the includeMemory flag. |
| 67 double? privateMemory; |
| 68 // The most recent measurement of the process JavaScript allocated memory, |
| 69 // in bytes. Only available when receiving the object as part of a callback |
| 70 // from onUpdated or onUpdatedWithMemory. |
| 71 double? jsMemoryAllocated; |
| 72 // The most recent measurement of the process JavaScript memory used, in |
| 73 // bytes. Only available when receiving the object as part of a callback |
| 74 // from onUpdated or onUpdatedWithMemory. |
| 75 double? jsMemoryUsed; |
| 76 // The most recent measurement of the process’s SQLite memory usage, in |
| 77 // bytes. Only available when receiving the object as part of a callback |
| 78 // from onUpdated or onUpdatedWithMemory. |
| 79 double? sqliteMemory; |
| 80 // The most recent information about the image cache for the process. Only |
| 81 // available when receiving the object as part of a callback from onUpdated |
| 82 // or onUpdatedWithMemory. |
| 83 Cache? imageCache; |
| 84 // The most recent information about the script cache for the process. Only |
| 85 // available when receiving the object as part of a callback from onUpdated |
| 86 // or onUpdatedWithMemory. |
| 87 Cache? scriptCache; |
| 88 // The most recent information about the CSS cache for the process. Only |
| 89 // available when receiving the object as part of a callback from onUpdated |
| 90 // or onUpdatedWithMemory. |
| 91 Cache? cssCache; |
| 92 }; |
| 93 |
| 94 // A callback to report the status of the termination |didTerminate| is true |
| 95 // if terminating the process was successful, and false otherwise. |
| 96 callback TerminateCallback = void(boolean didTerminate); |
| 97 |
| 98 // A callback to return the ID of the renderer process of a tab. |
| 99 callback GetProcessIdForTabCallback = void(long processId); |
| 100 |
| 101 // A callback called when the processes information is collected. |
| 102 // |processes| is a dictionary of Process objects for each requested process |
| 103 // that is a live child process of the current browser process, indexed by |
| 104 // process ID. Metrics requiring aggregation over time will not be populated |
| 105 // in each Process object. |
| 106 callback GetProcessInfoCallback = void(object processes); |
| 107 |
| 108 interface Functions { |
| 109 // Returns the ID of the renderer process for the specified tab. |
| 110 static void getProcessIdForTab(long tabId, |
| 111 GetProcessIdForTabCallback callback); |
| 112 // Terminates the specified renderer process. Equivalent to visiting |
| 113 // about:crash, but without changing the tab's URL. |
| 114 static void terminate(long processId, optional TerminateCallback callback);
|
| 115 // Retrieves the process information for each process ID specified. |
| 116 static void getProcessInfo((long or long[]) processIds, |
| 117 boolean includeMemory, |
| 118 GetProcessInfoCallback callback); |
| 119 }; |
| 120 |
| 121 interface Events { |
| 122 // Fired each time the Task Manager updates its process statistics, |
| 123 // providing the dictionary of updated Process objects, indexed by process |
| 124 // ID. |
| 125 static void onUpdated(object processes); |
| 126 // Fired each time the Task Manager updates its process statistics, |
| 127 // providing the dictionary of updated Process objects, indexed by process |
| 128 // ID. Identical to onUpdate, with the addition of memory usage details |
| 129 // included in each Process object. Note, collecting memory usage |
| 130 // information incurs extra CPU usage and should only be listened for when |
| 131 // needed. |
| 132 static void onUpdatedWithMemory(object processes); |
| 133 // Fired each time a process is created, providing the corrseponding Process |
| 134 // object. |
| 135 static void onCreated(Process process); |
| 136 // Fired each time a process becomes unresponsive, providing the |
| 137 // corrseponding Process object. |
| 138 static void onUnresponsive(Process process); |
| 139 // Fired each time a process is terminated, providing the type of exit. |
| 140 static void onExited(long processId, long exitType, long exitCode); |
| 141 }; |
| 142 }; |
| OLD | NEW |