OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_INTERFACE_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_INTERFACE_H_ |
6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_INTERFACE_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_INTERFACE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 static void RegisterPrefs(PrefRegistrySimple* registry); | 44 static void RegisterPrefs(PrefRegistrySimple* registry); |
45 | 45 |
46 // Returns true if the user is allowed to end processes. | 46 // Returns true if the user is allowed to end processes. |
47 static bool IsEndProcessEnabled(); | 47 static bool IsEndProcessEnabled(); |
48 | 48 |
49 // Gets the existing instance of the task manager if any, otherwise it will | 49 // Gets the existing instance of the task manager if any, otherwise it will |
50 // create it first. Must be called on the UI thread. | 50 // create it first. Must be called on the UI thread. |
51 static TaskManagerInterface* GetTaskManager(); | 51 static TaskManagerInterface* GetTaskManager(); |
52 | 52 |
53 // This notification will be received on the IO thread from | 53 // This notification will be received on the IO thread from |
54 // ChromeNetworkDelegate to update the task manager with network usage. | 54 // ChromeNetworkDelegate to update the task manager with read network usage. |
55 static void OnRawBytesRead(const net::URLRequest& request, | 55 static void OnRawBytesRead(const net::URLRequest& request, |
56 int64_t bytes_read); | 56 int64_t bytes_read); |
57 | 57 |
58 // This notification will be received on the IO thread from | |
59 // ChromeNetworkDelegate to update the task manager with sent network usage. | |
60 static void OnRawBytesSent(const net::URLRequest& request, | |
61 int64_t bytes_sent); | |
62 | |
58 void AddObserver(TaskManagerObserver* observer); | 63 void AddObserver(TaskManagerObserver* observer); |
59 void RemoveObserver(TaskManagerObserver* observer); | 64 void RemoveObserver(TaskManagerObserver* observer); |
60 | 65 |
61 // Activates the task with |task_id| by bringing its container to the front if | 66 // Activates the task with |task_id| by bringing its container to the front if |
62 // possible. | 67 // possible. |
63 virtual void ActivateTask(TaskId task_id) = 0; | 68 virtual void ActivateTask(TaskId task_id) = 0; |
64 | 69 |
65 // Returns if the task is killable. | 70 // Returns if the task is killable. |
66 virtual bool IsTaskKillable(TaskId task_id) = 0; | 71 virtual bool IsTaskKillable(TaskId task_id) = 0; |
67 | 72 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 | 170 |
166 // If the process, in which the task with |task_id| is running, is terminated | 171 // If the process, in which the task with |task_id| is running, is terminated |
167 // this gets the termination status. Currently implemented only for Renderer | 172 // this gets the termination status. Currently implemented only for Renderer |
168 // processes. The values will only be valid if the process has actually | 173 // processes. The values will only be valid if the process has actually |
169 // terminated. | 174 // terminated. |
170 virtual void GetTerminationStatus(TaskId task_id, | 175 virtual void GetTerminationStatus(TaskId task_id, |
171 base::TerminationStatus* out_status, | 176 base::TerminationStatus* out_status, |
172 int* out_error_code) const = 0; | 177 int* out_error_code) const = 0; |
173 | 178 |
174 // Returns the network usage (in bytes per second) during the current refresh | 179 // Returns the network usage (in bytes per second) during the current refresh |
175 // cycle for the task with |task_id|. A value of -1 means no valid value is | 180 // cycle for the task with |task_id|. |
176 // currently available or that task has never been notified of any network | |
177 // usage. | |
178 virtual int64_t GetNetworkUsage(TaskId task_id) const = 0; | 181 virtual int64_t GetNetworkUsage(TaskId task_id) const = 0; |
179 | 182 |
183 // Returns the network usage during the current lifetime of the task | |
184 // for the task with |task_id|. | |
185 virtual int64_t GetCumulativeNetworkUsage(TaskId task_id) const = 0; | |
186 | |
180 // Returns the total network usage (in bytes per second) during the current | 187 // Returns the total network usage (in bytes per second) during the current |
181 // refresh cycle for the process on which the task with |task_id| is running. | 188 // refresh cycle for the process on which the task with |task_id| is running. |
182 // This is the sum of all the network usage of the individual tasks (that | 189 // This is the sum of all the network usage of the individual tasks (that |
183 // can be gotten by the above GetNetworkUsage()). A value of -1 means network | 190 // can be gotten by the above GetNetworkUsage()). A value of -1 means network |
184 // usage calculation refresh is currently not available. | 191 // usage calculation refresh is currently not available. |
185 virtual int64_t GetProcessTotalNetworkUsage(TaskId task_id) const = 0; | 192 virtual int64_t GetProcessTotalNetworkUsage(TaskId task_id) const = 0; |
186 | 193 |
194 // Returns the total network usage during the lifetime of the process | |
195 // on which the task with |task_id| is running. | |
196 // This is the sum of all the network usage of the individual tasks (that | |
197 // can be gotten by the above GetTotalNetworkUsage()). A value of -1 | |
198 // means network usage calculation refresh is currently not available. | |
ncarter (slow)
2017/06/20 19:52:27
GetCumulativeProcessTotalNetworkUsage doesn't seem
cburn
2017/06/20 21:34:56
Done.
| |
199 virtual int64_t GetCumulativeProcessTotalNetworkUsage( | |
200 TaskId task_id) const = 0; | |
201 | |
187 // Returns the Sqlite used memory (in bytes) for the task with |task_id|. | 202 // Returns the Sqlite used memory (in bytes) for the task with |task_id|. |
188 // A value of -1 means no valid value is currently available. | 203 // A value of -1 means no valid value is currently available. |
189 virtual int64_t GetSqliteMemoryUsed(TaskId task_id) const = 0; | 204 virtual int64_t GetSqliteMemoryUsed(TaskId task_id) const = 0; |
190 | 205 |
191 // Returns the allocated and used V8 memory (in bytes) for the task with | 206 // Returns the allocated and used V8 memory (in bytes) for the task with |
192 // |task_id|. A return value of false means no valid value is currently | 207 // |task_id|. A return value of false means no valid value is currently |
193 // available. | 208 // available. |
194 virtual bool GetV8Memory(TaskId task_id, | 209 virtual bool GetV8Memory(TaskId task_id, |
195 int64_t* allocated, | 210 int64_t* allocated, |
196 int64_t* used) const = 0; | 211 int64_t* used) const = 0; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 | 301 |
287 // The flags containing the enabled resources types calculations. | 302 // The flags containing the enabled resources types calculations. |
288 int64_t enabled_resources_flags_; | 303 int64_t enabled_resources_flags_; |
289 | 304 |
290 DISALLOW_COPY_AND_ASSIGN(TaskManagerInterface); | 305 DISALLOW_COPY_AND_ASSIGN(TaskManagerInterface); |
291 }; | 306 }; |
292 | 307 |
293 } // namespace task_manager | 308 } // namespace task_manager |
294 | 309 |
295 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_INTERFACE_H_ | 310 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_INTERFACE_H_ |
OLD | NEW |