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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 // Unlike GetOrCreateThreadSpecificInstance() this doesn't create a new | 169 // Unlike GetOrCreateThreadSpecificInstance() this doesn't create a new |
170 // instance if thread-local instance doesn't exist. | 170 // instance if thread-local instance doesn't exist. |
171 static ServiceWorkerDispatcher* GetThreadSpecificInstance(); | 171 static ServiceWorkerDispatcher* GetThreadSpecificInstance(); |
172 | 172 |
173 base::SingleThreadTaskRunner* main_thread_task_runner() { | 173 base::SingleThreadTaskRunner* main_thread_task_runner() { |
174 return main_thread_task_runner_.get(); | 174 return main_thread_task_runner_.get(); |
175 } | 175 } |
176 | 176 |
177 private: | 177 private: |
178 typedef IDMap<WebServiceWorkerRegistrationCallbacks, | 178 using RegistrationCallbackMap = |
179 IDMapOwnPointer> RegistrationCallbackMap; | 179 IDMap<std::unique_ptr<WebServiceWorkerRegistrationCallbacks>>; |
180 typedef IDMap<WebServiceWorkerUpdateCallbacks, IDMapOwnPointer> | 180 using UpdateCallbackMap = |
181 UpdateCallbackMap; | 181 IDMap<std::unique_ptr<WebServiceWorkerUpdateCallbacks>>; |
182 typedef IDMap<WebServiceWorkerUnregistrationCallbacks, | 182 using UnregistrationCallbackMap = |
183 IDMapOwnPointer> UnregistrationCallbackMap; | 183 IDMap<std::unique_ptr<WebServiceWorkerUnregistrationCallbacks>>; |
184 typedef IDMap<WebServiceWorkerGetRegistrationCallbacks, | 184 using GetRegistrationCallbackMap = |
185 IDMapOwnPointer> GetRegistrationCallbackMap; | 185 IDMap<std::unique_ptr<WebServiceWorkerGetRegistrationCallbacks>>; |
186 typedef IDMap<WebServiceWorkerGetRegistrationsCallbacks, | 186 using GetRegistrationsCallbackMap = |
187 IDMapOwnPointer> GetRegistrationsCallbackMap; | 187 IDMap<std::unique_ptr<WebServiceWorkerGetRegistrationsCallbacks>>; |
188 typedef IDMap<WebServiceWorkerGetRegistrationForReadyCallbacks, | 188 using GetRegistrationForReadyCallbackMap = |
189 IDMapOwnPointer> GetRegistrationForReadyCallbackMap; | 189 IDMap<std::unique_ptr<WebServiceWorkerGetRegistrationForReadyCallbacks>>; |
190 using EnableNavigationPreloadCallbackMap = | 190 using EnableNavigationPreloadCallbackMap = |
191 IDMap<WebEnableNavigationPreloadCallbacks, IDMapOwnPointer>; | 191 IDMap<std::unique_ptr<WebEnableNavigationPreloadCallbacks>>; |
192 using GetNavigationPreloadStateCallbackMap = | 192 using GetNavigationPreloadStateCallbackMap = |
193 IDMap<WebGetNavigationPreloadStateCallbacks, IDMapOwnPointer>; | 193 IDMap<std::unique_ptr<WebGetNavigationPreloadStateCallbacks>>; |
194 using SetNavigationPreloadHeaderCallbackMap = | 194 using SetNavigationPreloadHeaderCallbackMap = |
195 IDMap<WebSetNavigationPreloadHeaderCallbacks, IDMapOwnPointer>; | 195 IDMap<std::unique_ptr<WebSetNavigationPreloadHeaderCallbacks>>; |
196 | 196 |
197 typedef std::map<int, blink::WebServiceWorkerProviderClient*> | 197 using ProviderClientMap = |
198 ProviderClientMap; | 198 std::map<int, blink::WebServiceWorkerProviderClient*>; |
199 typedef std::map<int, ServiceWorkerProviderContext*> ProviderContextMap; | 199 using ProviderContextMap = std::map<int, ServiceWorkerProviderContext*>; |
200 typedef std::map<int, ServiceWorkerProviderContext*> WorkerToProviderMap; | 200 using WorkerToProviderMap = std::map<int, ServiceWorkerProviderContext*>; |
201 typedef std::map<int, WebServiceWorkerImpl*> WorkerObjectMap; | 201 using WorkerObjectMap = std::map<int, WebServiceWorkerImpl*>; |
202 typedef std::map<int, WebServiceWorkerRegistrationImpl*> | 202 using RegistrationObjectMap = |
203 RegistrationObjectMap; | 203 std::map<int, WebServiceWorkerRegistrationImpl*>; |
204 | 204 |
205 friend class ServiceWorkerDispatcherTest; | 205 friend class ServiceWorkerDispatcherTest; |
206 friend class WebServiceWorkerImpl; | 206 friend class WebServiceWorkerImpl; |
207 friend class WebServiceWorkerRegistrationImpl; | 207 friend class WebServiceWorkerRegistrationImpl; |
208 | 208 |
209 // WorkerThread::Observer implementation. | 209 // WorkerThread::Observer implementation. |
210 void WillStopCurrentWorkerThread() override; | 210 void WillStopCurrentWorkerThread() override; |
211 | 211 |
212 void OnAssociateRegistration(int thread_id, | 212 void OnAssociateRegistration(int thread_id, |
213 int provider_id, | 213 int provider_id, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 331 |
332 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 332 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
333 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 333 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
334 | 334 |
335 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); | 335 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); |
336 }; | 336 }; |
337 | 337 |
338 } // namespace content | 338 } // namespace content |
339 | 339 |
340 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | 340 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ |
OLD | NEW |