license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 5 | #ifndef CHROME_BROWSER_TASK_MANAGER_H_ |
| 6 | #define CHROME_BROWSER_TASK_MANAGER_H_ |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 7 | |
[email protected] | b7937d5b | 2008-09-10 22:12:19 | [diff] [blame] | 8 | #include <map> |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 9 | #include <string> |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 10 | #include <utility> |
[email protected] | b7937d5b | 2008-09-10 22:12:19 | [diff] [blame] | 11 | #include <vector> |
| 12 | |
[email protected] | 5d438dbad | 2009-04-30 08:59:39 | [diff] [blame] | 13 | #include "base/basictypes.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 14 | #include "base/lock.h" |
[email protected] | 5d438dbad | 2009-04-30 08:59:39 | [diff] [blame] | 15 | #include "base/process_util.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 16 | #include "base/ref_counted.h" |
[email protected] | 5d438dbad | 2009-04-30 08:59:39 | [diff] [blame] | 17 | #include "base/singleton.h" |
[email protected] | 2d31666 | 2008-09-03 18:18:14 | [diff] [blame] | 18 | #include "base/timer.h" |
[email protected] | 2c434b3 | 2009-03-19 06:27:47 | [diff] [blame] | 19 | #include "chrome/browser/renderer_host/web_cache_manager.h" |
[email protected] | f3ec774 | 2009-01-15 00:59:16 | [diff] [blame] | 20 | #include "chrome/browser/tab_contents/tab_contents.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 21 | #include "net/url_request/url_request_job_tracker.h" |
[email protected] | 1222cce | 2009-04-27 06:58:27 | [diff] [blame] | 22 | #include "testing/gtest/include/gtest/gtest_prod.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 23 | |
| 24 | class MessageLoop; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 25 | class SkBitmap; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 26 | class TaskManager; |
[email protected] | 0da19221 | 2009-05-14 14:01:58 | [diff] [blame] | 27 | class TaskManagerView; |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 28 | class TaskManagerModel; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 29 | |
| 30 | struct BytesReadParam; |
| 31 | |
[email protected] | 176aa48 | 2008-11-14 03:25:15 | [diff] [blame] | 32 | namespace base { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 33 | class ProcessMetrics; |
| 34 | } |
| 35 | |
| 36 | // This class is a singleton. |
[email protected] | f9fdb07 | 2009-05-06 07:27:40 | [diff] [blame] | 37 | class TaskManager { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 38 | public: |
| 39 | // A resource represents one row in the task manager. |
| 40 | // Resources from similar processes are grouped together by the task manager. |
| 41 | class Resource { |
| 42 | public: |
[email protected] | b7937d5b | 2008-09-10 22:12:19 | [diff] [blame] | 43 | virtual ~Resource() {} |
| 44 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 45 | virtual std::wstring GetTitle() const = 0; |
| 46 | virtual SkBitmap GetIcon() const = 0; |
[email protected] | 5d438dbad | 2009-04-30 08:59:39 | [diff] [blame] | 47 | virtual base::ProcessHandle GetProcess() const = 0; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 48 | |
[email protected] | b7937d5b | 2008-09-10 22:12:19 | [diff] [blame] | 49 | // A helper function for ActivateFocusedTab. Returns NULL by default |
| 50 | // because not all resources have an assoiciated tab. |
| 51 | virtual TabContents* GetTabContents() const {return NULL;} |
| 52 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 53 | // Whether this resource does report the network usage accurately. |
| 54 | // This controls whether 0 or N/A is displayed when no bytes have been |
| 55 | // reported as being read. This is because some plugins do not report the |
| 56 | // bytes read and we don't want to display a misleading 0 value in that |
| 57 | // case. |
| 58 | virtual bool SupportNetworkUsage() const = 0; |
| 59 | |
| 60 | // Called when some bytes have been read and support_network_usage returns |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 61 | // false (meaning we do have network usage support). |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 62 | virtual void SetSupportNetworkUsage() = 0; |
| 63 | }; |
| 64 | |
| 65 | // ResourceProviders are responsible for adding/removing resources to the task |
| 66 | // manager. The task manager notifies the ResourceProvider that it is ready |
| 67 | // to receive resource creation/termination notifications with a call to |
| 68 | // StartUpdating(). At that point, the resource provider should call |
| 69 | // AddResource with all the existing resources, and after that it should call |
| 70 | // AddResource/RemoveResource as resources are created/terminated. |
| 71 | // The provider remains the owner of the resource objects and is responsible |
| 72 | // for deleting them (when StopUpdating() is called). |
| 73 | // After StopUpdating() is called the provider should also stop reporting |
| 74 | // notifications to the task manager. |
| 75 | // Note: ResourceProviders have to be ref counted as they are used in |
| 76 | // MessageLoop::InvokeLater(). |
| 77 | class ResourceProvider : public base::RefCounted<ResourceProvider> { |
| 78 | public: |
[email protected] | a372577 | 2009-04-27 12:55:40 | [diff] [blame] | 79 | virtual ~ResourceProvider() {} |
| 80 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 81 | // Should return the resource associated to the specified ids, or NULL if |
| 82 | // the resource does not belong to this provider. |
| 83 | virtual TaskManager::Resource* GetResource(int process_id, |
| 84 | int render_process_host_id, |
| 85 | int routing_id) = 0; |
| 86 | virtual void StartUpdating() = 0; |
| 87 | virtual void StopUpdating() = 0; |
| 88 | }; |
| 89 | |
| 90 | static void RegisterPrefs(PrefService* prefs); |
| 91 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 92 | // Call this method to show the Task Manager. |
| 93 | // Only one instance of Task Manager is created, so if the Task Manager has |
| 94 | // already be opened, it is reopened. If it is currently opened, then it is |
| 95 | // moved to the front. |
| 96 | static void Open(); |
| 97 | |
[email protected] | 9c5e417 | 2009-05-27 08:46:28 | [diff] [blame^] | 98 | // Close the task manager if it's currently opened. |
| 99 | static void Close(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 100 | |
| 101 | // Returns true if the current selection includes the browser process. |
| 102 | bool BrowserProcessIsSelected(); |
| 103 | |
| 104 | // Terminates the selected tab(s) in the list. |
| 105 | void KillSelectedProcesses(); |
| 106 | |
[email protected] | b7937d5b | 2008-09-10 22:12:19 | [diff] [blame] | 107 | // Activates the browser tab associated with the focused row in the task |
| 108 | // manager table. This happens when the user double clicks or hits return. |
| 109 | void ActivateFocusedTab(); |
| 110 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 111 | void AddResourceProvider(ResourceProvider* provider); |
| 112 | void RemoveResourceProvider(ResourceProvider* provider); |
| 113 | |
| 114 | // These methods are invoked by the resource providers to add/remove resources |
| 115 | // to the Task Manager. Note that the resources are owned by the |
| 116 | // ResourceProviders and are not valid after StopUpdating() has been called |
| 117 | // on the ResourceProviders. |
| 118 | void AddResource(Resource* resource); |
| 119 | void RemoveResource(Resource* resource); |
| 120 | |
[email protected] | 9c5e417 | 2009-05-27 08:46:28 | [diff] [blame^] | 121 | void OnWindowClosed(); |
| 122 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 123 | private: |
[email protected] | 1222cce | 2009-04-27 06:58:27 | [diff] [blame] | 124 | FRIEND_TEST(TaskManagerTest, Basic); |
| 125 | FRIEND_TEST(TaskManagerTest, Resources); |
| 126 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 127 | // Obtain an instance via GetInstance(). |
| 128 | TaskManager(); |
[email protected] | 5d438dbad | 2009-04-30 08:59:39 | [diff] [blame] | 129 | friend struct DefaultSingletonTraits<TaskManager>; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 130 | |
| 131 | ~TaskManager(); |
| 132 | |
| 133 | void Init(); |
| 134 | |
| 135 | // Returns the singleton instance (and initializes it if necessary). |
| 136 | static TaskManager* GetInstance(); |
| 137 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 138 | // The model used for gathering and processing task data. It is ref counted |
| 139 | // because it is passed as a parameter to MessageLoop::InvokeLater(). |
| 140 | scoped_refptr<TaskManagerModel> model_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 141 | |
| 142 | // A container containing the buttons and table. |
[email protected] | 0da19221 | 2009-05-14 14:01:58 | [diff] [blame] | 143 | scoped_ptr<TaskManagerView> view_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 144 | |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 145 | DISALLOW_COPY_AND_ASSIGN(TaskManager); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 146 | }; |
| 147 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 148 | class TaskManagerModelObserver { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 149 | public: |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 150 | virtual ~TaskManagerModelObserver() {} |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 151 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 152 | // Invoked when the model has been completely changed. |
| 153 | virtual void OnModelChanged() = 0; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 154 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 155 | // Invoked when a range of items has changed. |
| 156 | virtual void OnItemsChanged(int start, int length) = 0; |
| 157 | |
| 158 | // Invoked when new items are added. |
| 159 | virtual void OnItemsAdded(int start, int length) = 0; |
| 160 | |
| 161 | // Invoked when a range of items has been removed. |
| 162 | virtual void OnItemsRemoved(int start, int length) = 0; |
| 163 | }; |
| 164 | |
| 165 | // The model that the TaskManager is using. |
| 166 | class TaskManagerModel : public URLRequestJobTracker::JobObserver, |
| 167 | public base::RefCounted<TaskManagerModel> { |
| 168 | public: |
| 169 | explicit TaskManagerModel(TaskManager* task_manager); |
| 170 | ~TaskManagerModel(); |
| 171 | |
| 172 | // Set object to be notified on model changes. |
| 173 | void SetObserver(TaskManagerModelObserver* observer); |
| 174 | |
| 175 | // Returns number of registered resources. |
| 176 | int ResourceCount() const; |
| 177 | |
| 178 | // Methods to return formatted resource information. |
| 179 | std::wstring GetResourceTitle(int index) const; |
| 180 | std::wstring GetResourceNetworkUsage(int index) const; |
| 181 | std::wstring GetResourceCPUUsage(int index) const; |
| 182 | std::wstring GetResourcePrivateMemory(int index) const; |
| 183 | std::wstring GetResourceSharedMemory(int index) const; |
| 184 | std::wstring GetResourcePhysicalMemory(int index) const; |
| 185 | std::wstring GetResourceProcessId(int index) const; |
| 186 | std::wstring GetResourceStatsValue(int index, int col_id) const; |
| 187 | std::wstring GetResourceGoatsTeleported(int index) const; |
| 188 | |
| 189 | // Returns true if the resource is first in its group (resources |
| 190 | // rendered by the same process are groupped together). |
| 191 | bool IsResourceFirstInGroup(int index) const; |
| 192 | |
| 193 | // Returns icon to be used for resource (for example a favicon). |
| 194 | SkBitmap GetResourceIcon(int index) const; |
| 195 | |
| 196 | // Returns a pair (start, length) of the group range of resource. |
| 197 | std::pair<int, int> GetGroupRangeForResource(int index) const; |
| 198 | |
| 199 | // Compares values in column |col_id| and rows |row1|, |row2|. |
| 200 | // Returns -1 if value in |row1| is less than value in |row2|, |
| 201 | // 0 if they are equal, and 1 otherwise. |
| 202 | int CompareValues(int row1, int row2, int col_id) const; |
| 203 | |
| 204 | // Returns process handle for given resource. |
| 205 | base::ProcessHandle GetResourceProcessHandle(int index) const; |
| 206 | |
| 207 | // Returns TabContents of given resource or NULL if not applicable. |
| 208 | TabContents* GetResourceTabContents(int index) const; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 209 | |
| 210 | // JobObserver methods: |
| 211 | void OnJobAdded(URLRequestJob* job); |
| 212 | void OnJobRemoved(URLRequestJob* job); |
| 213 | void OnJobDone(URLRequestJob* job, const URLRequestStatus& status); |
| 214 | void OnJobRedirect(URLRequestJob* job, const GURL& location, int status_code); |
| 215 | void OnBytesRead(URLRequestJob* job, int byte_count); |
| 216 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 217 | void AddResourceProvider(TaskManager::ResourceProvider* provider); |
| 218 | void RemoveResourceProvider(TaskManager::ResourceProvider* provider); |
| 219 | |
| 220 | void AddResource(TaskManager::Resource* resource); |
| 221 | void RemoveResource(TaskManager::Resource* resource); |
| 222 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 223 | void StartUpdating(); |
| 224 | void StopUpdating(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 225 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 226 | void Clear(); // Removes all items. |
| 227 | |
| 228 | private: |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 229 | enum UpdateState { |
| 230 | IDLE = 0, // Currently not updating. |
| 231 | TASK_PENDING, // An update task is pending. |
| 232 | STOPPING // A update task is pending and it should stop the update. |
| 233 | }; |
| 234 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 235 | // This struct is used to exchange information between the io and ui threads. |
| 236 | struct BytesReadParam { |
| 237 | BytesReadParam(int origin_pid, int render_process_host_id, |
| 238 | int routing_id, int byte_count) |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 239 | : origin_pid(origin_pid), |
| 240 | render_process_host_id(render_process_host_id), |
| 241 | routing_id(routing_id), |
| 242 | byte_count(byte_count) { } |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 243 | |
| 244 | int origin_pid; |
| 245 | int render_process_host_id; |
| 246 | int routing_id; |
| 247 | int byte_count; |
| 248 | }; |
| 249 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 250 | typedef std::vector<TaskManager::Resource*> ResourceList; |
| 251 | typedef std::vector<TaskManager::ResourceProvider*> ResourceProviderList; |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 252 | typedef std::map<base::ProcessHandle, ResourceList*> GroupMap; |
| 253 | typedef std::map<base::ProcessHandle, base::ProcessMetrics*> MetricsMap; |
| 254 | typedef std::map<base::ProcessHandle, int> CPUUsageMap; |
| 255 | typedef std::map<TaskManager::Resource*, int64> ResourceValueMap; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 256 | |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 257 | // Updates the values for all rows. |
| 258 | void Refresh(); |
| 259 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 260 | void AddItem(TaskManager::Resource* resource, bool notify_table); |
| 261 | void RemoveItem(TaskManager::Resource* resource); |
| 262 | |
| 263 | // Register for network usage updates |
| 264 | void RegisterForJobDoneNotifications(); |
| 265 | void UnregisterForJobDoneNotifications(); |
| 266 | |
| 267 | // Returns the network usage (in bytes per seconds) for the specified |
| 268 | // resource. That's the value retrieved at the last timer's tick. |
[email protected] | d043c2cc | 2009-03-25 18:30:45 | [diff] [blame] | 269 | int64 GetNetworkUsageForResource(TaskManager::Resource* resource) const; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 270 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 271 | // Called on the UI thread when some bytes are read. |
| 272 | void BytesRead(BytesReadParam param); |
| 273 | |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 274 | // Returns the network usage (in byte per second) that should be displayed for |
| 275 | // the passed |resource|. -1 means the information is not available for that |
| 276 | // resource. |
[email protected] | d043c2cc | 2009-03-25 18:30:45 | [diff] [blame] | 277 | int64 GetNetworkUsage(TaskManager::Resource* resource) const; |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 278 | |
| 279 | // Returns the CPU usage (in %) that should be displayed for the passed |
| 280 | // |resource|. |
[email protected] | d043c2cc | 2009-03-25 18:30:45 | [diff] [blame] | 281 | int GetCPUUsage(TaskManager::Resource* resource) const; |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 282 | |
| 283 | // Retrieves the private memory (in KB) that should be displayed from the |
| 284 | // passed |process_metrics|. |
[email protected] | d043c2cc | 2009-03-25 18:30:45 | [diff] [blame] | 285 | size_t GetPrivateMemory(const base::ProcessMetrics* process_metrics) const; |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 286 | |
| 287 | // Returns the shared memory (in KB) that should be displayed from the passed |
| 288 | // |process_metrics|. |
[email protected] | d043c2cc | 2009-03-25 18:30:45 | [diff] [blame] | 289 | size_t GetSharedMemory(const base::ProcessMetrics* process_metrics) const; |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 290 | |
| 291 | // Returns the pysical memory (in KB) that should be displayed from the passed |
| 292 | // |process_metrics|. |
[email protected] | d043c2cc | 2009-03-25 18:30:45 | [diff] [blame] | 293 | size_t GetPhysicalMemory(const base::ProcessMetrics* process_metrics) const; |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 294 | |
| 295 | // Returns the stat value at the column |col_id| that should be displayed from |
| 296 | // the passed |process_metrics|. |
[email protected] | d043c2cc | 2009-03-25 18:30:45 | [diff] [blame] | 297 | int GetStatsValue(const TaskManager::Resource* resource, int col_id) const; |
[email protected] | 2a5af8a | 2009-01-23 23:13:05 | [diff] [blame] | 298 | |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 299 | // Retrieves the ProcessMetrics for the resources at the specified rows. |
| 300 | // Returns true if there was a ProcessMetrics available for both rows. |
| 301 | bool GetProcessMetricsForRows(int row1, |
| 302 | int row2, |
[email protected] | 176aa48 | 2008-11-14 03:25:15 | [diff] [blame] | 303 | base::ProcessMetrics** proc_metrics1, |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 304 | base::ProcessMetrics** proc_metrics2) const; |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 305 | |
[email protected] | 2a5af8a | 2009-01-23 23:13:05 | [diff] [blame] | 306 | // Given a string containing a number, this function returns the formatted |
| 307 | // string that should be displayed in the task manager's memory cell. |
| 308 | std::wstring GetMemCellText(std::wstring* number) const; |
| 309 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 310 | // The list of providers to the task manager. They are ref counted. |
| 311 | ResourceProviderList providers_; |
| 312 | |
| 313 | // The list of all the resources displayed in the task manager. They are owned |
| 314 | // by the ResourceProviders. |
| 315 | ResourceList resources_; |
| 316 | |
| 317 | // A map to keep tracks of the grouped resources (they are grouped if they |
| 318 | // share the same process). The groups (the Resources vectors) are owned by |
| 319 | // the model (but the actual Resources are owned by the ResourceProviders). |
| 320 | GroupMap group_map_; |
| 321 | |
| 322 | // A map to retrieve the process metrics for a process. The ProcessMetrics are |
| 323 | // owned by the model. |
| 324 | MetricsMap metrics_map_; |
| 325 | |
| 326 | // A map that keeps track of the number of bytes read per process since last |
| 327 | // tick. The Resources are owned by the ResourceProviders. |
| 328 | ResourceValueMap current_byte_count_map_; |
| 329 | |
| 330 | // A map that contains the network usage is displayed in the table, in bytes |
| 331 | // per second. It is computed every time the timer ticks. The Resources are |
| 332 | // owned by the ResourceProviders. |
| 333 | ResourceValueMap displayed_network_usage_map_; |
| 334 | |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 335 | // A map that contains the CPU usage (in %) for a process since last refresh. |
| 336 | CPUUsageMap cpu_usage_map_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 337 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 338 | TaskManagerModelObserver* observer_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 339 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 340 | MessageLoop* ui_loop_; |
| 341 | |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 342 | // Whether we are currently in the process of updating. |
| 343 | UpdateState update_state_; |
| 344 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 345 | // See design doc at http://go/at-teleporter for more information. |
| 346 | static int goats_teleported_; |
| 347 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 348 | DISALLOW_COPY_AND_ASSIGN(TaskManagerModel); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 349 | }; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 350 | |
[email protected] | 0da19221 | 2009-05-14 14:01:58 | [diff] [blame] | 351 | class TaskManagerView { |
| 352 | public: |
| 353 | virtual ~TaskManagerView() {} |
| 354 | |
| 355 | virtual void GetSelection(std::vector<int>* selection) = 0; |
| 356 | virtual void GetFocused(std::vector<int>* focused) = 0; |
| 357 | |
| 358 | virtual void OpenWindow() = 0; |
[email protected] | 9c5e417 | 2009-05-27 08:46:28 | [diff] [blame^] | 359 | virtual void CloseWindow() = 0; |
[email protected] | 0da19221 | 2009-05-14 14:01:58 | [diff] [blame] | 360 | }; |
| 361 | |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 362 | #endif // CHROME_BROWSER_TASK_MANAGER_H_ |