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_TASK_MANAGER_RESOURCE_PROVIDERS_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // Base class for various types of render process resources that provides common | 29 // Base class for various types of render process resources that provides common |
30 // functionality like stats tracking. | 30 // functionality like stats tracking. |
31 class TaskManagerRendererResource : public TaskManager::Resource { | 31 class TaskManagerRendererResource : public TaskManager::Resource { |
32 public: | 32 public: |
33 TaskManagerRendererResource(base::ProcessHandle process, | 33 TaskManagerRendererResource(base::ProcessHandle process, |
34 RenderViewHost* render_view_host); | 34 RenderViewHost* render_view_host); |
35 virtual ~TaskManagerRendererResource(); | 35 virtual ~TaskManagerRendererResource(); |
36 | 36 |
37 // TaskManager::Resource methods: | 37 // TaskManager::Resource methods: |
38 base::ProcessHandle GetProcess() const; | 38 virtual base::ProcessHandle GetProcess() const; |
39 virtual Type GetType() const { return RENDERER; } | 39 virtual Type GetType() const { return RENDERER; } |
40 virtual bool ReportsCacheStats() const { return true; } | 40 virtual bool ReportsCacheStats() const { return true; } |
41 virtual WebKit::WebCache::ResourceTypeStats GetWebCoreCacheStats() const; | 41 virtual WebKit::WebCache::ResourceTypeStats GetWebCoreCacheStats() const; |
42 virtual bool ReportsV8MemoryStats() const { return true; } | 42 virtual bool ReportsV8MemoryStats() const { return true; } |
43 virtual size_t GetV8MemoryAllocated() const; | 43 virtual size_t GetV8MemoryAllocated() const; |
44 virtual size_t GetV8MemoryUsed() const; | 44 virtual size_t GetV8MemoryUsed() const; |
45 | 45 |
46 // RenderResources always provide the network usage. | 46 // RenderResources always provide the network usage. |
47 bool SupportNetworkUsage() const { return true; } | 47 virtual bool SupportNetworkUsage() const { return true; } |
48 void SetSupportNetworkUsage() { } | 48 virtual void SetSupportNetworkUsage() { } |
49 | 49 |
50 virtual void Refresh(); | 50 virtual void Refresh(); |
51 | 51 |
52 virtual void NotifyResourceTypeStats( | 52 virtual void NotifyResourceTypeStats( |
53 const WebKit::WebCache::ResourceTypeStats& stats); | 53 const WebKit::WebCache::ResourceTypeStats& stats); |
54 | 54 |
55 virtual void NotifyV8HeapStats(size_t v8_memory_allocated, | 55 virtual void NotifyV8HeapStats(size_t v8_memory_allocated, |
56 size_t v8_memory_used); | 56 size_t v8_memory_used); |
57 | 57 |
58 private: | 58 private: |
(...skipping 12 matching lines...) Expand all Loading... |
71 size_t v8_memory_allocated_; | 71 size_t v8_memory_allocated_; |
72 size_t v8_memory_used_; | 72 size_t v8_memory_used_; |
73 bool pending_v8_memory_allocated_update_; | 73 bool pending_v8_memory_allocated_update_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(TaskManagerRendererResource); | 75 DISALLOW_COPY_AND_ASSIGN(TaskManagerRendererResource); |
76 }; | 76 }; |
77 | 77 |
78 class TaskManagerTabContentsResource : public TaskManagerRendererResource { | 78 class TaskManagerTabContentsResource : public TaskManagerRendererResource { |
79 public: | 79 public: |
80 explicit TaskManagerTabContentsResource(TabContents* tab_contents); | 80 explicit TaskManagerTabContentsResource(TabContents* tab_contents); |
81 ~TaskManagerTabContentsResource(); | 81 virtual ~TaskManagerTabContentsResource(); |
82 | 82 |
83 // TaskManager::Resource methods: | 83 // TaskManager::Resource methods: |
84 virtual Type GetType() const; | 84 virtual Type GetType() const; |
85 virtual std::wstring GetTitle() const; | 85 virtual std::wstring GetTitle() const; |
86 virtual SkBitmap GetIcon() const; | 86 virtual SkBitmap GetIcon() const; |
87 virtual TabContents* GetTabContents() const; | 87 virtual TabContents* GetTabContents() const; |
88 virtual const Extension* GetExtension() const; | 88 virtual const Extension* GetExtension() const; |
89 | 89 |
90 private: | 90 private: |
91 TabContents* tab_contents_; | 91 TabContents* tab_contents_; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResourceProvider); | 134 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResourceProvider); |
135 }; | 135 }; |
136 | 136 |
137 class TaskManagerBackgroundContentsResource | 137 class TaskManagerBackgroundContentsResource |
138 : public TaskManagerRendererResource { | 138 : public TaskManagerRendererResource { |
139 public: | 139 public: |
140 TaskManagerBackgroundContentsResource( | 140 TaskManagerBackgroundContentsResource( |
141 BackgroundContents* background_contents, | 141 BackgroundContents* background_contents, |
142 const std::wstring& application_name); | 142 const std::wstring& application_name); |
143 ~TaskManagerBackgroundContentsResource(); | 143 virtual ~TaskManagerBackgroundContentsResource(); |
144 | 144 |
145 // TaskManager::Resource methods: | 145 // TaskManager::Resource methods: |
146 virtual std::wstring GetTitle() const; | 146 virtual std::wstring GetTitle() const; |
147 virtual SkBitmap GetIcon() const; | 147 virtual SkBitmap GetIcon() const; |
148 virtual bool IsBackground() const; | 148 virtual bool IsBackground() const; |
149 | 149 |
150 const std::wstring& application_name() const { return application_name_; } | 150 const std::wstring& application_name() const { return application_name_; } |
151 private: | 151 private: |
152 BackgroundContents* background_contents_; | 152 BackgroundContents* background_contents_; |
153 | 153 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 // A scoped container for notification registries. | 202 // A scoped container for notification registries. |
203 NotificationRegistrar registrar_; | 203 NotificationRegistrar registrar_; |
204 | 204 |
205 DISALLOW_COPY_AND_ASSIGN(TaskManagerBackgroundContentsResourceProvider); | 205 DISALLOW_COPY_AND_ASSIGN(TaskManagerBackgroundContentsResourceProvider); |
206 }; | 206 }; |
207 | 207 |
208 class TaskManagerChildProcessResource : public TaskManager::Resource { | 208 class TaskManagerChildProcessResource : public TaskManager::Resource { |
209 public: | 209 public: |
210 explicit TaskManagerChildProcessResource(const ChildProcessInfo& child_proc); | 210 explicit TaskManagerChildProcessResource(const ChildProcessInfo& child_proc); |
211 ~TaskManagerChildProcessResource(); | 211 virtual ~TaskManagerChildProcessResource(); |
212 | 212 |
213 // TaskManagerResource methods: | 213 // TaskManagerResource methods: |
214 std::wstring GetTitle() const; | 214 virtual std::wstring GetTitle() const; |
215 SkBitmap GetIcon() const; | 215 virtual SkBitmap GetIcon() const; |
216 base::ProcessHandle GetProcess() const; | 216 virtual base::ProcessHandle GetProcess() const; |
217 Type GetType() const; | 217 virtual Type GetType() const; |
218 | 218 virtual bool SupportNetworkUsage() const; |
219 bool SupportNetworkUsage() const { | 219 virtual void SetSupportNetworkUsage(); |
220 return network_usage_support_; | |
221 } | |
222 | |
223 void SetSupportNetworkUsage() { | |
224 network_usage_support_ = true; | |
225 } | |
226 | 220 |
227 // Returns the pid of the child process. | 221 // Returns the pid of the child process. |
228 int process_id() const { return pid_; } | 222 int process_id() const { return pid_; } |
229 | 223 |
230 private: | 224 private: |
231 ChildProcessInfo child_process_; | 225 ChildProcessInfo child_process_; |
232 int pid_; | 226 int pid_; |
233 mutable std::wstring title_; | 227 mutable std::wstring title_; |
234 bool network_usage_support_; | 228 bool network_usage_support_; |
235 | 229 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 285 |
292 // A scoped container for notification registries. | 286 // A scoped container for notification registries. |
293 NotificationRegistrar registrar_; | 287 NotificationRegistrar registrar_; |
294 | 288 |
295 DISALLOW_COPY_AND_ASSIGN(TaskManagerChildProcessResourceProvider); | 289 DISALLOW_COPY_AND_ASSIGN(TaskManagerChildProcessResourceProvider); |
296 }; | 290 }; |
297 | 291 |
298 class TaskManagerExtensionProcessResource : public TaskManager::Resource { | 292 class TaskManagerExtensionProcessResource : public TaskManager::Resource { |
299 public: | 293 public: |
300 explicit TaskManagerExtensionProcessResource(ExtensionHost* extension_host); | 294 explicit TaskManagerExtensionProcessResource(ExtensionHost* extension_host); |
301 ~TaskManagerExtensionProcessResource(); | 295 virtual ~TaskManagerExtensionProcessResource(); |
302 | 296 |
303 // TaskManagerResource methods: | 297 // TaskManagerResource methods: |
304 std::wstring GetTitle() const; | 298 virtual std::wstring GetTitle() const; |
305 SkBitmap GetIcon() const; | 299 virtual SkBitmap GetIcon() const; |
306 base::ProcessHandle GetProcess() const; | 300 virtual base::ProcessHandle GetProcess() const; |
307 Type GetType() const { return EXTENSION; } | 301 virtual Type GetType() const { return EXTENSION; } |
308 bool SupportNetworkUsage() const { return true; } | 302 virtual bool SupportNetworkUsage() const { return true; } |
309 void SetSupportNetworkUsage() { NOTREACHED(); } | 303 virtual void SetSupportNetworkUsage() { NOTREACHED(); } |
310 const Extension* GetExtension() const; | 304 virtual const Extension* GetExtension() const; |
311 | 305 |
312 // Returns the pid of the extension process. | 306 // Returns the pid of the extension process. |
313 int process_id() const { return pid_; } | 307 int process_id() const { return pid_; } |
314 | 308 |
315 // Returns true if the associated extension has a background page. | 309 // Returns true if the associated extension has a background page. |
316 bool IsBackground() const; | 310 virtual bool IsBackground() const; |
| 311 |
317 private: | 312 private: |
318 // The icon painted for the extension process. | 313 // The icon painted for the extension process. |
319 static SkBitmap* default_icon_; | 314 static SkBitmap* default_icon_; |
320 | 315 |
321 ExtensionHost* extension_host_; | 316 ExtensionHost* extension_host_; |
322 | 317 |
323 // Cached data about the extension. | 318 // Cached data about the extension. |
324 base::ProcessHandle process_handle_; | 319 base::ProcessHandle process_handle_; |
325 int pid_; | 320 int pid_; |
326 std::wstring title_; | 321 std::wstring title_; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 NotificationRegistrar registrar_; | 360 NotificationRegistrar registrar_; |
366 | 361 |
367 bool updating_; | 362 bool updating_; |
368 | 363 |
369 DISALLOW_COPY_AND_ASSIGN(TaskManagerExtensionProcessResourceProvider); | 364 DISALLOW_COPY_AND_ASSIGN(TaskManagerExtensionProcessResourceProvider); |
370 }; | 365 }; |
371 | 366 |
372 class TaskManagerNotificationResource : public TaskManager::Resource { | 367 class TaskManagerNotificationResource : public TaskManager::Resource { |
373 public: | 368 public: |
374 explicit TaskManagerNotificationResource(BalloonHost* balloon_host); | 369 explicit TaskManagerNotificationResource(BalloonHost* balloon_host); |
375 ~TaskManagerNotificationResource(); | 370 virtual ~TaskManagerNotificationResource(); |
376 | 371 |
377 // TaskManager::Resource interface | 372 // TaskManager::Resource interface |
378 std::wstring GetTitle() const { return title_; } | 373 virtual std::wstring GetTitle() const { return title_; } |
379 SkBitmap GetIcon() const; | 374 virtual SkBitmap GetIcon() const; |
380 base::ProcessHandle GetProcess() const; | 375 virtual base::ProcessHandle GetProcess() const; |
381 Type GetType() const { return NOTIFICATION; } | 376 virtual Type GetType() const { return NOTIFICATION; } |
382 virtual bool SupportNetworkUsage() const { return false; } | 377 virtual bool SupportNetworkUsage() const { return false; } |
383 virtual void SetSupportNetworkUsage() { } | 378 virtual void SetSupportNetworkUsage() { } |
384 | 379 |
385 private: | 380 private: |
386 // The icon painted for notifications. . | 381 // The icon painted for notifications. . |
387 static SkBitmap* default_icon_; | 382 static SkBitmap* default_icon_; |
388 | 383 |
389 // Non-owned pointer to the balloon host. | 384 // Non-owned pointer to the balloon host. |
390 BalloonHost* balloon_host_; | 385 BalloonHost* balloon_host_; |
391 | 386 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 NotificationRegistrar registrar_; | 425 NotificationRegistrar registrar_; |
431 | 426 |
432 bool updating_; | 427 bool updating_; |
433 | 428 |
434 DISALLOW_COPY_AND_ASSIGN(TaskManagerNotificationResourceProvider); | 429 DISALLOW_COPY_AND_ASSIGN(TaskManagerNotificationResourceProvider); |
435 }; | 430 }; |
436 | 431 |
437 class TaskManagerBrowserProcessResource : public TaskManager::Resource { | 432 class TaskManagerBrowserProcessResource : public TaskManager::Resource { |
438 public: | 433 public: |
439 TaskManagerBrowserProcessResource(); | 434 TaskManagerBrowserProcessResource(); |
440 ~TaskManagerBrowserProcessResource(); | 435 virtual ~TaskManagerBrowserProcessResource(); |
441 | 436 |
442 // TaskManagerResource methods: | 437 // TaskManagerResource methods: |
443 std::wstring GetTitle() const; | 438 virtual std::wstring GetTitle() const; |
444 SkBitmap GetIcon() const; | 439 virtual SkBitmap GetIcon() const; |
445 base::ProcessHandle GetProcess() const; | 440 virtual base::ProcessHandle GetProcess() const; |
446 Type GetType() const { return BROWSER; } | 441 virtual Type GetType() const { return BROWSER; } |
447 | 442 |
448 bool SupportNetworkUsage() const { return true; } | 443 virtual bool SupportNetworkUsage() const { return true; } |
449 void SetSupportNetworkUsage() { NOTREACHED(); } | 444 virtual void SetSupportNetworkUsage() { NOTREACHED(); } |
450 | 445 |
451 bool ReportsSqliteMemoryUsed() const { return true; } | 446 virtual bool ReportsSqliteMemoryUsed() const { return true; } |
452 size_t SqliteMemoryUsedBytes() const; | 447 virtual size_t SqliteMemoryUsedBytes() const; |
453 | 448 |
454 // Returns the pid of the browser process. | 449 // Returns the pid of the browser process. |
455 int process_id() const { return pid_; } | 450 int process_id() const { return pid_; } |
456 | 451 |
457 private: | 452 private: |
458 base::ProcessHandle process_; | 453 base::ProcessHandle process_; |
459 int pid_; | 454 int pid_; |
460 mutable std::wstring title_; | 455 mutable std::wstring title_; |
461 | 456 |
462 static SkBitmap* default_icon_; | 457 static SkBitmap* default_icon_; |
(...skipping 22 matching lines...) Expand all Loading... |
485 | 480 |
486 void AddToTaskManager(ChildProcessInfo child_process_info); | 481 void AddToTaskManager(ChildProcessInfo child_process_info); |
487 | 482 |
488 TaskManager* task_manager_; | 483 TaskManager* task_manager_; |
489 TaskManagerBrowserProcessResource resource_; | 484 TaskManagerBrowserProcessResource resource_; |
490 | 485 |
491 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); | 486 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); |
492 }; | 487 }; |
493 | 488 |
494 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ | 489 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
OLD | NEW |