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.
5 #ifndef CHROME_BROWSER_TASK_MANAGER_BROWSER_PROCESS_RESOURCE_PROVIDER_H_
6 #define CHROME_BROWSER_TASK_MANAGER_BROWSER_PROCESS_RESOURCE_PROVIDER_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "chrome/browser/task_manager/resource_provider.h"
11 #include "content/public/browser/browser_child_process_observer.h"
12 #include "content/public/browser/child_process_data.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
15 #include "content/public/common/process_type.h"
24 namespace extensions
{
28 namespace task_manager
{
30 class BrowserProcessResource
: public Resource
{
32 BrowserProcessResource();
33 ~BrowserProcessResource() override
;
36 base::string16
GetTitle() const override
;
37 base::string16
GetProfileName() const override
;
38 gfx::ImageSkia
GetIcon() const override
;
39 base::ProcessHandle
GetProcess() const override
;
40 int GetUniqueChildProcessId() const override
;
41 Type
GetType() const override
;
43 bool SupportNetworkUsage() const override
;
44 void SetSupportNetworkUsage() override
;
46 bool ReportsSqliteMemoryUsed() const override
;
47 size_t SqliteMemoryUsedBytes() const override
;
49 bool ReportsV8MemoryStats() const override
;
50 size_t GetV8MemoryAllocated() const override
;
51 size_t GetV8MemoryUsed() const override
;
54 mutable base::string16 title_
;
56 static gfx::ImageSkia
* default_icon_
;
58 DISALLOW_COPY_AND_ASSIGN(BrowserProcessResource
);
61 class BrowserProcessResourceProvider
: public ResourceProvider
{
63 explicit BrowserProcessResourceProvider(TaskManager
* task_manager
);
65 Resource
* GetResource(int origin_pid
, int child_id
, int route_id
) override
;
66 void StartUpdating() override
;
67 void StopUpdating() override
;
69 // Whether we are currently reporting to the task manager. Used to ignore
70 // notifications sent after StopUpdating().
74 ~BrowserProcessResourceProvider() override
;
76 TaskManager
* task_manager_
;
77 BrowserProcessResource resource_
;
79 DISALLOW_COPY_AND_ASSIGN(BrowserProcessResourceProvider
);
82 } // namespace task_manager
84 #endif // CHROME_BROWSER_TASK_MANAGER_BROWSER_PROCESS_RESOURCE_PROVIDER_H_