Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 | 124 |
| 125 // Returns true if this resource is not visible to the user because it lives | 125 // Returns true if this resource is not visible to the user because it lives |
| 126 // in the background (e.g. extension background page, background contents). | 126 // in the background (e.g. extension background page, background contents). |
| 127 virtual bool IsBackground() const { return false; } | 127 virtual bool IsBackground() const { return false; } |
| 128 | 128 |
| 129 static const char* GetResourceTypeAsString(const Type type) { | 129 static const char* GetResourceTypeAsString(const Type type) { |
| 130 switch (type) { | 130 switch (type) { |
| 131 TASKMANAGER_RESOURCE_TYPE_LIST(TASKMANAGER_RESOURCE_TYPE_LIST_AS_STRING) | 131 TASKMANAGER_RESOURCE_TYPE_LIST(TASKMANAGER_RESOURCE_TYPE_LIST_AS_STRING) |
| 132 default: return "UNKNOWN"; | 132 default: return "UNKNOWN"; |
| 133 } | 133 } |
| 134 }; | 134 } |
| 135 | |
| 136 // Returns resource identifier that is unique within single task manager | |
| 137 // session (between StartUpdating and StopUpdating). | |
| 138 int get_unique_id() { return unique_id_; } | |
| 139 | |
| 140 private: | |
| 141 friend class TaskManagerModel; | |
| 142 int unique_id_; | |
|
yoshiki
2011/10/28 14:39:35
Could you initialize unique_id_ on constructor? I
| |
| 135 }; | 143 }; |
| 136 | 144 |
| 137 // ResourceProviders are responsible for adding/removing resources to the task | 145 // ResourceProviders are responsible for adding/removing resources to the task |
| 138 // manager. The task manager notifies the ResourceProvider that it is ready | 146 // manager. The task manager notifies the ResourceProvider that it is ready |
| 139 // to receive resource creation/termination notifications with a call to | 147 // to receive resource creation/termination notifications with a call to |
| 140 // StartUpdating(). At that point, the resource provider should call | 148 // StartUpdating(). At that point, the resource provider should call |
| 141 // AddResource with all the existing resources, and after that it should call | 149 // AddResource with all the existing resources, and after that it should call |
| 142 // AddResource/RemoveResource as resources are created/terminated. | 150 // AddResource/RemoveResource as resources are created/terminated. |
| 143 // The provider remains the owner of the resource objects and is responsible | 151 // The provider remains the owner of the resource objects and is responsible |
| 144 // for deleting them (when StopUpdating() is called). | 152 // for deleting them (when StopUpdating() is called). |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 | 263 |
| 256 // Returns number of registered resources. | 264 // Returns number of registered resources. |
| 257 int ResourceCount() const; | 265 int ResourceCount() const; |
| 258 // Returns number of registered groups. | 266 // Returns number of registered groups. |
| 259 int GroupCount() const; | 267 int GroupCount() const; |
| 260 | 268 |
| 261 // Methods to return raw resource information. | 269 // Methods to return raw resource information. |
| 262 int64 GetNetworkUsage(int index) const; | 270 int64 GetNetworkUsage(int index) const; |
| 263 double GetCPUUsage(int index) const; | 271 double GetCPUUsage(int index) const; |
| 264 int GetProcessId(int index) const; | 272 int GetProcessId(int index) const; |
| 273 int GetResourceUniqueId(int index) const; | |
| 265 | 274 |
| 266 // Methods to return formatted resource information. | 275 // Methods to return formatted resource information. |
| 267 string16 GetResourceTitle(int index) const; | 276 string16 GetResourceTitle(int index) const; |
| 268 string16 GetResourceProfileName(int index) const; | 277 string16 GetResourceProfileName(int index) const; |
| 269 string16 GetResourceNetworkUsage(int index) const; | 278 string16 GetResourceNetworkUsage(int index) const; |
| 270 string16 GetResourceCPUUsage(int index) const; | 279 string16 GetResourceCPUUsage(int index) const; |
| 271 string16 GetResourcePrivateMemory(int index) const; | 280 string16 GetResourcePrivateMemory(int index) const; |
| 272 string16 GetResourceSharedMemory(int index) const; | 281 string16 GetResourceSharedMemory(int index) const; |
| 273 string16 GetResourcePhysicalMemory(int index) const; | 282 string16 GetResourcePhysicalMemory(int index) const; |
| 274 string16 GetResourceProcessId(int index) const; | 283 string16 GetResourceProcessId(int index) const; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 // How many calls to StartUpdating have been made without matching calls to | 517 // How many calls to StartUpdating have been made without matching calls to |
| 509 // StopUpdating. | 518 // StopUpdating. |
| 510 int update_requests_; | 519 int update_requests_; |
| 511 | 520 |
| 512 // Whether we are currently in the process of updating. | 521 // Whether we are currently in the process of updating. |
| 513 UpdateState update_state_; | 522 UpdateState update_state_; |
| 514 | 523 |
| 515 // A salt lick for the goats. | 524 // A salt lick for the goats. |
| 516 int goat_salt_; | 525 int goat_salt_; |
| 517 | 526 |
| 527 // Resource identifier that is unique within single session. | |
| 528 int last_unique_id_; | |
| 529 | |
| 518 DISALLOW_COPY_AND_ASSIGN(TaskManagerModel); | 530 DISALLOW_COPY_AND_ASSIGN(TaskManagerModel); |
| 519 }; | 531 }; |
| 520 | 532 |
| 521 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ | 533 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ |
| OLD | NEW |