| 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 typedef IDMap<std::unique_ptr<WebServiceWorkerRegistrationCallbacks>> |
| 179 IDMapOwnPointer> RegistrationCallbackMap; | 179 RegistrationCallbackMap; |
| 180 typedef IDMap<WebServiceWorkerUpdateCallbacks, IDMapOwnPointer> | 180 typedef IDMap<std::unique_ptr<WebServiceWorkerUpdateCallbacks>> |
| 181 UpdateCallbackMap; | 181 UpdateCallbackMap; |
| 182 typedef IDMap<WebServiceWorkerUnregistrationCallbacks, | 182 typedef IDMap<std::unique_ptr<WebServiceWorkerUnregistrationCallbacks>> |
| 183 IDMapOwnPointer> UnregistrationCallbackMap; | 183 UnregistrationCallbackMap; |
| 184 typedef IDMap<WebServiceWorkerGetRegistrationCallbacks, | 184 typedef IDMap<std::unique_ptr<WebServiceWorkerGetRegistrationCallbacks>> |
| 185 IDMapOwnPointer> GetRegistrationCallbackMap; | 185 GetRegistrationCallbackMap; |
| 186 typedef IDMap<WebServiceWorkerGetRegistrationsCallbacks, | 186 typedef IDMap<std::unique_ptr<WebServiceWorkerGetRegistrationsCallbacks>> |
| 187 IDMapOwnPointer> GetRegistrationsCallbackMap; | 187 GetRegistrationsCallbackMap; |
| 188 typedef IDMap<WebServiceWorkerGetRegistrationForReadyCallbacks, | 188 typedef IDMap< |
| 189 IDMapOwnPointer> GetRegistrationForReadyCallbackMap; | 189 std::unique_ptr<WebServiceWorkerGetRegistrationForReadyCallbacks>> |
| 190 GetRegistrationForReadyCallbackMap; |
| 190 using EnableNavigationPreloadCallbackMap = | 191 using EnableNavigationPreloadCallbackMap = |
| 191 IDMap<WebEnableNavigationPreloadCallbacks, IDMapOwnPointer>; | 192 IDMap<std::unique_ptr<WebEnableNavigationPreloadCallbacks>>; |
| 192 using GetNavigationPreloadStateCallbackMap = | 193 using GetNavigationPreloadStateCallbackMap = |
| 193 IDMap<WebGetNavigationPreloadStateCallbacks, IDMapOwnPointer>; | 194 IDMap<std::unique_ptr<WebGetNavigationPreloadStateCallbacks>>; |
| 194 using SetNavigationPreloadHeaderCallbackMap = | 195 using SetNavigationPreloadHeaderCallbackMap = |
| 195 IDMap<WebSetNavigationPreloadHeaderCallbacks, IDMapOwnPointer>; | 196 IDMap<std::unique_ptr<WebSetNavigationPreloadHeaderCallbacks>>; |
| 196 | 197 |
| 197 typedef std::map<int, blink::WebServiceWorkerProviderClient*> | 198 typedef std::map<int, blink::WebServiceWorkerProviderClient*> |
| 198 ProviderClientMap; | 199 ProviderClientMap; |
| 199 typedef std::map<int, ServiceWorkerProviderContext*> ProviderContextMap; | 200 typedef std::map<int, ServiceWorkerProviderContext*> ProviderContextMap; |
| 200 typedef std::map<int, ServiceWorkerProviderContext*> WorkerToProviderMap; | 201 typedef std::map<int, ServiceWorkerProviderContext*> WorkerToProviderMap; |
| 201 typedef std::map<int, WebServiceWorkerImpl*> WorkerObjectMap; | 202 typedef std::map<int, WebServiceWorkerImpl*> WorkerObjectMap; |
| 202 typedef std::map<int, WebServiceWorkerRegistrationImpl*> | 203 typedef std::map<int, WebServiceWorkerRegistrationImpl*> |
| 203 RegistrationObjectMap; | 204 RegistrationObjectMap; |
| 204 | 205 |
| 205 friend class ServiceWorkerDispatcherTest; | 206 friend class ServiceWorkerDispatcherTest; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 | 332 |
| 332 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 333 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 333 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 334 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 334 | 335 |
| 335 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); | 336 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); |
| 336 }; | 337 }; |
| 337 | 338 |
| 338 } // namespace content | 339 } // namespace content |
| 339 | 340 |
| 340 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | 341 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ |
| OLD | NEW |