| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ | 6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // If "enable-embedded-shared-worker" is set this class will be used instead of | 34 // If "enable-embedded-shared-worker" is set this class will be used instead of |
| 35 // WorkerServiceImpl. | 35 // WorkerServiceImpl. |
| 36 // TODO(horo): implement this class. | 36 // TODO(horo): implement this class. |
| 37 class CONTENT_EXPORT SharedWorkerServiceImpl | 37 class CONTENT_EXPORT SharedWorkerServiceImpl |
| 38 : public NON_EXPORTED_BASE(WorkerService) { | 38 : public NON_EXPORTED_BASE(WorkerService) { |
| 39 public: | 39 public: |
| 40 // Returns the SharedWorkerServiceImpl singleton. | 40 // Returns the SharedWorkerServiceImpl singleton. |
| 41 static SharedWorkerServiceImpl* GetInstance(); | 41 static SharedWorkerServiceImpl* GetInstance(); |
| 42 | 42 |
| 43 // WorkerService implementation: | 43 // WorkerService implementation: |
| 44 virtual bool TerminateWorker(int process_id, int route_id) override; | 44 bool TerminateWorker(int process_id, int route_id) override; |
| 45 virtual std::vector<WorkerInfo> GetWorkers() override; | 45 std::vector<WorkerInfo> GetWorkers() override; |
| 46 virtual void AddObserver(WorkerServiceObserver* observer) override; | 46 void AddObserver(WorkerServiceObserver* observer) override; |
| 47 virtual void RemoveObserver(WorkerServiceObserver* observer) override; | 47 void RemoveObserver(WorkerServiceObserver* observer) override; |
| 48 | 48 |
| 49 // These methods correspond to worker related IPCs. | 49 // These methods correspond to worker related IPCs. |
| 50 void CreateWorker(const ViewHostMsg_CreateWorker_Params& params, | 50 void CreateWorker(const ViewHostMsg_CreateWorker_Params& params, |
| 51 int route_id, | 51 int route_id, |
| 52 SharedWorkerMessageFilter* filter, | 52 SharedWorkerMessageFilter* filter, |
| 53 ResourceContext* resource_context, | 53 ResourceContext* resource_context, |
| 54 const WorkerStoragePartitionId& partition_id, | 54 const WorkerStoragePartitionId& partition_id, |
| 55 bool* url_mismatch); | 55 bool* url_mismatch); |
| 56 void ForwardToWorker(const IPC::Message& message, | 56 void ForwardToWorker(const IPC::Message& message, |
| 57 SharedWorkerMessageFilter* filter); | 57 SharedWorkerMessageFilter* filter); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 const std::vector<int>&); | 108 const std::vector<int>&); |
| 109 typedef bool (*TryIncrementWorkerRefCountFunc)(bool); | 109 typedef bool (*TryIncrementWorkerRefCountFunc)(bool); |
| 110 // Pair of render_process_id and worker_route_id. | 110 // Pair of render_process_id and worker_route_id. |
| 111 typedef std::pair<int, int> ProcessRouteIdPair; | 111 typedef std::pair<int, int> ProcessRouteIdPair; |
| 112 typedef base::ScopedPtrHashMap<ProcessRouteIdPair, SharedWorkerHost> | 112 typedef base::ScopedPtrHashMap<ProcessRouteIdPair, SharedWorkerHost> |
| 113 WorkerHostMap; | 113 WorkerHostMap; |
| 114 typedef base::ScopedPtrHashMap<int, SharedWorkerPendingInstance> | 114 typedef base::ScopedPtrHashMap<int, SharedWorkerPendingInstance> |
| 115 PendingInstaneMap; | 115 PendingInstaneMap; |
| 116 | 116 |
| 117 SharedWorkerServiceImpl(); | 117 SharedWorkerServiceImpl(); |
| 118 virtual ~SharedWorkerServiceImpl(); | 118 ~SharedWorkerServiceImpl() override; |
| 119 | 119 |
| 120 void ResetForTesting(); | 120 void ResetForTesting(); |
| 121 | 121 |
| 122 // Reserves the render process to create Shared Worker. This reservation | 122 // Reserves the render process to create Shared Worker. This reservation |
| 123 // procedure will be executed on UI thread and | 123 // procedure will be executed on UI thread and |
| 124 // RenderProcessReservedCallback() or RenderProcessReserveFailedCallback() | 124 // RenderProcessReservedCallback() or RenderProcessReserveFailedCallback() |
| 125 // will be called on IO thread. | 125 // will be called on IO thread. |
| 126 void ReserveRenderProcessToCreateWorker( | 126 void ReserveRenderProcessToCreateWorker( |
| 127 scoped_ptr<SharedWorkerPendingInstance> pending_instance, | 127 scoped_ptr<SharedWorkerPendingInstance> pending_instance, |
| 128 bool* url_mismatch); | 128 bool* url_mismatch); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 int next_pending_instance_id_; | 169 int next_pending_instance_id_; |
| 170 | 170 |
| 171 ObserverList<WorkerServiceObserver> observers_; | 171 ObserverList<WorkerServiceObserver> observers_; |
| 172 | 172 |
| 173 DISALLOW_COPY_AND_ASSIGN(SharedWorkerServiceImpl); | 173 DISALLOW_COPY_AND_ASSIGN(SharedWorkerServiceImpl); |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 } // namespace content | 176 } // namespace content |
| 177 | 177 |
| 178 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ | 178 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ |
| OLD | NEW |