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(int route_id, | 60 void ConnectToWorker(int worker_route_id, |
60 int sent_message_port_id, | 61 const MessagePort& port, |
61 SharedWorkerMessageFilter* filter); | 62 SharedWorkerMessageFilter* filter); |
62 void DocumentDetached(unsigned long long document_id, | 63 void DocumentDetached(unsigned long long document_id, |
63 SharedWorkerMessageFilter* filter); | 64 SharedWorkerMessageFilter* filter); |
64 void WorkerContextClosed(int worker_route_id, | 65 void WorkerContextClosed(int worker_route_id, |
65 SharedWorkerMessageFilter* filter); | 66 SharedWorkerMessageFilter* filter); |
66 void WorkerContextDestroyed(int worker_route_id, | 67 void WorkerContextDestroyed(int worker_route_id, |
67 SharedWorkerMessageFilter* filter); | 68 SharedWorkerMessageFilter* filter); |
68 void WorkerReadyForInspection(int worker_route_id, | 69 void WorkerReadyForInspection(int worker_route_id, |
69 SharedWorkerMessageFilter* filter); | 70 SharedWorkerMessageFilter* filter); |
70 void WorkerScriptLoaded(int worker_route_id, | 71 void WorkerScriptLoaded(int worker_route_id, |
71 SharedWorkerMessageFilter* filter); | 72 SharedWorkerMessageFilter* filter); |
72 void WorkerScriptLoadFailed(int worker_route_id, | 73 void WorkerScriptLoadFailed(int worker_route_id, |
73 SharedWorkerMessageFilter* filter); | 74 SharedWorkerMessageFilter* filter); |
74 void WorkerConnected(int message_port_id, | 75 void WorkerConnected(int connection_request_id, |
75 int worker_route_id, | 76 int worker_route_id, |
76 SharedWorkerMessageFilter* filter); | 77 SharedWorkerMessageFilter* filter); |
77 void AllowFileSystem(int worker_route_id, | 78 void AllowFileSystem(int worker_route_id, |
78 const GURL& url, | 79 const GURL& url, |
79 IPC::Message* reply_msg, | 80 IPC::Message* reply_msg, |
80 SharedWorkerMessageFilter* filter); | 81 SharedWorkerMessageFilter* filter); |
81 void AllowIndexedDB(int worker_route_id, | 82 void AllowIndexedDB(int worker_route_id, |
82 const GURL& url, | 83 const GURL& url, |
83 const base::string16& name, | 84 const base::string16& name, |
84 bool* result, | 85 bool* result, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 int next_pending_instance_id_; | 174 int next_pending_instance_id_; |
174 | 175 |
175 base::ObserverList<WorkerServiceObserver> observers_; | 176 base::ObserverList<WorkerServiceObserver> observers_; |
176 | 177 |
177 DISALLOW_COPY_AND_ASSIGN(SharedWorkerServiceImpl); | 178 DISALLOW_COPY_AND_ASSIGN(SharedWorkerServiceImpl); |
178 }; | 179 }; |
179 | 180 |
180 } // namespace content | 181 } // namespace content |
181 | 182 |
182 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ | 183 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_SERVICE_IMPL_H_ |
OLD | NEW |