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