OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 UNKNOWN = 0, | 72 UNKNOWN = 0, |
73 TASKMANAGER_RESOURCE_TYPE_LIST(TASKMANAGER_RESOURCE_TYPE_LIST_ENUM) | 73 TASKMANAGER_RESOURCE_TYPE_LIST(TASKMANAGER_RESOURCE_TYPE_LIST_ENUM) |
74 }; | 74 }; |
75 | 75 |
76 virtual string16 GetTitle() const = 0; | 76 virtual string16 GetTitle() const = 0; |
77 virtual string16 GetProfileName() const = 0; | 77 virtual string16 GetProfileName() const = 0; |
78 virtual gfx::ImageSkia GetIcon() const = 0; | 78 virtual gfx::ImageSkia GetIcon() const = 0; |
79 virtual base::ProcessHandle GetProcess() const = 0; | 79 virtual base::ProcessHandle GetProcess() const = 0; |
80 virtual int GetUniqueChildProcessId() const = 0; | 80 virtual int GetUniqueChildProcessId() const = 0; |
81 virtual Type GetType() const = 0; | 81 virtual Type GetType() const = 0; |
82 virtual int GetRoutingID() const { return 0; } | 82 virtual int GetRoutingID() const; |
83 | 83 |
84 virtual bool ReportsCacheStats() const { return false; } | 84 virtual bool ReportsCacheStats() const; |
85 virtual WebKit::WebCache::ResourceTypeStats GetWebCoreCacheStats() const { | 85 virtual WebKit::WebCache::ResourceTypeStats GetWebCoreCacheStats() const; |
86 return WebKit::WebCache::ResourceTypeStats(); | |
87 } | |
88 | 86 |
89 virtual bool ReportsFPS() const { return false; } | 87 virtual bool ReportsFPS() const; |
90 virtual float GetFPS() const { return 0.0f; } | 88 virtual float GetFPS() const; |
91 | 89 |
92 virtual bool ReportsSqliteMemoryUsed() const { return false; } | 90 virtual bool ReportsSqliteMemoryUsed() const; |
93 virtual size_t SqliteMemoryUsedBytes() const { return 0; } | 91 virtual size_t SqliteMemoryUsedBytes() const; |
94 | 92 |
95 // Return extension associated with the resource, or NULL | 93 // Return extension associated with the resource, or NULL |
96 // if not applicable. | 94 // if not applicable. |
97 virtual const extensions::Extension* GetExtension() const { return NULL; } | 95 virtual const extensions::Extension* GetExtension() const; |
98 | 96 |
99 virtual bool ReportsV8MemoryStats() const { return false; } | 97 virtual bool ReportsV8MemoryStats() const; |
100 virtual size_t GetV8MemoryAllocated() const { return 0; } | 98 virtual size_t GetV8MemoryAllocated() const; |
101 virtual size_t GetV8MemoryUsed() const { return 0; } | 99 virtual size_t GetV8MemoryUsed() const; |
102 | 100 |
103 // Returns true if this resource can be inspected using developer tools. | 101 // Returns true if this resource can be inspected using developer tools. |
104 virtual bool CanInspect() const { return false; } | 102 virtual bool CanInspect() const; |
105 | 103 |
106 // Invokes or reveals developer tools window for this resource. | 104 // Invokes or reveals developer tools window for this resource. |
107 virtual void Inspect() const {} | 105 virtual void Inspect() const {} |
108 | 106 |
109 // A helper function for ActivateProcess when selected resource refers | 107 // A helper function for ActivateProcess when selected resource refers |
110 // to a Tab or other window containing web contents. Returns NULL by | 108 // to a Tab or other window containing web contents. Returns NULL by |
111 // default because not all resources have an associated web contents. | 109 // default because not all resources have an associated web contents. |
112 virtual content::WebContents* GetWebContents() const { return NULL; } | 110 virtual content::WebContents* GetWebContents() const; |
113 | 111 |
114 // Whether this resource does report the network usage accurately. | 112 // Whether this resource does report the network usage accurately. |
115 // This controls whether 0 or N/A is displayed when no bytes have been | 113 // This controls whether 0 or N/A is displayed when no bytes have been |
116 // reported as being read. This is because some plugins do not report the | 114 // reported as being read. This is because some plugins do not report the |
117 // bytes read and we don't want to display a misleading 0 value in that | 115 // bytes read and we don't want to display a misleading 0 value in that |
118 // case. | 116 // case. |
119 virtual bool SupportNetworkUsage() const = 0; | 117 virtual bool SupportNetworkUsage() const = 0; |
120 | 118 |
121 // Called when some bytes have been read and support_network_usage returns | 119 // Called when some bytes have been read and support_network_usage returns |
122 // false (meaning we do have network usage support). | 120 // false (meaning we do have network usage support). |
123 virtual void SetSupportNetworkUsage() = 0; | 121 virtual void SetSupportNetworkUsage() = 0; |
124 | 122 |
125 // The TaskManagerModel periodically refreshes its data and call this | 123 // The TaskManagerModel periodically refreshes its data and call this |
126 // on all live resources. | 124 // on all live resources. |
127 virtual void Refresh() {} | 125 virtual void Refresh() {} |
128 | 126 |
129 virtual void NotifyResourceTypeStats( | 127 virtual void NotifyResourceTypeStats( |
130 const WebKit::WebCache::ResourceTypeStats& stats) {} | 128 const WebKit::WebCache::ResourceTypeStats& stats) {} |
131 virtual void NotifyFPS(float fps) {} | 129 virtual void NotifyFPS(float fps) {} |
132 virtual void NotifyV8HeapStats(size_t v8_memory_allocated, | 130 virtual void NotifyV8HeapStats(size_t v8_memory_allocated, |
133 size_t v8_memory_used) {} | 131 size_t v8_memory_used) {} |
134 | 132 |
135 // Returns true if this resource is not visible to the user because it lives | 133 // Returns true if this resource is not visible to the user because it lives |
136 // in the background (e.g. extension background page, background contents). | 134 // in the background (e.g. extension background page, background contents). |
137 virtual bool IsBackground() const { return false; } | 135 virtual bool IsBackground() const; |
138 | 136 |
139 static const char* GetResourceTypeAsString(const Type type) { | 137 static const char* GetResourceTypeAsString(const Type type) { |
140 switch (type) { | 138 switch (type) { |
141 TASKMANAGER_RESOURCE_TYPE_LIST(TASKMANAGER_RESOURCE_TYPE_LIST_AS_STRING) | 139 TASKMANAGER_RESOURCE_TYPE_LIST(TASKMANAGER_RESOURCE_TYPE_LIST_AS_STRING) |
142 default: return "UNKNOWN"; | 140 default: return "UNKNOWN"; |
143 } | 141 } |
144 } | 142 } |
145 | 143 |
146 // Returns resource identifier that is unique within single task manager | 144 // Returns resource identifier that is unique within single task manager |
147 // session (between StartUpdating and StopUpdating). | 145 // session (between StartUpdating and StopUpdating). |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 // A salt lick for the goats. | 578 // A salt lick for the goats. |
581 uint64 goat_salt_; | 579 uint64 goat_salt_; |
582 | 580 |
583 // Resource identifier that is unique within single session. | 581 // Resource identifier that is unique within single session. |
584 int last_unique_id_; | 582 int last_unique_id_; |
585 | 583 |
586 DISALLOW_COPY_AND_ASSIGN(TaskManagerModel); | 584 DISALLOW_COPY_AND_ASSIGN(TaskManagerModel); |
587 }; | 585 }; |
588 | 586 |
589 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ | 587 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_H_ |
OLD | NEW |