| 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 <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "third_party/WebKit/public/web/WebSharedWorkerCreationErrors.h" | 21 #include "third_party/WebKit/public/web/WebSharedWorkerCreationErrors.h" |
| 22 | 22 |
| 23 struct ViewHostMsg_CreateWorker_Params; | 23 struct ViewHostMsg_CreateWorker_Params; |
| 24 | 24 |
| 25 namespace IPC { | 25 namespace IPC { |
| 26 class Message; | 26 class Message; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 | 30 |
| 31 class MessagePort; |
| 31 class SharedWorkerInstance; | 32 class SharedWorkerInstance; |
| 32 class SharedWorkerHost; | 33 class SharedWorkerHost; |
| 33 class SharedWorkerMessageFilter; | 34 class SharedWorkerMessageFilter; |
| 34 class ResourceContext; | 35 class ResourceContext; |
| 35 class WorkerServiceObserver; | 36 class WorkerServiceObserver; |
| 36 class WorkerStoragePartitionId; | 37 class WorkerStoragePartitionId; |
| 37 | 38 |
| 38 // The implementation of WorkerService. We try to place workers in an existing | 39 // The implementation of WorkerService. We try to place workers in an existing |
| 39 // renderer process when possible. | 40 // renderer process when possible. |
| 40 class CONTENT_EXPORT SharedWorkerServiceImpl | 41 class CONTENT_EXPORT SharedWorkerServiceImpl |
| 41 : public NON_EXPORTED_BASE(WorkerService) { | 42 : public NON_EXPORTED_BASE(WorkerService) { |
| 42 public: | 43 public: |
| 43 // Returns the SharedWorkerServiceImpl singleton. | 44 // Returns the SharedWorkerServiceImpl singleton. |
| 44 static SharedWorkerServiceImpl* GetInstance(); | 45 static SharedWorkerServiceImpl* GetInstance(); |
| 45 | 46 |
| 46 // WorkerService implementation: | 47 // WorkerService implementation: |
| 47 bool TerminateWorker(int process_id, int route_id) override; | 48 bool TerminateWorker(int process_id, int route_id) override; |
| 48 std::vector<WorkerInfo> GetWorkers() override; | 49 std::vector<WorkerInfo> GetWorkers() override; |
| 49 void AddObserver(WorkerServiceObserver* observer) override; | 50 void AddObserver(WorkerServiceObserver* observer) override; |
| 50 void RemoveObserver(WorkerServiceObserver* observer) override; | 51 void RemoveObserver(WorkerServiceObserver* observer) override; |
| 51 | 52 |
| 52 // These methods correspond to worker related IPCs. | 53 // These methods correspond to worker related IPCs. |
| 53 blink::WebWorkerCreationError CreateWorker( | 54 blink::WebWorkerCreationError CreateWorker( |
| 54 const ViewHostMsg_CreateWorker_Params& params, | 55 const ViewHostMsg_CreateWorker_Params& params, |
| 55 int route_id, | 56 int route_id, |
| 56 SharedWorkerMessageFilter* filter, | 57 SharedWorkerMessageFilter* filter, |
| 57 ResourceContext* resource_context, | 58 ResourceContext* resource_context, |
| 58 const WorkerStoragePartitionId& partition_id); | 59 const WorkerStoragePartitionId& partition_id); |
| 59 void ConnectToWorker(SharedWorkerMessageFilter* filter, | 60 void ConnectToWorker(SharedWorkerMessageFilter* filter, |
| 60 int route_id, | 61 int worker_route_id, |
| 61 int sent_message_port_id); | 62 const MessagePort& port); |
| 62 void DocumentDetached(SharedWorkerMessageFilter* filter, | 63 void DocumentDetached(SharedWorkerMessageFilter* filter, |
| 63 unsigned long long document_id); | 64 unsigned long long document_id); |
| 64 void CountFeature(SharedWorkerMessageFilter* filter, | 65 void CountFeature(SharedWorkerMessageFilter* filter, |
| 65 int worker_route_id, | 66 int worker_route_id, |
| 66 uint32_t feature); | 67 uint32_t feature); |
| 67 void WorkerContextClosed(SharedWorkerMessageFilter* filter, | 68 void WorkerContextClosed(SharedWorkerMessageFilter* filter, |
| 68 int worker_route_id); | 69 int worker_route_id); |
| 69 void WorkerContextDestroyed(SharedWorkerMessageFilter* filter, | 70 void WorkerContextDestroyed(SharedWorkerMessageFilter* filter, |
| 70 int worker_route_id); | 71 int worker_route_id); |
| 71 void WorkerReadyForInspection(SharedWorkerMessageFilter* filter, | 72 void WorkerReadyForInspection(SharedWorkerMessageFilter* filter, |
| 72 int worker_route_id); | 73 int worker_route_id); |
| 73 void WorkerScriptLoaded(SharedWorkerMessageFilter* filter, | 74 void WorkerScriptLoaded(SharedWorkerMessageFilter* filter, |
| 74 int worker_route_id); | 75 int worker_route_id); |
| 75 void WorkerScriptLoadFailed(SharedWorkerMessageFilter* filter, | 76 void WorkerScriptLoadFailed(SharedWorkerMessageFilter* filter, |
| 76 int worker_route_id); | 77 int worker_route_id); |
| 77 void WorkerConnected(SharedWorkerMessageFilter* filter, | 78 void WorkerConnected(SharedWorkerMessageFilter* filter, |
| 78 int message_port_id, | 79 int connection_request_id, |
| 79 int worker_route_id); | 80 int worker_route_id); |
| 80 void AllowFileSystem(SharedWorkerMessageFilter* filter, | 81 void AllowFileSystem(SharedWorkerMessageFilter* filter, |
| 81 int worker_route_id, | 82 int worker_route_id, |
| 82 const GURL& url, | 83 const GURL& url, |
| 83 IPC::Message* reply_msg); | 84 IPC::Message* reply_msg); |
| 84 void AllowIndexedDB(SharedWorkerMessageFilter* filter, | 85 void AllowIndexedDB(SharedWorkerMessageFilter* filter, |
| 85 int worker_route_id, | 86 int worker_route_id, |
| 86 const GURL& url, | 87 const GURL& url, |
| 87 const base::string16& name, | 88 const base::string16& name, |
| 88 bool* result); | 89 bool* result); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 int next_pending_instance_id_; | 177 int next_pending_instance_id_; |
| 177 | 178 |
| 178 base::ObserverList<WorkerServiceObserver> observers_; | 179 base::ObserverList<WorkerServiceObserver> observers_; |
| 179 | 180 |
| 180 DISALLOW_COPY_AND_ASSIGN(SharedWorkerServiceImpl); | 181 DISALLOW_COPY_AND_ASSIGN(SharedWorkerServiceImpl); |
| 181 }; | 182 }; |
| 182 | 183 |
| 183 } // namespace content | 184 } // namespace content |
| 184 | 185 |
| 185 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ | 186 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ |
| OLD | NEW |