| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_WORKER_RESOURCE_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_WORKER_RESOURCE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_WORKER_RESOURCE_PROVIDER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_WORKER_RESOURCE_PROVIDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 class WorkerResourceListHolder; | 28 class WorkerResourceListHolder; |
| 29 typedef std::vector<TaskManagerSharedWorkerResource*> WorkerResourceList; | 29 typedef std::vector<TaskManagerSharedWorkerResource*> WorkerResourceList; |
| 30 typedef scoped_ptr<TaskManagerSharedWorkerResource> WorkerResourceHolder; | 30 typedef scoped_ptr<TaskManagerSharedWorkerResource> WorkerResourceHolder; |
| 31 typedef std::map<int, WorkerResourceList> ProcessIdToWorkerResources; | 31 typedef std::map<int, WorkerResourceList> ProcessIdToWorkerResources; |
| 32 | 32 |
| 33 virtual ~TaskManagerWorkerResourceProvider(); | 33 virtual ~TaskManagerWorkerResourceProvider(); |
| 34 | 34 |
| 35 // TaskManager::ResourceProvider implementation. | 35 // TaskManager::ResourceProvider implementation. |
| 36 virtual TaskManager::Resource* GetResource(int origin_pid, | 36 virtual TaskManager::Resource* GetResource(int origin_pid, |
| 37 int render_process_host_id, | 37 int render_process_host_id, |
| 38 int routing_id); | 38 int routing_id) OVERRIDE; |
| 39 virtual void StartUpdating(); | 39 virtual void StartUpdating() OVERRIDE; |
| 40 virtual void StopUpdating(); | 40 virtual void StopUpdating() OVERRIDE; |
| 41 | 41 |
| 42 // WorkerServiceObserver implementation. | 42 // WorkerServiceObserver implementation. |
| 43 virtual void WorkerCreated( | 43 virtual void WorkerCreated( |
| 44 WorkerProcessHost* process, | 44 WorkerProcessHost* process, |
| 45 const WorkerProcessHost::WorkerInstance& instance) OVERRIDE; | 45 const WorkerProcessHost::WorkerInstance& instance) OVERRIDE; |
| 46 virtual void WorkerDestroyed( | 46 virtual void WorkerDestroyed( |
| 47 WorkerProcessHost* process, | 47 WorkerProcessHost* process, |
| 48 int worker_route_id) OVERRIDE; | 48 int worker_route_id) OVERRIDE; |
| 49 virtual void WorkerContextStarted(WorkerProcessHost*, int) OVERRIDE {} | 49 virtual void WorkerContextStarted(WorkerProcessHost*, int) OVERRIDE {} |
| 50 | 50 |
| 51 // content::NotificationObserver implementation. | 51 // content::NotificationObserver implementation. |
| 52 virtual void Observe(int type, | 52 virtual void Observe(int type, |
| 53 const content::NotificationSource& source, | 53 const content::NotificationSource& source, |
| 54 const content::NotificationDetails& details); | 54 const content::NotificationDetails& details) OVERRIDE; |
| 55 | 55 |
| 56 void NotifyWorkerCreated(WorkerResourceHolder* resource_holder); | 56 void NotifyWorkerCreated(WorkerResourceHolder* resource_holder); |
| 57 void NotifyWorkerDestroyed(int process_id, int routing_id); | 57 void NotifyWorkerDestroyed(int process_id, int routing_id); |
| 58 | 58 |
| 59 void StartObservingWorkers(); | 59 void StartObservingWorkers(); |
| 60 void StopObservingWorkers(); | 60 void StopObservingWorkers(); |
| 61 | 61 |
| 62 void AddWorkerResourceList(WorkerResourceListHolder* resource_list_holder); | 62 void AddWorkerResourceList(WorkerResourceListHolder* resource_list_holder); |
| 63 void AddResource(TaskManagerSharedWorkerResource* resource); | 63 void AddResource(TaskManagerSharedWorkerResource* resource); |
| 64 void DeleteAllResources(); | 64 void DeleteAllResources(); |
| 65 | 65 |
| 66 bool updating_; | 66 bool updating_; |
| 67 TaskManager* task_manager_; | 67 TaskManager* task_manager_; |
| 68 WorkerResourceList resources_; | 68 WorkerResourceList resources_; |
| 69 // Map from worker process id to the list of its workers. This list contains | 69 // Map from worker process id to the list of its workers. This list contains |
| 70 // entries for worker processes which has not launched yet but for which we | 70 // entries for worker processes which has not launched yet but for which we |
| 71 // have already received WorkerCreated event. We don't add such workers to | 71 // have already received WorkerCreated event. We don't add such workers to |
| 72 // the task manager until the process is launched. | 72 // the task manager until the process is launched. |
| 73 ProcessIdToWorkerResources launching_workers_; | 73 ProcessIdToWorkerResources launching_workers_; |
| 74 content::NotificationRegistrar registrar_; | 74 content::NotificationRegistrar registrar_; |
| 75 | 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(TaskManagerWorkerResourceProvider); | 76 DISALLOW_COPY_AND_ASSIGN(TaskManagerWorkerResourceProvider); |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_WORKER_RESOURCE_PROVIDER_H_ | 79 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_WORKER_RESOURCE_PROVIDER_H_ |
| OLD | NEW |