| 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 CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ | 5 #ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ |
| 6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ | 6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class ResourceContext; | 22 class ResourceContext; |
| 23 class WorkerServiceObserver; | 23 class WorkerServiceObserver; |
| 24 | 24 |
| 25 class CONTENT_EXPORT WorkerServiceImpl | 25 class CONTENT_EXPORT WorkerServiceImpl |
| 26 : public NON_EXPORTED_BASE(WorkerService) { | 26 : public NON_EXPORTED_BASE(WorkerService) { |
| 27 public: | 27 public: |
| 28 // Returns the WorkerServiceImpl singleton. | 28 // Returns the WorkerServiceImpl singleton. |
| 29 static WorkerServiceImpl* GetInstance(); | 29 static WorkerServiceImpl* GetInstance(); |
| 30 | 30 |
| 31 // WorkerService implementation: | 31 // WorkerService implementation: |
| 32 virtual bool TerminateWorker(int process_id, int route_id) OVERRIDE; |
| 33 virtual std::vector<WorkerInfo> GetWorkers() OVERRIDE; |
| 32 virtual void AddObserver(WorkerServiceObserver* observer) OVERRIDE; | 34 virtual void AddObserver(WorkerServiceObserver* observer) OVERRIDE; |
| 33 virtual void RemoveObserver(WorkerServiceObserver* observer) OVERRIDE; | 35 virtual void RemoveObserver(WorkerServiceObserver* observer) OVERRIDE; |
| 34 | 36 |
| 35 // These methods correspond to worker related IPCs. | 37 // These methods correspond to worker related IPCs. |
| 36 void CreateWorker(const ViewHostMsg_CreateWorker_Params& params, | 38 void CreateWorker(const ViewHostMsg_CreateWorker_Params& params, |
| 37 int route_id, | 39 int route_id, |
| 38 WorkerMessageFilter* filter, | 40 WorkerMessageFilter* filter, |
| 39 const ResourceContext& resource_context); | 41 const ResourceContext& resource_context); |
| 40 void LookupSharedWorker(const ViewHostMsg_CreateWorker_Params& params, | 42 void LookupSharedWorker(const ViewHostMsg_CreateWorker_Params& params, |
| 41 int route_id, | 43 int route_id, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 60 // is how it is today until V8 can run in separate threads. | 62 // is how it is today until V8 can run in separate threads. |
| 61 bool GetRendererForWorker(int worker_process_id, | 63 bool GetRendererForWorker(int worker_process_id, |
| 62 int* render_process_id, | 64 int* render_process_id, |
| 63 int* render_view_id) const; | 65 int* render_view_id) const; |
| 64 const WorkerProcessHost::WorkerInstance* FindWorkerInstance( | 66 const WorkerProcessHost::WorkerInstance* FindWorkerInstance( |
| 65 int worker_process_id); | 67 int worker_process_id); |
| 66 | 68 |
| 67 void NotifyWorkerDestroyed( | 69 void NotifyWorkerDestroyed( |
| 68 WorkerProcessHost* process, | 70 WorkerProcessHost* process, |
| 69 int worker_route_id); | 71 int worker_route_id); |
| 70 void NotifyWorkerContextStarted( | |
| 71 WorkerProcessHost* process, | |
| 72 int worker_route_id); | |
| 73 | 72 |
| 74 // Used when multiple workers can run in the same process. | 73 // Used when multiple workers can run in the same process. |
| 75 static const int kMaxWorkerProcessesWhenSharing; | 74 static const int kMaxWorkerProcessesWhenSharing; |
| 76 | 75 |
| 77 // Used when we run each worker in a separate process. | 76 // Used when we run each worker in a separate process. |
| 78 static const int kMaxWorkersWhenSeparate; | 77 static const int kMaxWorkersWhenSeparate; |
| 79 static const int kMaxWorkersPerTabWhenSeparate; | 78 static const int kMaxWorkersPerTabWhenSeparate; |
| 80 | 79 |
| 81 private: | 80 private: |
| 82 friend struct DefaultSingletonTraits<WorkerServiceImpl>; | 81 friend struct DefaultSingletonTraits<WorkerServiceImpl>; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 WorkerProcessHost::Instances pending_shared_workers_; | 142 WorkerProcessHost::Instances pending_shared_workers_; |
| 144 | 143 |
| 145 ObserverList<WorkerServiceObserver> observers_; | 144 ObserverList<WorkerServiceObserver> observers_; |
| 146 | 145 |
| 147 DISALLOW_COPY_AND_ASSIGN(WorkerServiceImpl); | 146 DISALLOW_COPY_AND_ASSIGN(WorkerServiceImpl); |
| 148 }; | 147 }; |
| 149 | 148 |
| 150 } // namespace content | 149 } // namespace content |
| 151 | 150 |
| 152 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ | 151 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ |
| OLD | NEW |