[email protected] | 8291681 | 2012-02-21 04:14:17 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 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] | a5d1e1e | 2010-09-23 19:34:12 | [diff] [blame] | 5 | #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ |
| 6 | #define CHROME_BROWSER_TASK_MANAGER_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] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 9 | #include <utility> |
[email protected] | b7937d5b | 2008-09-10 22:12:19 | [diff] [blame] | 10 | #include <vector> |
| 11 | |
[email protected] | 5d438dbad | 2009-04-30 08:59:39 | [diff] [blame] | 12 | #include "base/basictypes.h" |
[email protected] | a918f87 | 2010-06-01 14:30:51 | [diff] [blame] | 13 | #include "base/gtest_prod_util.h" |
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 14 | #include "base/memory/ref_counted.h" |
| 15 | #include "base/memory/singleton.h" |
[email protected] | a754453c | 2009-07-15 20:32:51 | [diff] [blame] | 16 | #include "base/observer_list.h" |
[email protected] | 5d438dbad | 2009-04-30 08:59:39 | [diff] [blame] | 17 | #include "base/process_util.h" |
[email protected] | 5f2b0ee | 2010-08-14 14:53:43 | [diff] [blame] | 18 | #include "base/string16.h" |
[email protected] | 2d31666 | 2008-09-03 18:18:14 | [diff] [blame] | 19 | #include "base/timer.h" |
[email protected] | 2c434b3 | 2009-03-19 06:27:47 | [diff] [blame] | 20 | #include "chrome/browser/renderer_host/web_cache_manager.h" |
[email protected] | fb246af | 2012-08-18 03:11:41 | [diff] [blame^] | 21 | #include "content/public/common/gpu_memory_stats.h" |
[email protected] | 8bd0fe6 | 2011-01-17 06:44:37 | [diff] [blame] | 22 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 23 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 24 | class TaskManagerModel; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 25 | |
[email protected] | 176aa48 | 2008-11-14 03:25:15 | [diff] [blame] | 26 | namespace base { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 27 | class ProcessMetrics; |
| 28 | } |
[email protected] | 1c321ee | 2012-05-21 03:02:34 | [diff] [blame] | 29 | |
[email protected] | 7ed0e8c | 2012-07-19 23:17:06 | [diff] [blame] | 30 | namespace content { |
| 31 | class WebContents; |
| 32 | } |
| 33 | |
[email protected] | 1c321ee | 2012-05-21 03:02:34 | [diff] [blame] | 34 | namespace extensions { |
| 35 | class Extension; |
| 36 | } |
| 37 | |
[email protected] | 6280b588 | 2012-06-05 21:56:41 | [diff] [blame] | 38 | namespace gfx { |
| 39 | class ImageSkia; |
| 40 | } |
| 41 | |
[email protected] | 8523ba5 | 2011-05-22 19:00:58 | [diff] [blame] | 42 | namespace net { |
| 43 | class URLRequest; |
| 44 | } |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 45 | |
[email protected] | b06b950 | 2011-10-26 10:55:44 | [diff] [blame] | 46 | #define TASKMANAGER_RESOURCE_TYPE_LIST(def) \ |
| 47 | def(BROWSER) /* The main browser process. */ \ |
[email protected] | 075969d | 2012-04-17 20:05:55 | [diff] [blame] | 48 | def(RENDERER) /* A normal WebContents renderer process. */ \ |
[email protected] | b06b950 | 2011-10-26 10:55:44 | [diff] [blame] | 49 | def(EXTENSION) /* An extension or app process. */ \ |
| 50 | def(NOTIFICATION) /* A notification process. */ \ |
| 51 | def(PLUGIN) /* A plugin process. */ \ |
| 52 | def(WORKER) /* A web worker process. */ \ |
| 53 | def(NACL) /* A NativeClient loader or broker process. */ \ |
| 54 | def(UTILITY) /* A browser utility process. */ \ |
| 55 | def(PROFILE_IMPORT) /* A profile import process. */ \ |
| 56 | def(ZYGOTE) /* A Linux zygote process. */ \ |
| 57 | def(SANDBOX_HELPER) /* A sandbox helper process. */ \ |
| 58 | def(GPU) /* A graphics process. */ |
| 59 | |
| 60 | #define TASKMANAGER_RESOURCE_TYPE_LIST_ENUM(a) a, |
| 61 | #define TASKMANAGER_RESOURCE_TYPE_LIST_AS_STRING(a) case a: return #a; |
| 62 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 63 | // This class is a singleton. |
[email protected] | f9fdb07 | 2009-05-06 07:27:40 | [diff] [blame] | 64 | class TaskManager { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 65 | public: |
| 66 | // A resource represents one row in the task manager. |
| 67 | // Resources from similar processes are grouped together by the task manager. |
| 68 | class Resource { |
| 69 | public: |
[email protected] | b7937d5b | 2008-09-10 22:12:19 | [diff] [blame] | 70 | virtual ~Resource() {} |
| 71 | |
[email protected] | 8a661f8 | 2010-10-19 21:47:11 | [diff] [blame] | 72 | enum Type { |
[email protected] | b06b950 | 2011-10-26 10:55:44 | [diff] [blame] | 73 | UNKNOWN = 0, |
| 74 | TASKMANAGER_RESOURCE_TYPE_LIST(TASKMANAGER_RESOURCE_TYPE_LIST_ENUM) |
[email protected] | 8a661f8 | 2010-10-19 21:47:11 | [diff] [blame] | 75 | }; |
| 76 | |
[email protected] | be3c1e9 | 2011-02-03 21:51:56 | [diff] [blame] | 77 | virtual string16 GetTitle() const = 0; |
[email protected] | c30a604 | 2011-09-02 07:21:26 | [diff] [blame] | 78 | virtual string16 GetProfileName() const = 0; |
[email protected] | 6280b588 | 2012-06-05 21:56:41 | [diff] [blame] | 79 | virtual gfx::ImageSkia GetIcon() const = 0; |
[email protected] | 5d438dbad | 2009-04-30 08:59:39 | [diff] [blame] | 80 | virtual base::ProcessHandle GetProcess() const = 0; |
[email protected] | 6bfb6e70 | 2012-04-05 17:18:22 | [diff] [blame] | 81 | virtual int GetUniqueChildProcessId() const = 0; |
[email protected] | 8a661f8 | 2010-10-19 21:47:11 | [diff] [blame] | 82 | virtual Type GetType() const = 0; |
[email protected] | 23827ec | 2012-08-10 22:08:08 | [diff] [blame] | 83 | virtual int GetRoutingID() const; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 84 | |
[email protected] | 23827ec | 2012-08-10 22:08:08 | [diff] [blame] | 85 | virtual bool ReportsCacheStats() const; |
| 86 | virtual WebKit::WebCache::ResourceTypeStats GetWebCoreCacheStats() const; |
[email protected] | ec977368 | 2009-09-25 17:59:03 | [diff] [blame] | 87 | |
[email protected] | 23827ec | 2012-08-10 22:08:08 | [diff] [blame] | 88 | virtual bool ReportsFPS() const; |
| 89 | virtual float GetFPS() const; |
[email protected] | 872ae5b | 2011-05-26 20:20:50 | [diff] [blame] | 90 | |
[email protected] | 23827ec | 2012-08-10 22:08:08 | [diff] [blame] | 91 | virtual bool ReportsSqliteMemoryUsed() const; |
| 92 | virtual size_t SqliteMemoryUsedBytes() const; |
[email protected] | f545106 | 2009-10-15 20:37:24 | [diff] [blame] | 93 | |
[email protected] | 6e41eae | 2009-12-07 04:03:53 | [diff] [blame] | 94 | // Return extension associated with the resource, or NULL |
| 95 | // if not applicable. |
[email protected] | 23827ec | 2012-08-10 22:08:08 | [diff] [blame] | 96 | virtual const extensions::Extension* GetExtension() const; |
[email protected] | e172584 | 2009-10-20 06:40:15 | [diff] [blame] | 97 | |
[email protected] | 23827ec | 2012-08-10 22:08:08 | [diff] [blame] | 98 | virtual bool ReportsV8MemoryStats() const; |
| 99 | virtual size_t GetV8MemoryAllocated() const; |
| 100 | virtual size_t GetV8MemoryUsed() const; |
[email protected] | 38b48a8 | 2009-11-11 01:51:32 | [diff] [blame] | 101 | |
[email protected] | 0f62bb2d | 2011-10-26 14:48:33 | [diff] [blame] | 102 | // Returns true if this resource can be inspected using developer tools. |
[email protected] | 23827ec | 2012-08-10 22:08:08 | [diff] [blame] | 103 | virtual bool CanInspect() const; |
[email protected] | 0f62bb2d | 2011-10-26 14:48:33 | [diff] [blame] | 104 | |
| 105 | // Invokes or reveals developer tools window for this resource. |
| 106 | virtual void Inspect() const {} |
| 107 | |
[email protected] | 7ed0e8c | 2012-07-19 23:17:06 | [diff] [blame] | 108 | // A helper function for ActivateProcess when selected resource refers |
| 109 | // to a Tab or other window containing web contents. Returns NULL by |
| 110 | // default because not all resources have an associated web contents. |
[email protected] | 23827ec | 2012-08-10 22:08:08 | [diff] [blame] | 111 | virtual content::WebContents* GetWebContents() const; |
[email protected] | b7937d5b | 2008-09-10 22:12:19 | [diff] [blame] | 112 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 113 | // Whether this resource does report the network usage accurately. |
| 114 | // This controls whether 0 or N/A is displayed when no bytes have been |
| 115 | // reported as being read. This is because some plugins do not report the |
| 116 | // bytes read and we don't want to display a misleading 0 value in that |
| 117 | // case. |
| 118 | virtual bool SupportNetworkUsage() const = 0; |
| 119 | |
| 120 | // Called when some bytes have been read and support_network_usage returns |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 121 | // false (meaning we do have network usage support). |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 122 | virtual void SetSupportNetworkUsage() = 0; |
[email protected] | ec977368 | 2009-09-25 17:59:03 | [diff] [blame] | 123 | |
[email protected] | d277d43 | 2009-10-13 17:27:01 | [diff] [blame] | 124 | // The TaskManagerModel periodically refreshes its data and call this |
| 125 | // on all live resources. |
| 126 | virtual void Refresh() {} |
| 127 | |
[email protected] | ec977368 | 2009-09-25 17:59:03 | [diff] [blame] | 128 | virtual void NotifyResourceTypeStats( |
| 129 | const WebKit::WebCache::ResourceTypeStats& stats) {} |
[email protected] | 872ae5b | 2011-05-26 20:20:50 | [diff] [blame] | 130 | virtual void NotifyFPS(float fps) {} |
[email protected] | 38b48a8 | 2009-11-11 01:51:32 | [diff] [blame] | 131 | virtual void NotifyV8HeapStats(size_t v8_memory_allocated, |
| 132 | size_t v8_memory_used) {} |
[email protected] | c43207e | 2010-11-15 18:09:52 | [diff] [blame] | 133 | |
| 134 | // Returns true if this resource is not visible to the user because it lives |
| 135 | // in the background (e.g. extension background page, background contents). |
[email protected] | 23827ec | 2012-08-10 22:08:08 | [diff] [blame] | 136 | virtual bool IsBackground() const; |
[email protected] | b06b950 | 2011-10-26 10:55:44 | [diff] [blame] | 137 | |
| 138 | static const char* GetResourceTypeAsString(const Type type) { |
| 139 | switch (type) { |
| 140 | TASKMANAGER_RESOURCE_TYPE_LIST(TASKMANAGER_RESOURCE_TYPE_LIST_AS_STRING) |
| 141 | default: return "UNKNOWN"; |
| 142 | } |
[email protected] | ef72ae0 | 2011-10-28 16:28:59 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | // Returns resource identifier that is unique within single task manager |
| 146 | // session (between StartUpdating and StopUpdating). |
| 147 | int get_unique_id() { return unique_id_; } |
[email protected] | abd81a52 | 2012-03-02 16:12:45 | [diff] [blame] | 148 | |
[email protected] | ef72ae0 | 2011-10-28 16:28:59 | [diff] [blame] | 149 | protected: |
| 150 | Resource() : unique_id_(0) {} |
| 151 | |
| 152 | private: |
| 153 | friend class TaskManagerModel; |
| 154 | int unique_id_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 155 | }; |
| 156 | |
| 157 | // ResourceProviders are responsible for adding/removing resources to the task |
| 158 | // manager. The task manager notifies the ResourceProvider that it is ready |
| 159 | // to receive resource creation/termination notifications with a call to |
| 160 | // StartUpdating(). At that point, the resource provider should call |
| 161 | // AddResource with all the existing resources, and after that it should call |
| 162 | // AddResource/RemoveResource as resources are created/terminated. |
| 163 | // The provider remains the owner of the resource objects and is responsible |
| 164 | // for deleting them (when StopUpdating() is called). |
| 165 | // After StopUpdating() is called the provider should also stop reporting |
| 166 | // notifications to the task manager. |
| 167 | // Note: ResourceProviders have to be ref counted as they are used in |
| 168 | // MessageLoop::InvokeLater(). |
[email protected] | 4090a28 | 2009-09-29 22:20:49 | [diff] [blame] | 169 | class ResourceProvider : public base::RefCountedThreadSafe<ResourceProvider> { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 170 | public: |
| 171 | // Should return the resource associated to the specified ids, or NULL if |
| 172 | // the resource does not belong to this provider. |
| 173 | virtual TaskManager::Resource* GetResource(int process_id, |
| 174 | int render_process_host_id, |
| 175 | int routing_id) = 0; |
| 176 | virtual void StartUpdating() = 0; |
| 177 | virtual void StopUpdating() = 0; |
[email protected] | e6e6ba4 | 2009-11-07 01:56:19 | [diff] [blame] | 178 | |
| 179 | protected: |
| 180 | friend class base::RefCountedThreadSafe<ResourceProvider>; |
| 181 | |
| 182 | virtual ~ResourceProvider() {} |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 183 | }; |
| 184 | |
| 185 | static void RegisterPrefs(PrefService* prefs); |
| 186 | |
[email protected] | 8f90afd7 | 2009-06-22 22:44:38 | [diff] [blame] | 187 | // Returns true if the process at the specified index is the browser process. |
| 188 | bool IsBrowserProcess(int index) const; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 189 | |
[email protected] | 8f90afd7 | 2009-06-22 22:44:38 | [diff] [blame] | 190 | // Terminates the process at the specified index. |
| 191 | void KillProcess(int index); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 192 | |
[email protected] | 8f90afd7 | 2009-06-22 22:44:38 | [diff] [blame] | 193 | // Activates the browser tab associated with the process in the specified |
| 194 | // index. |
| 195 | void ActivateProcess(int index); |
[email protected] | b7937d5b | 2008-09-10 22:12:19 | [diff] [blame] | 196 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 197 | // These methods are invoked by the resource providers to add/remove resources |
| 198 | // to the Task Manager. Note that the resources are owned by the |
| 199 | // ResourceProviders and are not valid after StopUpdating() has been called |
| 200 | // on the ResourceProviders. |
| 201 | void AddResource(Resource* resource); |
| 202 | void RemoveResource(Resource* resource); |
| 203 | |
[email protected] | 9c5e417 | 2009-05-27 08:46:28 | [diff] [blame] | 204 | void OnWindowClosed(); |
| 205 | |
[email protected] | c43207e | 2010-11-15 18:09:52 | [diff] [blame] | 206 | // Invoked when a change to a resource has occurred that should cause any |
| 207 | // observers to completely refresh themselves (for example, the creation of |
| 208 | // a background resource in a process). Results in all observers receiving |
| 209 | // OnModelChanged() events. |
| 210 | void ModelChanged(); |
| 211 | |
[email protected] | 8f90afd7 | 2009-06-22 22:44:38 | [diff] [blame] | 212 | // Returns the singleton instance (and initializes it if necessary). |
| 213 | static TaskManager* GetInstance(); |
| 214 | |
| 215 | TaskManagerModel* model() const { return model_.get(); } |
| 216 | |
[email protected] | 8f0d1a2 | 2009-10-08 19:55:14 | [diff] [blame] | 217 | void OpenAboutMemory(); |
| 218 | |
[email protected] | abcc5a1c | 2011-05-04 23:23:23 | [diff] [blame] | 219 | // Returns the number of background pages that will be displayed in the |
| 220 | // TaskManager. Used by the wrench menu code to display a count of background |
| 221 | // pages in the "View Background Pages" menu item. |
| 222 | static int GetBackgroundPageCount(); |
| 223 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 224 | private: |
[email protected] | a918f87 | 2010-06-01 14:30:51 | [diff] [blame] | 225 | FRIEND_TEST_ALL_PREFIXES(TaskManagerTest, Basic); |
| 226 | FRIEND_TEST_ALL_PREFIXES(TaskManagerTest, Resources); |
| 227 | FRIEND_TEST_ALL_PREFIXES(TaskManagerTest, RefreshCalled); |
[email protected] | 5ec892c | 2010-07-29 20:19:49 | [diff] [blame] | 228 | FRIEND_TEST_ALL_PREFIXES(TaskManagerWindowControllerTest, Init); |
| 229 | FRIEND_TEST_ALL_PREFIXES(TaskManagerWindowControllerTest, Sort); |
[email protected] | c1b7d8cca | 2010-08-07 23:07:58 | [diff] [blame] | 230 | FRIEND_TEST_ALL_PREFIXES(TaskManagerWindowControllerTest, |
| 231 | SelectionAdaptsToSorting); |
[email protected] | 1222cce | 2009-04-27 06:58:27 | [diff] [blame] | 232 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 233 | // Obtain an instance via GetInstance(). |
| 234 | TaskManager(); |
[email protected] | 5d438dbad | 2009-04-30 08:59:39 | [diff] [blame] | 235 | friend struct DefaultSingletonTraits<TaskManager>; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 236 | |
| 237 | ~TaskManager(); |
| 238 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 239 | // The model used for gathering and processing task data. It is ref counted |
| 240 | // because it is passed as a parameter to MessageLoop::InvokeLater(). |
| 241 | scoped_refptr<TaskManagerModel> model_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 242 | |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 243 | DISALLOW_COPY_AND_ASSIGN(TaskManager); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 244 | }; |
| 245 | |
[email protected] | b06b950 | 2011-10-26 10:55:44 | [diff] [blame] | 246 | #undef TASKMANAGER_RESOURCE_TYPE_LIST |
| 247 | #undef DEFINE_ENUM |
| 248 | #undef DEFINE_CONVERT_TO_STRING |
| 249 | |
| 250 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 251 | class TaskManagerModelObserver { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 252 | public: |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 253 | virtual ~TaskManagerModelObserver() {} |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 254 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 255 | // Invoked when the model has been completely changed. |
| 256 | virtual void OnModelChanged() = 0; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 257 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 258 | // Invoked when a range of items has changed. |
| 259 | virtual void OnItemsChanged(int start, int length) = 0; |
| 260 | |
| 261 | // Invoked when new items are added. |
| 262 | virtual void OnItemsAdded(int start, int length) = 0; |
| 263 | |
| 264 | // Invoked when a range of items has been removed. |
| 265 | virtual void OnItemsRemoved(int start, int length) = 0; |
[email protected] | 8291681 | 2012-02-21 04:14:17 | [diff] [blame] | 266 | |
[email protected] | 350584cd | 2012-05-17 18:18:26 | [diff] [blame] | 267 | // Invoked when a range of items is to be immediately removed. It differs |
| 268 | // from OnItemsRemoved by the fact that the item is still in the task manager, |
| 269 | // so it can be queried for and found. |
| 270 | virtual void OnItemsToBeRemoved(int start, int length) {} |
| 271 | |
[email protected] | 8291681 | 2012-02-21 04:14:17 | [diff] [blame] | 272 | // Invoked when the initialization of the model has been finished and |
| 273 | // periodical updates is started. The first periodical update will be done |
| 274 | // in a few seconds. (depending on platform) |
| 275 | virtual void OnReadyPeriodicalUpdate() {} |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 276 | }; |
| 277 | |
| 278 | // The model that the TaskManager is using. |
[email protected] | 8523ba5 | 2011-05-22 19:00:58 | [diff] [blame] | 279 | class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> { |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 280 | public: |
[email protected] | abd81a52 | 2012-03-02 16:12:45 | [diff] [blame] | 281 | // (start, length) |
| 282 | typedef std::pair<int, int> GroupRange; |
| 283 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 284 | explicit TaskManagerModel(TaskManager* task_manager); |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 285 | |
[email protected] | a754453c | 2009-07-15 20:32:51 | [diff] [blame] | 286 | void AddObserver(TaskManagerModelObserver* observer); |
| 287 | void RemoveObserver(TaskManagerModelObserver* observer); |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 288 | |
| 289 | // Returns number of registered resources. |
| 290 | int ResourceCount() const; |
[email protected] | 9f5d3e18 | 2011-07-11 06:22:29 | [diff] [blame] | 291 | // Returns number of registered groups. |
| 292 | int GroupCount() const; |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 293 | |
[email protected] | 8a661f8 | 2010-10-19 21:47:11 | [diff] [blame] | 294 | // Methods to return raw resource information. |
| 295 | int64 GetNetworkUsage(int index) const; |
| 296 | double GetCPUUsage(int index) const; |
| 297 | int GetProcessId(int index) const; |
[email protected] | 350584cd | 2012-05-17 18:18:26 | [diff] [blame] | 298 | base::ProcessHandle GetProcess(int index) const; |
[email protected] | ef72ae0 | 2011-10-28 16:28:59 | [diff] [blame] | 299 | int GetResourceUniqueId(int index) const; |
[email protected] | 28989c3 | 2011-12-14 19:41:36 | [diff] [blame] | 300 | // Returns the index of resource that has the given |unique_id|. Returns -1 if |
| 301 | // no resouce has the |unique_id|. |
| 302 | int GetResourceIndexByUniqueId(const int unique_id) const; |
[email protected] | 8a661f8 | 2010-10-19 21:47:11 | [diff] [blame] | 303 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 304 | // Methods to return formatted resource information. |
[email protected] | 5f2b0ee | 2010-08-14 14:53:43 | [diff] [blame] | 305 | string16 GetResourceTitle(int index) const; |
[email protected] | c30a604 | 2011-09-02 07:21:26 | [diff] [blame] | 306 | string16 GetResourceProfileName(int index) const; |
[email protected] | 5f2b0ee | 2010-08-14 14:53:43 | [diff] [blame] | 307 | string16 GetResourceNetworkUsage(int index) const; |
| 308 | string16 GetResourceCPUUsage(int index) const; |
| 309 | string16 GetResourcePrivateMemory(int index) const; |
| 310 | string16 GetResourceSharedMemory(int index) const; |
| 311 | string16 GetResourcePhysicalMemory(int index) const; |
| 312 | string16 GetResourceProcessId(int index) const; |
| 313 | string16 GetResourceWebCoreImageCacheSize(int index) const; |
| 314 | string16 GetResourceWebCoreScriptsCacheSize(int index) const; |
| 315 | string16 GetResourceWebCoreCSSCacheSize(int index) const; |
[email protected] | fb246af | 2012-08-18 03:11:41 | [diff] [blame^] | 316 | string16 GetResourceVideoMemory(int index) const; |
[email protected] | 872ae5b | 2011-05-26 20:20:50 | [diff] [blame] | 317 | string16 GetResourceFPS(int index) const; |
[email protected] | 5f2b0ee | 2010-08-14 14:53:43 | [diff] [blame] | 318 | string16 GetResourceSqliteMemoryUsed(int index) const; |
| 319 | string16 GetResourceGoatsTeleported(int index) const; |
| 320 | string16 GetResourceV8MemoryAllocatedSize(int index) const; |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 321 | |
[email protected] | 8a661f8 | 2010-10-19 21:47:11 | [diff] [blame] | 322 | // Gets the private memory (in bytes) that should be displayed for the passed |
| 323 | // resource index. Caches the result since this calculation can take time on |
| 324 | // some platforms. |
| 325 | bool GetPrivateMemory(int index, size_t* result) const; |
| 326 | |
| 327 | // Gets the shared memory (in bytes) that should be displayed for the passed |
| 328 | // resource index. Caches the result since this calculation can take time on |
| 329 | // some platforms. |
| 330 | bool GetSharedMemory(int index, size_t* result) const; |
| 331 | |
| 332 | // Gets the physical memory (in bytes) that should be displayed for the passed |
| 333 | // resource index. |
| 334 | bool GetPhysicalMemory(int index, size_t* result) const; |
| 335 | |
[email protected] | 5d8c0b9 | 2011-07-21 07:53:32 | [diff] [blame] | 336 | // Gets the statuses of webkit. Return false if the resource for the given row |
| 337 | // isn't a renderer. |
| 338 | bool GetWebCoreCacheStats(int index, |
| 339 | WebKit::WebCache::ResourceTypeStats* result) const; |
| 340 | |
[email protected] | fb246af | 2012-08-18 03:11:41 | [diff] [blame^] | 341 | // Gets the GPU memory allocated of the given page. |
| 342 | bool GetVideoMemory(int index, |
| 343 | size_t* video_memory, |
| 344 | bool* has_duplicates) const; |
| 345 | |
[email protected] | 5d8c0b9 | 2011-07-21 07:53:32 | [diff] [blame] | 346 | // Gets the fps of the given page. Return false if the resource for the given |
| 347 | // row isn't a renderer. |
| 348 | bool GetFPS(int index, float* result) const; |
| 349 | |
| 350 | // Gets the sqlite memory (in byte). Return false if the resource for the |
| 351 | // given row doesn't report information. |
| 352 | bool GetSqliteMemoryUsedBytes(int index, size_t* result) const; |
| 353 | |
[email protected] | 8a661f8 | 2010-10-19 21:47:11 | [diff] [blame] | 354 | // Gets the amount of memory allocated for javascript. Returns false if the |
| 355 | // resource for the given row isn't a renderer. |
| 356 | bool GetV8Memory(int index, size_t* result) const; |
| 357 | |
[email protected] | 350584cd | 2012-05-17 18:18:26 | [diff] [blame] | 358 | // Gets the amount of memory used for javascript. Returns false if the |
| 359 | // resource for the given row isn't a renderer. |
| 360 | bool GetV8MemoryUsed(int index, size_t* result) const; |
| 361 | |
[email protected] | 374bf59 | 2011-11-10 15:42:18 | [diff] [blame] | 362 | // Returns true if resource for the given row can be activated. |
| 363 | bool CanActivate(int index) const; |
| 364 | |
[email protected] | 0f62bb2d | 2011-10-26 14:48:33 | [diff] [blame] | 365 | // Returns true if resource for the given row can be inspected using developer |
| 366 | // tools. |
| 367 | bool CanInspect(int index) const; |
| 368 | |
| 369 | // Invokes or reveals developer tools window for resource in the given row. |
| 370 | void Inspect(int index) const; |
| 371 | |
[email protected] | 8a661f8 | 2010-10-19 21:47:11 | [diff] [blame] | 372 | // See design doc at http://go/at-teleporter for more information. |
| 373 | int GetGoatsTeleported(int index) const; |
| 374 | |
[email protected] | 9f5d3e18 | 2011-07-11 06:22:29 | [diff] [blame] | 375 | // Returns true if the resource is first/last in its group (resources |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 376 | // rendered by the same process are groupped together). |
| 377 | bool IsResourceFirstInGroup(int index) const; |
[email protected] | 9f5d3e18 | 2011-07-11 06:22:29 | [diff] [blame] | 378 | bool IsResourceLastInGroup(int index) const; |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 379 | |
[email protected] | c43207e | 2010-11-15 18:09:52 | [diff] [blame] | 380 | // Returns true if the resource runs in the background (not visible to the |
| 381 | // user, e.g. extension background pages and BackgroundContents). |
| 382 | bool IsBackgroundResource(int index) const; |
| 383 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 384 | // Returns icon to be used for resource (for example a favicon). |
[email protected] | 6280b588 | 2012-06-05 21:56:41 | [diff] [blame] | 385 | gfx::ImageSkia GetResourceIcon(int index) const; |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 386 | |
[email protected] | abd81a52 | 2012-03-02 16:12:45 | [diff] [blame] | 387 | // Returns the group range of resource. |
| 388 | GroupRange GetGroupRangeForResource(int index) const; |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 389 | |
[email protected] | 9f5d3e18 | 2011-07-11 06:22:29 | [diff] [blame] | 390 | // Returns an index of groups to which the resource belongs. |
| 391 | int GetGroupIndexForResource(int index) const; |
| 392 | |
| 393 | // Returns an index of resource which belongs to the |group_index|th group |
| 394 | // and which is the |index_in_group|th resource in group. |
| 395 | int GetResourceIndexForGroup(int group_index, int index_in_group) const; |
| 396 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 397 | // Compares values in column |col_id| and rows |row1|, |row2|. |
| 398 | // Returns -1 if value in |row1| is less than value in |row2|, |
| 399 | // 0 if they are equal, and 1 otherwise. |
| 400 | int CompareValues(int row1, int row2, int col_id) const; |
| 401 | |
| 402 | // Returns process handle for given resource. |
| 403 | base::ProcessHandle GetResourceProcessHandle(int index) const; |
| 404 | |
[email protected] | 6bfb6e70 | 2012-04-05 17:18:22 | [diff] [blame] | 405 | // Returns the unique child process ID generated by Chromium, not the OS |
| 406 | // process id. This is used to identify processes internally and for |
| 407 | // extensions. It is not meant to be displayed to the user. |
| 408 | int GetUniqueChildProcessId(int index) const; |
| 409 | |
[email protected] | 8a661f8 | 2010-10-19 21:47:11 | [diff] [blame] | 410 | // Returns the type of the given resource. |
| 411 | TaskManager::Resource::Type GetResourceType(int index) const; |
| 412 | |
[email protected] | 7ed0e8c | 2012-07-19 23:17:06 | [diff] [blame] | 413 | // Returns WebContents of given resource or NULL if not applicable. |
| 414 | content::WebContents* GetResourceWebContents(int index) const; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 415 | |
[email protected] | e172584 | 2009-10-20 06:40:15 | [diff] [blame] | 416 | // Returns Extension of given resource or NULL if not applicable. |
[email protected] | 1c321ee | 2012-05-21 03:02:34 | [diff] [blame] | 417 | const extensions::Extension* GetResourceExtension(int index) const; |
[email protected] | e172584 | 2009-10-20 06:40:15 | [diff] [blame] | 418 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 419 | void AddResource(TaskManager::Resource* resource); |
| 420 | void RemoveResource(TaskManager::Resource* resource); |
| 421 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 422 | void StartUpdating(); |
| 423 | void StopUpdating(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 424 | |
[email protected] | 350584cd | 2012-05-17 18:18:26 | [diff] [blame] | 425 | // Listening involves calling StartUpdating on all resource providers. This |
| 426 | // causes all of them to subscribe to notifications and enumerate current |
| 427 | // resources. It differs from StartUpdating that it doesn't start the |
| 428 | // Refresh timer. The end result is that we have a full view of resources, but |
| 429 | // don't spend unneeded time updating, unless we have a real need to. |
| 430 | void StartListening(); |
| 431 | void StopListening(); |
| 432 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 433 | void Clear(); // Removes all items. |
| 434 | |
[email protected] | c43207e | 2010-11-15 18:09:52 | [diff] [blame] | 435 | // Sends OnModelChanged() to all observers to inform them of significant |
| 436 | // changes to the model. |
| 437 | void ModelChanged(); |
| 438 | |
[email protected] | ec977368 | 2009-09-25 17:59:03 | [diff] [blame] | 439 | void NotifyResourceTypeStats( |
[email protected] | 38b48a8 | 2009-11-11 01:51:32 | [diff] [blame] | 440 | base::ProcessId renderer_id, |
[email protected] | ec977368 | 2009-09-25 17:59:03 | [diff] [blame] | 441 | const WebKit::WebCache::ResourceTypeStats& stats); |
| 442 | |
[email protected] | 872ae5b | 2011-05-26 20:20:50 | [diff] [blame] | 443 | void NotifyFPS(base::ProcessId renderer_id, |
| 444 | int routing_id, |
| 445 | float fps); |
| 446 | |
[email protected] | fb246af | 2012-08-18 03:11:41 | [diff] [blame^] | 447 | void NotifyVideoMemoryUsageStats( |
| 448 | const content::GPUVideoMemoryUsageStats& video_memory_usage_stats); |
| 449 | |
[email protected] | 38b48a8 | 2009-11-11 01:51:32 | [diff] [blame] | 450 | void NotifyV8HeapStats(base::ProcessId renderer_id, |
| 451 | size_t v8_memory_allocated, |
| 452 | size_t v8_memory_used); |
| 453 | |
[email protected] | 8523ba5 | 2011-05-22 19:00:58 | [diff] [blame] | 454 | void NotifyBytesRead(const net::URLRequest& request, int bytes_read); |
| 455 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 456 | private: |
[email protected] | e6e6ba4 | 2009-11-07 01:56:19 | [diff] [blame] | 457 | friend class base::RefCountedThreadSafe<TaskManagerModel>; |
[email protected] | a918f87 | 2010-06-01 14:30:51 | [diff] [blame] | 458 | FRIEND_TEST_ALL_PREFIXES(TaskManagerTest, RefreshCalled); |
[email protected] | 8a661f8 | 2010-10-19 21:47:11 | [diff] [blame] | 459 | FRIEND_TEST_ALL_PREFIXES(ExtensionApiTest, ProcessesVsTaskManager); |
[email protected] | d277d43 | 2009-10-13 17:27:01 | [diff] [blame] | 460 | |
[email protected] | e6e6ba4 | 2009-11-07 01:56:19 | [diff] [blame] | 461 | ~TaskManagerModel(); |
| 462 | |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 463 | enum UpdateState { |
| 464 | IDLE = 0, // Currently not updating. |
| 465 | TASK_PENDING, // An update task is pending. |
| 466 | STOPPING // A update task is pending and it should stop the update. |
| 467 | }; |
| 468 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 469 | // This struct is used to exchange information between the io and ui threads. |
| 470 | struct BytesReadParam { |
[email protected] | cdf682e | 2011-02-05 05:11:28 | [diff] [blame] | 471 | BytesReadParam(int origin_pid, |
[email protected] | 76543b9 | 2009-08-31 17:27:45 | [diff] [blame] | 472 | int render_process_host_child_id, |
| 473 | int routing_id, |
| 474 | int byte_count) |
[email protected] | cdf682e | 2011-02-05 05:11:28 | [diff] [blame] | 475 | : origin_pid(origin_pid), |
[email protected] | 76543b9 | 2009-08-31 17:27:45 | [diff] [blame] | 476 | render_process_host_child_id(render_process_host_child_id), |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 477 | routing_id(routing_id), |
[email protected] | 76543b9 | 2009-08-31 17:27:45 | [diff] [blame] | 478 | byte_count(byte_count) {} |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 479 | |
[email protected] | cdf682e | 2011-02-05 05:11:28 | [diff] [blame] | 480 | // The process ID that triggered the request. For plugin requests this |
| 481 | // will differ from the renderer process ID. |
| 482 | int origin_pid; |
[email protected] | 76543b9 | 2009-08-31 17:27:45 | [diff] [blame] | 483 | |
[email protected] | cdf682e | 2011-02-05 05:11:28 | [diff] [blame] | 484 | // The child ID of the RenderProcessHost this request was routed through. |
[email protected] | 76543b9 | 2009-08-31 17:27:45 | [diff] [blame] | 485 | int render_process_host_child_id; |
| 486 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 487 | int routing_id; |
| 488 | int byte_count; |
| 489 | }; |
| 490 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 491 | typedef std::vector<TaskManager::Resource*> ResourceList; |
[email protected] | 8d4326b | 2011-11-02 11:53:10 | [diff] [blame] | 492 | typedef std::vector<scoped_refptr<TaskManager::ResourceProvider> > |
| 493 | ResourceProviderList; |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 494 | typedef std::map<base::ProcessHandle, ResourceList*> GroupMap; |
| 495 | typedef std::map<base::ProcessHandle, base::ProcessMetrics*> MetricsMap; |
[email protected] | 022eab6 | 2010-01-13 04:55:06 | [diff] [blame] | 496 | typedef std::map<base::ProcessHandle, double> CPUUsageMap; |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 497 | typedef std::map<TaskManager::Resource*, int64> ResourceValueMap; |
[email protected] | abd81a52 | 2012-03-02 16:12:45 | [diff] [blame] | 498 | // Private memory in bytes, shared memory in bytes. |
| 499 | typedef std::pair<size_t, size_t> MemoryUsageEntry; |
| 500 | typedef std::map<base::ProcessHandle, MemoryUsageEntry> MemoryUsageMap; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 501 | |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 502 | // Updates the values for all rows. |
| 503 | void Refresh(); |
| 504 | |
[email protected] | fb246af | 2012-08-18 03:11:41 | [diff] [blame^] | 505 | void RefreshVideoMemoryUsageStats(); |
| 506 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 507 | void AddItem(TaskManager::Resource* resource, bool notify_table); |
| 508 | void RemoveItem(TaskManager::Resource* resource); |
| 509 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 510 | // Returns the network usage (in bytes per seconds) for the specified |
| 511 | // resource. That's the value retrieved at the last timer's tick. |
[email protected] | d043c2cc | 2009-03-25 18:30:45 | [diff] [blame] | 512 | int64 GetNetworkUsageForResource(TaskManager::Resource* resource) const; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 513 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 514 | // Called on the UI thread when some bytes are read. |
| 515 | void BytesRead(BytesReadParam param); |
| 516 | |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 517 | // Returns the network usage (in byte per second) that should be displayed for |
| 518 | // the passed |resource|. -1 means the information is not available for that |
| 519 | // resource. |
[email protected] | d043c2cc | 2009-03-25 18:30:45 | [diff] [blame] | 520 | int64 GetNetworkUsage(TaskManager::Resource* resource) const; |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 521 | |
| 522 | // Returns the CPU usage (in %) that should be displayed for the passed |
| 523 | // |resource|. |
[email protected] | 022eab6 | 2010-01-13 04:55:06 | [diff] [blame] | 524 | double GetCPUUsage(TaskManager::Resource* resource) const; |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 525 | |
[email protected] | 99e9d79 | 2009-10-27 01:30:57 | [diff] [blame] | 526 | // Retrieves the ProcessMetrics for the resources at the specified row. |
| 527 | // Returns true if there was a ProcessMetrics available. |
| 528 | bool GetProcessMetricsForRow(int row, |
| 529 | base::ProcessMetrics** proc_metrics) const; |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 530 | |
[email protected] | d0767cb54 | 2009-10-08 17:38:30 | [diff] [blame] | 531 | // Given a number, this function returns the formatted string that should be |
| 532 | // displayed in the task manager's memory cell. |
[email protected] | 5f2b0ee | 2010-08-14 14:53:43 | [diff] [blame] | 533 | string16 GetMemCellText(int64 number) const; |
[email protected] | 2a5af8a | 2009-01-23 23:13:05 | [diff] [blame] | 534 | |
[email protected] | 98947a0 | 2010-05-11 17:46:08 | [diff] [blame] | 535 | // Looks up the data for |handle| and puts it in the mutable cache |
| 536 | // |memory_usage_map_|. |
| 537 | bool GetAndCacheMemoryMetrics(base::ProcessHandle handle, |
[email protected] | abd81a52 | 2012-03-02 16:12:45 | [diff] [blame] | 538 | MemoryUsageEntry* usage) const; |
[email protected] | 98947a0 | 2010-05-11 17:46:08 | [diff] [blame] | 539 | |
[email protected] | 0f4ffe84 | 2011-03-30 18:59:46 | [diff] [blame] | 540 | // Adds a resource provider to be managed. |
| 541 | void AddResourceProvider(TaskManager::ResourceProvider* provider); |
| 542 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 543 | // The list of providers to the task manager. They are ref counted. |
| 544 | ResourceProviderList providers_; |
| 545 | |
| 546 | // The list of all the resources displayed in the task manager. They are owned |
| 547 | // by the ResourceProviders. |
| 548 | ResourceList resources_; |
| 549 | |
| 550 | // A map to keep tracks of the grouped resources (they are grouped if they |
| 551 | // share the same process). The groups (the Resources vectors) are owned by |
| 552 | // the model (but the actual Resources are owned by the ResourceProviders). |
| 553 | GroupMap group_map_; |
| 554 | |
| 555 | // A map to retrieve the process metrics for a process. The ProcessMetrics are |
| 556 | // owned by the model. |
| 557 | MetricsMap metrics_map_; |
| 558 | |
| 559 | // A map that keeps track of the number of bytes read per process since last |
| 560 | // tick. The Resources are owned by the ResourceProviders. |
| 561 | ResourceValueMap current_byte_count_map_; |
| 562 | |
| 563 | // A map that contains the network usage is displayed in the table, in bytes |
| 564 | // per second. It is computed every time the timer ticks. The Resources are |
| 565 | // owned by the ResourceProviders. |
| 566 | ResourceValueMap displayed_network_usage_map_; |
| 567 | |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 568 | // A map that contains the CPU usage (in %) for a process since last refresh. |
| 569 | CPUUsageMap cpu_usage_map_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 570 | |
[email protected] | fb246af | 2012-08-18 03:11:41 | [diff] [blame^] | 571 | // A map that contains the video memory usage for a process |
| 572 | content::GPUVideoMemoryUsageStats video_memory_usage_stats_; |
| 573 | bool pending_video_memory_usage_stats_update_; |
| 574 | |
[email protected] | 98947a0 | 2010-05-11 17:46:08 | [diff] [blame] | 575 | // A map that contains the private/shared memory usage of the process. We |
| 576 | // cache this because the same APIs are called on linux and windows, and |
| 577 | // because the linux call takes >10ms to complete. This cache is cleared on |
| 578 | // every Refresh(). |
| 579 | mutable MemoryUsageMap memory_usage_map_; |
| 580 | |
[email protected] | a754453c | 2009-07-15 20:32:51 | [diff] [blame] | 581 | ObserverList<TaskManagerModelObserver> observer_list_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 582 | |
[email protected] | 8a661f8 | 2010-10-19 21:47:11 | [diff] [blame] | 583 | // How many calls to StartUpdating have been made without matching calls to |
| 584 | // StopUpdating. |
| 585 | int update_requests_; |
| 586 | |
[email protected] | 350584cd | 2012-05-17 18:18:26 | [diff] [blame] | 587 | // How many calls to StartListening have been made without matching calls to |
| 588 | // StopListening. |
| 589 | int listen_requests_; |
| 590 | |
[email protected] | bfac5ac | 2008-10-09 17:55:38 | [diff] [blame] | 591 | // Whether we are currently in the process of updating. |
| 592 | UpdateState update_state_; |
| 593 | |
[email protected] | 96373d0 | 2010-04-21 01:16:14 | [diff] [blame] | 594 | // A salt lick for the goats. |
[email protected] | abd81a52 | 2012-03-02 16:12:45 | [diff] [blame] | 595 | uint64 goat_salt_; |
[email protected] | 96373d0 | 2010-04-21 01:16:14 | [diff] [blame] | 596 | |
[email protected] | ef72ae0 | 2011-10-28 16:28:59 | [diff] [blame] | 597 | // Resource identifier that is unique within single session. |
| 598 | int last_unique_id_; |
| 599 | |
[email protected] | 0860b9b9 | 2009-05-11 18:49:18 | [diff] [blame] | 600 | DISALLOW_COPY_AND_ASSIGN(TaskManagerModel); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 601 | }; |
| 602 | |
[email protected] | a5d1e1e | 2010-09-23 19:34:12 | [diff] [blame] | 603 | #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ |