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 WorkerContextClosed(SharedWorkerMessageFilter* filter, | 65 void WorkerContextClosed(SharedWorkerMessageFilter* filter, |
65 int worker_route_id); | 66 int worker_route_id); |
66 void WorkerContextDestroyed(SharedWorkerMessageFilter* filter, | 67 void WorkerContextDestroyed(SharedWorkerMessageFilter* filter, |
67 int worker_route_id); | 68 int worker_route_id); |
68 void WorkerReadyForInspection(SharedWorkerMessageFilter* filter, | 69 void WorkerReadyForInspection(SharedWorkerMessageFilter* filter, |
69 int worker_route_id); | 70 int worker_route_id); |
70 void WorkerScriptLoaded(SharedWorkerMessageFilter* filter, | 71 void WorkerScriptLoaded(SharedWorkerMessageFilter* filter, |
71 int worker_route_id); | 72 int worker_route_id); |
72 void WorkerScriptLoadFailed(SharedWorkerMessageFilter* filter, | 73 void WorkerScriptLoadFailed(SharedWorkerMessageFilter* filter, |
73 int worker_route_id); | 74 int worker_route_id); |
74 void WorkerConnected(SharedWorkerMessageFilter* filter, | 75 void WorkerConnected(SharedWorkerMessageFilter* filter, |
75 int message_port_id, | 76 int connection_request_id, |
76 int worker_route_id); | 77 int worker_route_id); |
77 void AllowFileSystem(SharedWorkerMessageFilter* filter, | 78 void AllowFileSystem(SharedWorkerMessageFilter* filter, |
78 int worker_route_id, | 79 int worker_route_id, |
79 const GURL& url, | 80 const GURL& url, |
80 IPC::Message* reply_msg); | 81 IPC::Message* reply_msg); |
81 void AllowIndexedDB(SharedWorkerMessageFilter* filter, | 82 void AllowIndexedDB(SharedWorkerMessageFilter* filter, |
82 int worker_route_id, | 83 int worker_route_id, |
83 const GURL& url, | 84 const GURL& url, |
84 const base::string16& name, | 85 const base::string16& name, |
85 bool* result); | 86 bool* result); |
(...skipping 87 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 |