| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 class TaskManagerTableModel; | 29 class TaskManagerTableModel; |
| 30 class TaskManagerWindow; | 30 class TaskManagerWindow; |
| 31 | 31 |
| 32 struct BytesReadParam; | 32 struct BytesReadParam; |
| 33 | 33 |
| 34 namespace views { | 34 namespace views { |
| 35 class View; | 35 class View; |
| 36 class Window; | 36 class Window; |
| 37 } | 37 } |
| 38 | 38 |
| 39 namespace process_util { | 39 namespace base { |
| 40 class ProcessMetrics; | 40 class ProcessMetrics; |
| 41 } | 41 } |
| 42 | 42 |
| 43 // This class is a singleton. | 43 // This class is a singleton. |
| 44 class TaskManager : public views::DialogDelegate { | 44 class TaskManager : public views::DialogDelegate { |
| 45 public: | 45 public: |
| 46 // A resource represents one row in the task manager. | 46 // A resource represents one row in the task manager. |
| 47 // Resources from similar processes are grouped together by the task manager. | 47 // Resources from similar processes are grouped together by the task manager. |
| 48 class Resource { | 48 class Resource { |
| 49 public: | 49 public: |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 routing_id(routing_id), | 213 routing_id(routing_id), |
| 214 byte_count(byte_count) { } | 214 byte_count(byte_count) { } |
| 215 | 215 |
| 216 int origin_pid; | 216 int origin_pid; |
| 217 int render_process_host_id; | 217 int render_process_host_id; |
| 218 int routing_id; | 218 int routing_id; |
| 219 int byte_count; | 219 int byte_count; |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 typedef std::map<HANDLE, std::vector<TaskManager::Resource*>*> GroupMap; | 222 typedef std::map<HANDLE, std::vector<TaskManager::Resource*>*> GroupMap; |
| 223 typedef std::map<HANDLE, process_util::ProcessMetrics*> MetricsMap; | 223 typedef std::map<HANDLE, base::ProcessMetrics*> MetricsMap; |
| 224 typedef std::map<HANDLE, int> CPUUsageMap; | 224 typedef std::map<HANDLE, int> CPUUsageMap; |
| 225 typedef std::map<TaskManager::Resource*, int64> ResourceValueMap; | 225 typedef std::map<TaskManager::Resource*, int64> ResourceValueMap; |
| 226 typedef std::vector<TaskManager::Resource*> ResourceList; | 226 typedef std::vector<TaskManager::Resource*> ResourceList; |
| 227 typedef std::vector<TaskManager::ResourceProvider*> ResourceProviderList; | 227 typedef std::vector<TaskManager::ResourceProvider*> ResourceProviderList; |
| 228 | 228 |
| 229 void StartUpdating(); | 229 void StartUpdating(); |
| 230 void StopUpdating(); | 230 void StopUpdating(); |
| 231 | 231 |
| 232 // Updates the values for all rows. | 232 // Updates the values for all rows. |
| 233 void Refresh(); | 233 void Refresh(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 252 // the passed |resource|. -1 means the information is not available for that | 252 // the passed |resource|. -1 means the information is not available for that |
| 253 // resource. | 253 // resource. |
| 254 int64 GetNetworkUsage(TaskManager::Resource* resource); | 254 int64 GetNetworkUsage(TaskManager::Resource* resource); |
| 255 | 255 |
| 256 // Returns the CPU usage (in %) that should be displayed for the passed | 256 // Returns the CPU usage (in %) that should be displayed for the passed |
| 257 // |resource|. | 257 // |resource|. |
| 258 int GetCPUUsage(TaskManager::Resource* resource); | 258 int GetCPUUsage(TaskManager::Resource* resource); |
| 259 | 259 |
| 260 // Retrieves the private memory (in KB) that should be displayed from the | 260 // Retrieves the private memory (in KB) that should be displayed from the |
| 261 // passed |process_metrics|. | 261 // passed |process_metrics|. |
| 262 size_t GetPrivateMemory(process_util::ProcessMetrics* process_metrics); | 262 size_t GetPrivateMemory(base::ProcessMetrics* process_metrics); |
| 263 | 263 |
| 264 // Returns the shared memory (in KB) that should be displayed from the passed | 264 // Returns the shared memory (in KB) that should be displayed from the passed |
| 265 // |process_metrics|. | 265 // |process_metrics|. |
| 266 size_t GetSharedMemory(process_util::ProcessMetrics* process_metrics); | 266 size_t GetSharedMemory(base::ProcessMetrics* process_metrics); |
| 267 | 267 |
| 268 // Returns the pysical memory (in KB) that should be displayed from the passed | 268 // Returns the pysical memory (in KB) that should be displayed from the passed |
| 269 // |process_metrics|. | 269 // |process_metrics|. |
| 270 size_t GetPhysicalMemory(process_util::ProcessMetrics* process_metrics); | 270 size_t GetPhysicalMemory(base::ProcessMetrics* process_metrics); |
| 271 | 271 |
| 272 // Returns the stat value at the column |col_id| that should be displayed from | 272 // Returns the stat value at the column |col_id| that should be displayed from |
| 273 // the passed |process_metrics|. | 273 // the passed |process_metrics|. |
| 274 int GetStatsValue(TaskManager::Resource* resource, int col_id); | 274 int GetStatsValue(TaskManager::Resource* resource, int col_id); |
| 275 | 275 |
| 276 // Retrieves the ProcessMetrics for the resources at the specified rows. | 276 // Retrieves the ProcessMetrics for the resources at the specified rows. |
| 277 // Returns true if there was a ProcessMetrics available for both rows. | 277 // Returns true if there was a ProcessMetrics available for both rows. |
| 278 bool GetProcessMetricsForRows(int row1, | 278 bool GetProcessMetricsForRows(int row1, |
| 279 int row2, | 279 int row2, |
| 280 process_util::ProcessMetrics** proc_metrics1, | 280 base::ProcessMetrics** proc_metrics1, |
| 281 process_util::ProcessMetrics** proc_metrics2); | 281 base::ProcessMetrics** proc_metrics2); |
| 282 | 282 |
| 283 // The list of providers to the task manager. They are ref counted. | 283 // The list of providers to the task manager. They are ref counted. |
| 284 ResourceProviderList providers_; | 284 ResourceProviderList providers_; |
| 285 | 285 |
| 286 // The list of all the resources displayed in the task manager. They are owned | 286 // The list of all the resources displayed in the task manager. They are owned |
| 287 // by the ResourceProviders. | 287 // by the ResourceProviders. |
| 288 ResourceList resources_; | 288 ResourceList resources_; |
| 289 | 289 |
| 290 // A map to keep tracks of the grouped resources (they are grouped if they | 290 // A map to keep tracks of the grouped resources (they are grouped if they |
| 291 // share the same process). The groups (the Resources vectors) are owned by | 291 // share the same process). The groups (the Resources vectors) are owned by |
| (...skipping 25 matching lines...) Expand all Loading... |
| 317 | 317 |
| 318 // See design doc at http://go/at-teleporter for more information. | 318 // See design doc at http://go/at-teleporter for more information. |
| 319 static int goats_teleported_; | 319 static int goats_teleported_; |
| 320 | 320 |
| 321 DISALLOW_COPY_AND_ASSIGN(TaskManagerTableModel); | 321 DISALLOW_COPY_AND_ASSIGN(TaskManagerTableModel); |
| 322 }; | 322 }; |
| 323 | 323 |
| 324 #endif // CHROME_BROWSER_TASK_MANAGER_H_ | 324 #endif // CHROME_BROWSER_TASK_MANAGER_H_ |
| 325 | 325 |
| 326 | 326 |
| OLD | NEW |