| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 const ServiceWorkerRegistrationObjectInfo& info, | 156 const ServiceWorkerRegistrationObjectInfo& info, |
| 157 const ServiceWorkerVersionAttributes& attrs); | 157 const ServiceWorkerVersionAttributes& attrs); |
| 158 | 158 |
| 159 // Returns the existing registration or a newly created one. Always adopts | 159 // Returns the existing registration or a newly created one. Always adopts |
| 160 // interprocess references to the registration and its versions via | 160 // interprocess references to the registration and its versions via |
| 161 // ServiceWorker(Registration)HandleReference. | 161 // ServiceWorker(Registration)HandleReference. |
| 162 scoped_refptr<WebServiceWorkerRegistrationImpl> GetOrAdoptRegistration( | 162 scoped_refptr<WebServiceWorkerRegistrationImpl> GetOrAdoptRegistration( |
| 163 const ServiceWorkerRegistrationObjectInfo& info, | 163 const ServiceWorkerRegistrationObjectInfo& info, |
| 164 const ServiceWorkerVersionAttributes& attrs); | 164 const ServiceWorkerVersionAttributes& attrs); |
| 165 | 165 |
| 166 void OnAssociateRegistration(int thread_id, |
| 167 int provider_id, |
| 168 const ServiceWorkerRegistrationObjectInfo& info, |
| 169 const ServiceWorkerVersionAttributes& attrs); |
| 170 |
| 166 static ServiceWorkerDispatcher* GetOrCreateThreadSpecificInstance( | 171 static ServiceWorkerDispatcher* GetOrCreateThreadSpecificInstance( |
| 167 ThreadSafeSender* thread_safe_sender, | 172 ThreadSafeSender* thread_safe_sender, |
| 168 base::SingleThreadTaskRunner* main_thread_task_runner); | 173 base::SingleThreadTaskRunner* main_thread_task_runner); |
| 169 | 174 |
| 170 // Unlike GetOrCreateThreadSpecificInstance() this doesn't create a new | 175 // Unlike GetOrCreateThreadSpecificInstance() this doesn't create a new |
| 171 // instance if thread-local instance doesn't exist. | 176 // instance if thread-local instance doesn't exist. |
| 172 static ServiceWorkerDispatcher* GetThreadSpecificInstance(); | 177 static ServiceWorkerDispatcher* GetThreadSpecificInstance(); |
| 173 | 178 |
| 174 base::SingleThreadTaskRunner* main_thread_task_runner() { | 179 base::SingleThreadTaskRunner* main_thread_task_runner() { |
| 175 return main_thread_task_runner_.get(); | 180 return main_thread_task_runner_.get(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 203 using RegistrationObjectMap = | 208 using RegistrationObjectMap = |
| 204 std::map<int, WebServiceWorkerRegistrationImpl*>; | 209 std::map<int, WebServiceWorkerRegistrationImpl*>; |
| 205 | 210 |
| 206 friend class ServiceWorkerDispatcherTest; | 211 friend class ServiceWorkerDispatcherTest; |
| 207 friend class WebServiceWorkerImpl; | 212 friend class WebServiceWorkerImpl; |
| 208 friend class WebServiceWorkerRegistrationImpl; | 213 friend class WebServiceWorkerRegistrationImpl; |
| 209 | 214 |
| 210 // WorkerThread::Observer implementation. | 215 // WorkerThread::Observer implementation. |
| 211 void WillStopCurrentWorkerThread() override; | 216 void WillStopCurrentWorkerThread() override; |
| 212 | 217 |
| 213 void OnAssociateRegistration(int thread_id, | |
| 214 int provider_id, | |
| 215 const ServiceWorkerRegistrationObjectInfo& info, | |
| 216 const ServiceWorkerVersionAttributes& attrs); | |
| 217 void OnDisassociateRegistration(int thread_id, | 218 void OnDisassociateRegistration(int thread_id, |
| 218 int provider_id); | 219 int provider_id); |
| 219 void OnRegistered(int thread_id, | 220 void OnRegistered(int thread_id, |
| 220 int request_id, | 221 int request_id, |
| 221 const ServiceWorkerRegistrationObjectInfo& info, | 222 const ServiceWorkerRegistrationObjectInfo& info, |
| 222 const ServiceWorkerVersionAttributes& attrs); | 223 const ServiceWorkerVersionAttributes& attrs); |
| 223 void OnUpdated(int thread_id, int request_id); | 224 void OnUpdated(int thread_id, int request_id); |
| 224 void OnUnregistered(int thread_id, | 225 void OnUnregistered(int thread_id, |
| 225 int request_id, | 226 int request_id, |
| 226 bool is_success); | 227 bool is_success); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 335 |
| 335 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 336 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 336 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 337 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 337 | 338 |
| 338 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); | 339 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); |
| 339 }; | 340 }; |
| 340 | 341 |
| 341 } // namespace content | 342 } // namespace content |
| 342 | 343 |
| 343 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | 344 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ |
| OLD | NEW |