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