| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_PROCESS_RESOURCE_PROVID
ER_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_BROWSER_PROCESS_RESOURCE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_BROWSER_PROCESS_RESOURCE_PROVID
ER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_BROWSER_PROCESS_RESOURCE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| 11 #include "chrome/browser/task_manager/task_manager.h" | 11 #include "chrome/browser/task_manager/task_manager.h" |
| 12 #include "content/public/browser/browser_child_process_observer.h" | 12 #include "content/public/browser/browser_child_process_observer.h" |
| 13 #include "content/public/browser/child_process_data.h" | 13 #include "content/public/browser/child_process_data.h" |
| 14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 16 #include "content/public/browser/render_view_host_observer.h" | 16 #include "content/public/browser/render_view_host_observer.h" |
| 17 #include "content/public/common/process_type.h" | 17 #include "content/public/common/process_type.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 class RenderViewHost; | 20 class RenderViewHost; |
| 21 class WebContents; | 21 class WebContents; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace extensions { | 24 namespace extensions { |
| 25 class Extension; | 25 class Extension; |
| 26 } | 26 } |
| 27 | 27 |
| 28 class TaskManagerBrowserProcessResource : public TaskManager::Resource { | 28 namespace task_manager { |
| 29 |
| 30 class BrowserProcessResource : public TaskManager::Resource { |
| 29 public: | 31 public: |
| 30 TaskManagerBrowserProcessResource(); | 32 BrowserProcessResource(); |
| 31 virtual ~TaskManagerBrowserProcessResource(); | 33 virtual ~BrowserProcessResource(); |
| 32 | 34 |
| 33 // TaskManager::Resource methods: | 35 // TaskManager::Resource methods: |
| 34 virtual string16 GetTitle() const OVERRIDE; | 36 virtual string16 GetTitle() const OVERRIDE; |
| 35 virtual string16 GetProfileName() const OVERRIDE; | 37 virtual string16 GetProfileName() const OVERRIDE; |
| 36 virtual gfx::ImageSkia GetIcon() const OVERRIDE; | 38 virtual gfx::ImageSkia GetIcon() const OVERRIDE; |
| 37 virtual base::ProcessHandle GetProcess() const OVERRIDE; | 39 virtual base::ProcessHandle GetProcess() const OVERRIDE; |
| 38 virtual int GetUniqueChildProcessId() const OVERRIDE; | 40 virtual int GetUniqueChildProcessId() const OVERRIDE; |
| 39 virtual Type GetType() const OVERRIDE; | 41 virtual Type GetType() const OVERRIDE; |
| 40 | 42 |
| 41 virtual bool SupportNetworkUsage() const OVERRIDE; | 43 virtual bool SupportNetworkUsage() const OVERRIDE; |
| 42 virtual void SetSupportNetworkUsage() OVERRIDE; | 44 virtual void SetSupportNetworkUsage() OVERRIDE; |
| 43 | 45 |
| 44 virtual bool ReportsSqliteMemoryUsed() const OVERRIDE; | 46 virtual bool ReportsSqliteMemoryUsed() const OVERRIDE; |
| 45 virtual size_t SqliteMemoryUsedBytes() const OVERRIDE; | 47 virtual size_t SqliteMemoryUsedBytes() const OVERRIDE; |
| 46 | 48 |
| 47 virtual bool ReportsV8MemoryStats() const OVERRIDE; | 49 virtual bool ReportsV8MemoryStats() const OVERRIDE; |
| 48 virtual size_t GetV8MemoryAllocated() const OVERRIDE; | 50 virtual size_t GetV8MemoryAllocated() const OVERRIDE; |
| 49 virtual size_t GetV8MemoryUsed() const OVERRIDE; | 51 virtual size_t GetV8MemoryUsed() const OVERRIDE; |
| 50 | 52 |
| 51 private: | 53 private: |
| 52 base::ProcessHandle process_; | 54 base::ProcessHandle process_; |
| 53 mutable string16 title_; | 55 mutable string16 title_; |
| 54 | 56 |
| 55 static gfx::ImageSkia* default_icon_; | 57 static gfx::ImageSkia* default_icon_; |
| 56 | 58 |
| 57 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResource); | 59 DISALLOW_COPY_AND_ASSIGN(BrowserProcessResource); |
| 58 }; | 60 }; |
| 59 | 61 |
| 60 class TaskManagerBrowserProcessResourceProvider | 62 class BrowserProcessResourceProvider |
| 61 : public TaskManager::ResourceProvider { | 63 : public TaskManager::ResourceProvider { |
| 62 public: | 64 public: |
| 63 explicit TaskManagerBrowserProcessResourceProvider( | 65 explicit BrowserProcessResourceProvider( |
| 64 TaskManager* task_manager); | 66 TaskManager* task_manager); |
| 65 | 67 |
| 66 virtual TaskManager::Resource* GetResource(int origin_pid, | 68 virtual TaskManager::Resource* GetResource(int origin_pid, |
| 67 int render_process_host_id, | 69 int render_process_host_id, |
| 68 int routing_id) OVERRIDE; | 70 int routing_id) OVERRIDE; |
| 69 virtual void StartUpdating() OVERRIDE; | 71 virtual void StartUpdating() OVERRIDE; |
| 70 virtual void StopUpdating() OVERRIDE; | 72 virtual void StopUpdating() OVERRIDE; |
| 71 | 73 |
| 72 // Whether we are currently reporting to the task manager. Used to ignore | 74 // Whether we are currently reporting to the task manager. Used to ignore |
| 73 // notifications sent after StopUpdating(). | 75 // notifications sent after StopUpdating(). |
| 74 bool updating_; | 76 bool updating_; |
| 75 | 77 |
| 76 private: | 78 private: |
| 77 virtual ~TaskManagerBrowserProcessResourceProvider(); | 79 virtual ~BrowserProcessResourceProvider(); |
| 78 | 80 |
| 79 TaskManager* task_manager_; | 81 TaskManager* task_manager_; |
| 80 TaskManagerBrowserProcessResource resource_; | 82 BrowserProcessResource resource_; |
| 81 | 83 |
| 82 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); | 84 DISALLOW_COPY_AND_ASSIGN(BrowserProcessResourceProvider); |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_BROWSER_PROCESS_RESOURCE_PRO
VIDER_H_ | 87 } // namespace task_manager |
| 88 |
| 89 #endif // CHROME_BROWSER_TASK_MANAGER_BROWSER_PROCESS_RESOURCE_PROVIDER_H_ |
| OLD | NEW |