| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // (This is attached only to the document thread's ServiceWorkerDispatcher) | 106 // (This is attached only to the document thread's ServiceWorkerDispatcher) |
| 107 void AddProviderContext(ServiceWorkerProviderContext* provider_context); | 107 void AddProviderContext(ServiceWorkerProviderContext* provider_context); |
| 108 void RemoveProviderContext(ServiceWorkerProviderContext* provider_context); | 108 void RemoveProviderContext(ServiceWorkerProviderContext* provider_context); |
| 109 | 109 |
| 110 // Called when navigator.serviceWorker is instantiated or detached | 110 // Called when navigator.serviceWorker is instantiated or detached |
| 111 // for a document whose provider can be identified by |provider_id|. | 111 // for a document whose provider can be identified by |provider_id|. |
| 112 void AddProviderClient(int provider_id, | 112 void AddProviderClient(int provider_id, |
| 113 blink::WebServiceWorkerProviderClient* client); | 113 blink::WebServiceWorkerProviderClient* client); |
| 114 void RemoveProviderClient(int provider_id); | 114 void RemoveProviderClient(int provider_id); |
| 115 | 115 |
| 116 // Returns the existing service worker or a newly created one. When a new one | 116 // Returns the existing service worker or a newly created one with the given |
| 117 // is created, increments an interprocess reference to the service worker via | 117 // handle reference. Returns nullptr if the given reference is invalid. |
| 118 // ServiceWorkerHandleReference. Returns nullptr if the given info is invalid. | |
| 119 scoped_refptr<WebServiceWorkerImpl> GetOrCreateServiceWorker( | 118 scoped_refptr<WebServiceWorkerImpl> GetOrCreateServiceWorker( |
| 120 const ServiceWorkerObjectInfo& info); | 119 scoped_ptr<ServiceWorkerHandleReference> handle_ref); |
| 121 | |
| 122 // Returns the existing service worker or a newly created one. Always adopts | |
| 123 // an interprocess reference to the service worker via | |
| 124 // ServiceWorkerHandleReference. Returns nullptr if the given info is invalid. | |
| 125 scoped_refptr<WebServiceWorkerImpl> GetOrAdoptServiceWorker( | |
| 126 const ServiceWorkerObjectInfo& info); | |
| 127 | 120 |
| 128 // Returns the existing registration or a newly created one. When a new one is | 121 // Returns the existing registration or a newly created one. When a new one is |
| 129 // created, increments interprocess references to the registration and its | 122 // created, increments interprocess references to the registration and its |
| 130 // versions via ServiceWorker(Registration)HandleReference. | 123 // versions via ServiceWorker(Registration)HandleReference. |
| 131 scoped_refptr<WebServiceWorkerRegistrationImpl> GetOrCreateRegistration( | 124 scoped_refptr<WebServiceWorkerRegistrationImpl> GetOrCreateRegistration( |
| 132 const ServiceWorkerRegistrationObjectInfo& info, | 125 const ServiceWorkerRegistrationObjectInfo& info, |
| 133 const ServiceWorkerVersionAttributes& attrs); | 126 const ServiceWorkerVersionAttributes& attrs); |
| 134 | 127 |
| 135 // Returns the existing registration or a newly created one. Always adopts | 128 // Returns the existing registration or a newly created one. Always adopts |
| 136 // interprocess references to the registration and its versions via | 129 // interprocess references to the registration and its versions via |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 271 |
| 279 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 272 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 280 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 273 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 281 | 274 |
| 282 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); | 275 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); |
| 283 }; | 276 }; |
| 284 | 277 |
| 285 } // namespace content | 278 } // namespace content |
| 286 | 279 |
| 287 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ | 280 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ |
| OLD | NEW |