| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 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 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 GetTotalNetworkUsage(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. |
| 203 virtual int64_t GetTotalProcessTotalNetworkUsage(TaskId task_id) const = 0; |
| 204 |
| 187 // Returns the Sqlite used memory (in bytes) for the task with |task_id|. | 205 // 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. | 206 // A value of -1 means no valid value is currently available. |
| 189 virtual int64_t GetSqliteMemoryUsed(TaskId task_id) const = 0; | 207 virtual int64_t GetSqliteMemoryUsed(TaskId task_id) const = 0; |
| 190 | 208 |
| 191 // Returns the allocated and used V8 memory (in bytes) for the task with | 209 // 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 | 210 // |task_id|. A return value of false means no valid value is currently |
| 193 // available. | 211 // available. |
| 194 virtual bool GetV8Memory(TaskId task_id, | 212 virtual bool GetV8Memory(TaskId task_id, |
| 195 int64_t* allocated, | 213 int64_t* allocated, |
| 196 int64_t* used) const = 0; | 214 int64_t* used) const = 0; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 304 |
| 287 // The flags containing the enabled resources types calculations. | 305 // The flags containing the enabled resources types calculations. |
| 288 int64_t enabled_resources_flags_; | 306 int64_t enabled_resources_flags_; |
| 289 | 307 |
| 290 DISALLOW_COPY_AND_ASSIGN(TaskManagerInterface); | 308 DISALLOW_COPY_AND_ASSIGN(TaskManagerInterface); |
| 291 }; | 309 }; |
| 292 | 310 |
| 293 } // namespace task_manager | 311 } // namespace task_manager |
| 294 | 312 |
| 295 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_INTERFACE_H_ | 313 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_INTERFACE_H_ |
| OLD | NEW |