OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ |
6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | 6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/id_map.h" | 11 #include "base/id_map.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "content/child/worker_task_runner.h" | 14 #include "content/child/worker_task_runner.h" |
15 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" | 15 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" |
16 #include "third_party/WebKit/public/platform/WebServiceWorkerProvider.h" | 16 #include "third_party/WebKit/public/platform/WebServiceWorkerProvider.h" |
17 #include "third_party/WebKit/public/platform/WebServiceWorkerState.h" | 17 #include "third_party/WebKit/public/platform/WebServiceWorkerState.h" |
18 | 18 |
19 class GURL; | 19 class GURL; |
20 | 20 |
21 namespace blink { | 21 namespace blink { |
22 class WebURL; | 22 class WebURL; |
23 } | 23 } |
24 | 24 |
25 namespace IPC { | 25 namespace IPC { |
26 class Message; | 26 class Message; |
27 } | 27 } |
28 | 28 |
| 29 struct ServiceWorkerMsg_MessageToDocument_Params; |
| 30 |
29 namespace content { | 31 namespace content { |
30 | 32 |
31 class ServiceWorkerMessageFilter; | 33 class ServiceWorkerMessageFilter; |
32 class ServiceWorkerProviderContext; | 34 class ServiceWorkerProviderContext; |
33 class ThreadSafeSender; | 35 class ThreadSafeSender; |
34 class WebServiceWorkerImpl; | 36 class WebServiceWorkerImpl; |
35 class WebServiceWorkerRegistrationImpl; | 37 class WebServiceWorkerRegistrationImpl; |
36 struct ServiceWorkerObjectInfo; | 38 struct ServiceWorkerObjectInfo; |
37 struct ServiceWorkerRegistrationObjectInfo; | 39 struct ServiceWorkerRegistrationObjectInfo; |
38 struct ServiceWorkerVersionAttributes; | 40 struct ServiceWorkerVersionAttributes; |
39 struct TransferredMessagePort; | |
40 | 41 |
41 // This class manages communication with the browser process about | 42 // This class manages communication with the browser process about |
42 // registration of the service worker, exposed to renderer and worker | 43 // registration of the service worker, exposed to renderer and worker |
43 // scripts through methods like navigator.registerServiceWorker(). | 44 // scripts through methods like navigator.registerServiceWorker(). |
44 class CONTENT_EXPORT ServiceWorkerDispatcher | 45 class CONTENT_EXPORT ServiceWorkerDispatcher |
45 : public WorkerTaskRunner::Observer { | 46 : public WorkerTaskRunner::Observer { |
46 public: | 47 public: |
47 typedef blink::WebServiceWorkerProvider::WebServiceWorkerRegistrationCallbacks | 48 typedef blink::WebServiceWorkerProvider::WebServiceWorkerRegistrationCallbacks |
48 WebServiceWorkerRegistrationCallbacks; | 49 WebServiceWorkerRegistrationCallbacks; |
49 typedef | 50 typedef |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 int provider_id, | 203 int provider_id, |
203 int registration_handle_id, | 204 int registration_handle_id, |
204 int changed_mask, | 205 int changed_mask, |
205 const ServiceWorkerVersionAttributes& attributes); | 206 const ServiceWorkerVersionAttributes& attributes); |
206 void OnUpdateFound(int thread_id, | 207 void OnUpdateFound(int thread_id, |
207 int registration_handle_id); | 208 int registration_handle_id); |
208 void OnSetControllerServiceWorker(int thread_id, | 209 void OnSetControllerServiceWorker(int thread_id, |
209 int provider_id, | 210 int provider_id, |
210 const ServiceWorkerObjectInfo& info, | 211 const ServiceWorkerObjectInfo& info, |
211 bool should_notify_controllerchange); | 212 bool should_notify_controllerchange); |
212 void OnPostMessage( | 213 void OnPostMessage(const ServiceWorkerMsg_MessageToDocument_Params& params); |
213 int thread_id, | |
214 int provider_id, | |
215 const base::string16& message, | |
216 const std::vector<TransferredMessagePort>& sent_message_ports, | |
217 const std::vector<int>& new_routing_ids); | |
218 | 214 |
219 // Keeps map from handle_id to ServiceWorker object. | 215 // Keeps map from handle_id to ServiceWorker object. |
220 void AddServiceWorker(int handle_id, WebServiceWorkerImpl* worker); | 216 void AddServiceWorker(int handle_id, WebServiceWorkerImpl* worker); |
221 void RemoveServiceWorker(int handle_id); | 217 void RemoveServiceWorker(int handle_id); |
222 | 218 |
223 // Keeps map from registration_handle_id to ServiceWorkerRegistration object. | 219 // Keeps map from registration_handle_id to ServiceWorkerRegistration object. |
224 void AddServiceWorkerRegistration( | 220 void AddServiceWorkerRegistration( |
225 int registration_handle_id, | 221 int registration_handle_id, |
226 WebServiceWorkerRegistrationImpl* registration); | 222 WebServiceWorkerRegistrationImpl* registration); |
227 void RemoveServiceWorkerRegistration( | 223 void RemoveServiceWorkerRegistration( |
(...skipping 24 matching lines...) Expand all Loading... |
252 WorkerToProviderMap worker_to_provider_; | 248 WorkerToProviderMap worker_to_provider_; |
253 | 249 |
254 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 250 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
255 | 251 |
256 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); | 252 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); |
257 }; | 253 }; |
258 | 254 |
259 } // namespace content | 255 } // namespace content |
260 | 256 |
261 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | 257 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ |
OLD | NEW |