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 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // registration. | 110 // registration. |
111 WebServiceWorkerRegistrationImpl* FindServiceWorkerRegistration( | 111 WebServiceWorkerRegistrationImpl* FindServiceWorkerRegistration( |
112 const ServiceWorkerRegistrationObjectInfo& info, | 112 const ServiceWorkerRegistrationObjectInfo& info, |
113 bool adopt_handle); | 113 bool adopt_handle); |
114 | 114 |
115 // Creates a WebServiceWorkerRegistrationImpl for the specified registration | 115 // Creates a WebServiceWorkerRegistrationImpl for the specified registration |
116 // and transfers its ownership to the caller. If |adopt_handle| is true, a | 116 // and transfers its ownership to the caller. If |adopt_handle| is true, a |
117 // ServiceWorkerRegistrationHandleReference will be adopted for the | 117 // ServiceWorkerRegistrationHandleReference will be adopted for the |
118 // registration. | 118 // registration. |
119 WebServiceWorkerRegistrationImpl* CreateServiceWorkerRegistration( | 119 WebServiceWorkerRegistrationImpl* CreateServiceWorkerRegistration( |
| 120 int provider_id, |
120 const ServiceWorkerRegistrationObjectInfo& info, | 121 const ServiceWorkerRegistrationObjectInfo& info, |
121 bool adopt_handle); | 122 bool adopt_handle); |
122 | 123 |
123 // |thread_safe_sender| needs to be passed in because if the call leads to | 124 // |thread_safe_sender| needs to be passed in because if the call leads to |
124 // construction it will be needed. | 125 // construction it will be needed. |
125 static ServiceWorkerDispatcher* GetOrCreateThreadSpecificInstance( | 126 static ServiceWorkerDispatcher* GetOrCreateThreadSpecificInstance( |
126 ThreadSafeSender* thread_safe_sender); | 127 ThreadSafeSender* thread_safe_sender); |
127 | 128 |
128 // Unlike GetOrCreateThreadSpecificInstance() this doesn't create a new | 129 // Unlike GetOrCreateThreadSpecificInstance() this doesn't create a new |
129 // instance if thread-local instance doesn't exist. | 130 // instance if thread-local instance doesn't exist. |
(...skipping 27 matching lines...) Expand all Loading... |
157 const ServiceWorkerRegistrationObjectInfo& info, | 158 const ServiceWorkerRegistrationObjectInfo& info, |
158 const ServiceWorkerVersionAttributes& attrs); | 159 const ServiceWorkerVersionAttributes& attrs); |
159 void OnAssociateRegistration(int thread_id, | 160 void OnAssociateRegistration(int thread_id, |
160 int provider_id, | 161 int provider_id, |
161 const ServiceWorkerRegistrationObjectInfo& info, | 162 const ServiceWorkerRegistrationObjectInfo& info, |
162 const ServiceWorkerVersionAttributes& attrs); | 163 const ServiceWorkerVersionAttributes& attrs); |
163 void OnDisassociateRegistration(int thread_id, | 164 void OnDisassociateRegistration(int thread_id, |
164 int provider_id); | 165 int provider_id); |
165 void OnRegistered(int thread_id, | 166 void OnRegistered(int thread_id, |
166 int request_id, | 167 int request_id, |
| 168 int provider_id, |
167 const ServiceWorkerRegistrationObjectInfo& info, | 169 const ServiceWorkerRegistrationObjectInfo& info, |
168 const ServiceWorkerVersionAttributes& attrs); | 170 const ServiceWorkerVersionAttributes& attrs); |
169 void OnUnregistered(int thread_id, | 171 void OnUnregistered(int thread_id, |
170 int request_id, | 172 int request_id, |
171 bool is_success); | 173 bool is_success); |
172 void OnDidGetRegistration(int thread_id, | 174 void OnDidGetRegistration(int thread_id, |
173 int request_id, | 175 int request_id, |
| 176 int provider_id, |
174 const ServiceWorkerRegistrationObjectInfo& info, | 177 const ServiceWorkerRegistrationObjectInfo& info, |
175 const ServiceWorkerVersionAttributes& attrs); | 178 const ServiceWorkerVersionAttributes& attrs); |
176 void OnRegistrationError(int thread_id, | 179 void OnRegistrationError(int thread_id, |
177 int request_id, | 180 int request_id, |
178 blink::WebServiceWorkerError::ErrorType error_type, | 181 blink::WebServiceWorkerError::ErrorType error_type, |
179 const base::string16& message); | 182 const base::string16& message); |
180 void OnUnregistrationError(int thread_id, | 183 void OnUnregistrationError(int thread_id, |
181 int request_id, | 184 int request_id, |
182 blink::WebServiceWorkerError::ErrorType error_type, | 185 blink::WebServiceWorkerError::ErrorType error_type, |
183 const base::string16& message); | 186 const base::string16& message); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 void RemoveServiceWorker(int handle_id); | 222 void RemoveServiceWorker(int handle_id); |
220 | 223 |
221 // Keeps map from registration_handle_id to ServiceWorkerRegistration object. | 224 // Keeps map from registration_handle_id to ServiceWorkerRegistration object. |
222 void AddServiceWorkerRegistration( | 225 void AddServiceWorkerRegistration( |
223 int registration_handle_id, | 226 int registration_handle_id, |
224 WebServiceWorkerRegistrationImpl* registration); | 227 WebServiceWorkerRegistrationImpl* registration); |
225 void RemoveServiceWorkerRegistration( | 228 void RemoveServiceWorkerRegistration( |
226 int registration_handle_id); | 229 int registration_handle_id); |
227 | 230 |
228 WebServiceWorkerRegistrationImpl* FindOrCreateRegistration( | 231 WebServiceWorkerRegistrationImpl* FindOrCreateRegistration( |
| 232 int provider_id, |
229 const ServiceWorkerRegistrationObjectInfo& info, | 233 const ServiceWorkerRegistrationObjectInfo& info, |
230 const ServiceWorkerVersionAttributes& attrs); | 234 const ServiceWorkerVersionAttributes& attrs); |
231 | 235 |
232 RegistrationCallbackMap pending_registration_callbacks_; | 236 RegistrationCallbackMap pending_registration_callbacks_; |
233 UnregistrationCallbackMap pending_unregistration_callbacks_; | 237 UnregistrationCallbackMap pending_unregistration_callbacks_; |
234 GetRegistrationCallbackMap pending_get_registration_callbacks_; | 238 GetRegistrationCallbackMap pending_get_registration_callbacks_; |
235 | 239 |
236 ProviderClientMap provider_clients_; | 240 ProviderClientMap provider_clients_; |
237 ProviderContextMap provider_contexts_; | 241 ProviderContextMap provider_contexts_; |
238 | 242 |
239 WorkerObjectMap service_workers_; | 243 WorkerObjectMap service_workers_; |
240 RegistrationObjectMap registrations_; | 244 RegistrationObjectMap registrations_; |
241 | 245 |
242 // A map for ServiceWorkers that are associated to a particular document | 246 // A map for ServiceWorkers that are associated to a particular document |
243 // (e.g. as .current). | 247 // (e.g. as .current). |
244 WorkerToProviderMap worker_to_provider_; | 248 WorkerToProviderMap worker_to_provider_; |
245 | 249 |
246 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 250 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
247 | 251 |
248 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); | 252 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); |
249 }; | 253 }; |
250 | 254 |
251 } // namespace content | 255 } // namespace content |
252 | 256 |
253 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | 257 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ |
OLD | NEW |