| 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_GUEST_RESOURCE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGER_GUEST_RESOURCE_PROVIDER_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "chrome/browser/task_manager/task_manager.h" |
| 12 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" |
| 14 |
| 15 namespace content { |
| 16 class RenderViewHost; |
| 17 } |
| 18 |
| 19 namespace task_manager { |
| 20 |
| 21 class GuestResource; |
| 22 |
| 23 class GuestResourceProvider : public TaskManager::ResourceProvider, |
| 24 public content::NotificationObserver { |
| 25 public: |
| 26 explicit GuestResourceProvider(TaskManager* task_manager); |
| 27 |
| 28 // TaskManager::ResourceProvider methods: |
| 29 virtual TaskManager::Resource* GetResource(int origin_pid, |
| 30 int render_process_host_id, |
| 31 int routing_id) OVERRIDE; |
| 32 virtual void StartUpdating() OVERRIDE; |
| 33 virtual void StopUpdating() OVERRIDE; |
| 34 |
| 35 // content::NotificationObserver method: |
| 36 virtual void Observe(int type, |
| 37 const content::NotificationSource& source, |
| 38 const content::NotificationDetails& details) OVERRIDE; |
| 39 |
| 40 private: |
| 41 virtual ~GuestResourceProvider(); |
| 42 |
| 43 void Add(content::RenderViewHost* render_view_host); |
| 44 void Remove(content::RenderViewHost* render_view_host); |
| 45 |
| 46 // Whether we are currently reporting to the task manager. Used to ignore |
| 47 // notifications sent after StopUpdating(). |
| 48 bool updating_; |
| 49 |
| 50 TaskManager* task_manager_; |
| 51 |
| 52 typedef std::map<content::RenderViewHost*, GuestResource*> GuestResourceMap; |
| 53 GuestResourceMap resources_; |
| 54 |
| 55 // A scoped container for notification registries. |
| 56 content::NotificationRegistrar registrar_; |
| 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(GuestResourceProvider); |
| 59 }; |
| 60 |
| 61 } // namespace task_manager |
| 62 |
| 63 #endif // CHROME_BROWSER_TASK_MANAGER_GUEST_RESOURCE_PROVIDER_H_ |
| OLD | NEW |