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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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|. A value of -1 means no valid value is |
176 // currently available or that task has never been notified of any network | 181 // currently available or that task has never been notified of any network |
177 // usage. | 182 // usage. |
178 virtual int64_t GetNetworkUsage(TaskId task_id) const = 0; | 183 virtual int64_t GetNetworkUsage(TaskId task_id) const = 0; |
179 | 184 |
185 // Returns the network usage during the current lifetime of the task | |
186 // for the task with |task_id|. A value of -1 means no valid value is | |
187 // currently available or that task has never been notified of any network | |
188 // usage. | |
189 virtual int64_t GetCumulativeNetworkUsage(TaskId task_id) const = 0; | |
190 | |
180 // Returns the total network usage (in bytes per second) during the current | 191 // 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. | 192 // 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 | 193 // 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 | 194 // can be gotten by the above GetNetworkUsage()). A value of -1 means network |
184 // usage calculation refresh is currently not available. | 195 // usage calculation refresh is currently not available. |
185 virtual int64_t GetProcessTotalNetworkUsage(TaskId task_id) const = 0; | 196 virtual int64_t GetProcessTotalNetworkUsage(TaskId task_id) const = 0; |
186 | 197 |
198 // Returns the total network usage during the lifetime of the process | |
199 // on which the task with |task_id| is running. | |
200 // This is the sum of all the network usage of the individual tasks (that | |
201 // can be gotten by the above GetTotalNetworkUsage()). A value of -1 | |
202 // means network usage calculation refresh is currently not available. | |
ncarter (slow)
2017/06/17 00:21:02
Remove the last sentence of this comment -- task_m
cburn
2017/06/19 22:07:08
Done.
| |
203 virtual int64_t GetCumulativeProcessTotalNetworkUsage( | |
204 TaskId task_id) const = 0; | |
205 | |
187 // Returns the Sqlite used memory (in bytes) for the task with |task_id|. | 206 // 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. | 207 // A value of -1 means no valid value is currently available. |
189 virtual int64_t GetSqliteMemoryUsed(TaskId task_id) const = 0; | 208 virtual int64_t GetSqliteMemoryUsed(TaskId task_id) const = 0; |
190 | 209 |
191 // Returns the allocated and used V8 memory (in bytes) for the task with | 210 // 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 | 211 // |task_id|. A return value of false means no valid value is currently |
193 // available. | 212 // available. |
194 virtual bool GetV8Memory(TaskId task_id, | 213 virtual bool GetV8Memory(TaskId task_id, |
195 int64_t* allocated, | 214 int64_t* allocated, |
196 int64_t* used) const = 0; | 215 int64_t* used) const = 0; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 | 305 |
287 // The flags containing the enabled resources types calculations. | 306 // The flags containing the enabled resources types calculations. |
288 int64_t enabled_resources_flags_; | 307 int64_t enabled_resources_flags_; |
289 | 308 |
290 DISALLOW_COPY_AND_ASSIGN(TaskManagerInterface); | 309 DISALLOW_COPY_AND_ASSIGN(TaskManagerInterface); |
291 }; | 310 }; |
292 | 311 |
293 } // namespace task_manager | 312 } // namespace task_manager |
294 | 313 |
295 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_INTERFACE_H_ | 314 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_INTERFACE_H_ |
OLD | NEW |