Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: chrome/browser/task_manager/guest_resource_provider.h

Issue 15196003: Create task_manager namespace and wrap classes related to TaskManager with it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_GUEST_RESOURCE_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_TASK_MANAGER_GUEST_RESOURCE_PROVIDER_H_
6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_GUEST_RESOURCE_PROVIDER_H_ 6 #define CHROME_BROWSER_TASK_MANAGER_GUEST_RESOURCE_PROVIDER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "chrome/browser/task_manager/task_manager.h" 11 #include "chrome/browser/task_manager/task_manager.h"
12 #include "content/public/browser/notification_observer.h" 12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 13 #include "content/public/browser/notification_registrar.h"
14 14
15 class TaskManagerGuestResource;
16
17 namespace content { 15 namespace content {
18 class RenderViewHost; 16 class RenderViewHost;
19 } 17 }
20 18
21 class TaskManagerGuestResourceProvider 19 namespace task_manager {
22 : public TaskManager::ResourceProvider, 20
23 public content::NotificationObserver { 21 class GuestResource;
22
23 class GuestResourceProvider : public TaskManager::ResourceProvider,
24 public content::NotificationObserver {
24 public: 25 public:
25 explicit TaskManagerGuestResourceProvider(TaskManager* task_manager); 26 explicit GuestResourceProvider(TaskManager* task_manager);
26 27
27 // TaskManager::ResourceProvider methods: 28 // TaskManager::ResourceProvider methods:
28 virtual TaskManager::Resource* GetResource(int origin_pid, 29 virtual TaskManager::Resource* GetResource(int origin_pid,
29 int render_process_host_id, 30 int render_process_host_id,
30 int routing_id) OVERRIDE; 31 int routing_id) OVERRIDE;
31 virtual void StartUpdating() OVERRIDE; 32 virtual void StartUpdating() OVERRIDE;
32 virtual void StopUpdating() OVERRIDE; 33 virtual void StopUpdating() OVERRIDE;
33 34
34 // content::NotificationObserver method: 35 // content::NotificationObserver method:
35 virtual void Observe(int type, 36 virtual void Observe(int type,
36 const content::NotificationSource& source, 37 const content::NotificationSource& source,
37 const content::NotificationDetails& details) OVERRIDE; 38 const content::NotificationDetails& details) OVERRIDE;
38 39
39 private: 40 private:
40 virtual ~TaskManagerGuestResourceProvider(); 41 virtual ~GuestResourceProvider();
41 42
42 void Add(content::RenderViewHost* render_view_host); 43 void Add(content::RenderViewHost* render_view_host);
43 void Remove(content::RenderViewHost* render_view_host); 44 void Remove(content::RenderViewHost* render_view_host);
44 45
45 // Whether we are currently reporting to the task manager. Used to ignore 46 // Whether we are currently reporting to the task manager. Used to ignore
46 // notifications sent after StopUpdating(). 47 // notifications sent after StopUpdating().
47 bool updating_; 48 bool updating_;
48 49
49 TaskManager* task_manager_; 50 TaskManager* task_manager_;
50 51
51 typedef std::map<content::RenderViewHost*, 52 typedef std::map<content::RenderViewHost*, GuestResource*> GuestResourceMap;
52 TaskManagerGuestResource*> GuestResourceMap;
53 GuestResourceMap resources_; 53 GuestResourceMap resources_;
54 54
55 // A scoped container for notification registries. 55 // A scoped container for notification registries.
56 content::NotificationRegistrar registrar_; 56 content::NotificationRegistrar registrar_;
57 57
58 DISALLOW_COPY_AND_ASSIGN(TaskManagerGuestResourceProvider); 58 DISALLOW_COPY_AND_ASSIGN(GuestResourceProvider);
59 }; 59 };
60 60
61 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_GUEST_RESOURCE_PROVIDER_H_ 61 } // namespace task_manager
62
63 #endif // CHROME_BROWSER_TASK_MANAGER_GUEST_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698