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_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // case it will observe resource loads made directly by the service worker. | 44 // case it will observe resource loads made directly by the service worker. |
45 class CONTENT_EXPORT ServiceWorkerProviderHost | 45 class CONTENT_EXPORT ServiceWorkerProviderHost |
46 : public NON_EXPORTED_BASE(ServiceWorkerRegistration::Listener), | 46 : public NON_EXPORTED_BASE(ServiceWorkerRegistration::Listener), |
47 public base::SupportsWeakPtr<ServiceWorkerProviderHost> { | 47 public base::SupportsWeakPtr<ServiceWorkerProviderHost> { |
48 public: | 48 public: |
49 using GetClientInfoCallback = | 49 using GetClientInfoCallback = |
50 base::Callback<void(const ServiceWorkerClientInfo&)>; | 50 base::Callback<void(const ServiceWorkerClientInfo&)>; |
51 using GetRegistrationForReadyCallback = | 51 using GetRegistrationForReadyCallback = |
52 base::Callback<void(ServiceWorkerRegistration* reigstration)>; | 52 base::Callback<void(ServiceWorkerRegistration* reigstration)>; |
53 | 53 |
| 54 // PlzNavigate |
| 55 // This value is used for the render_process_id for browser-initiated |
| 56 // navigations. |
| 57 static int kVirtualProcessIDForBrowserRequest; |
| 58 |
| 59 // PlzNavigate |
| 60 // Generates a new globally unique service_worker_provider_id for |
| 61 // browser-initiated navigations. |
| 62 static int GetNextBrowserProviderID(); |
| 63 |
54 // When this provider host is for a Service Worker context, |route_id| is | 64 // When this provider host is for a Service Worker context, |route_id| is |
55 // MSG_ROUTING_NONE. When this provider host is for a Document, | 65 // MSG_ROUTING_NONE. When this provider host is for a Document, |
56 // |route_id| is the frame ID of the Document. When this provider host is for | 66 // |route_id| is the frame ID of the Document. When this provider host is for |
57 // a Shared Worker, |route_id| is the Shared Worker route ID. | 67 // a Shared Worker, |route_id| is the Shared Worker route ID. |
58 // |provider_type| gives additional information whether the provider is | 68 // |provider_type| gives additional information whether the provider is |
59 // created for controller (ServiceWorker) or controllee (Document or | 69 // created for controller (ServiceWorker) or controllee (Document or |
60 // SharedWorker). | 70 // SharedWorker). |
61 ServiceWorkerProviderHost(int render_process_id, | 71 ServiceWorkerProviderHost(int render_process_id, |
62 int route_id, | 72 int route_id, |
63 int provider_id, | 73 int provider_id, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 void CompleteCrossSiteTransfer( | 204 void CompleteCrossSiteTransfer( |
195 int new_process_id, | 205 int new_process_id, |
196 int new_frame_id, | 206 int new_frame_id, |
197 int new_provider_id, | 207 int new_provider_id, |
198 ServiceWorkerProviderType new_provider_type, | 208 ServiceWorkerProviderType new_provider_type, |
199 ServiceWorkerDispatcherHost* dispatcher_host); | 209 ServiceWorkerDispatcherHost* dispatcher_host); |
200 ServiceWorkerDispatcherHost* dispatcher_host() const { | 210 ServiceWorkerDispatcherHost* dispatcher_host() const { |
201 return dispatcher_host_; | 211 return dispatcher_host_; |
202 } | 212 } |
203 | 213 |
| 214 // PlzNavigate |
| 215 // Completes initialization of provider hosts initialized in the browser |
| 216 // process. |
| 217 void CompleteBrowserInitialized(int process_id, int route_id); |
| 218 |
204 // Sends event messages to the renderer. Events for the worker are queued up | 219 // Sends event messages to the renderer. Events for the worker are queued up |
205 // until the worker thread id is known via SetReadyToSendMessagesToWorker(). | 220 // until the worker thread id is known via SetReadyToSendMessagesToWorker(). |
206 void SendUpdateFoundMessage( | 221 void SendUpdateFoundMessage( |
207 int registration_handle_id); | 222 int registration_handle_id); |
208 void SendSetVersionAttributesMessage( | 223 void SendSetVersionAttributesMessage( |
209 int registration_handle_id, | 224 int registration_handle_id, |
210 ChangedVersionAttributesMask changed_mask, | 225 ChangedVersionAttributesMask changed_mask, |
211 ServiceWorkerVersion* installing_version, | 226 ServiceWorkerVersion* installing_version, |
212 ServiceWorkerVersion* waiting_version, | 227 ServiceWorkerVersion* waiting_version, |
213 ServiceWorkerVersion* active_version); | 228 ServiceWorkerVersion* active_version); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 bool allow_association_; | 330 bool allow_association_; |
316 | 331 |
317 std::vector<base::Closure> queued_events_; | 332 std::vector<base::Closure> queued_events_; |
318 | 333 |
319 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 334 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
320 }; | 335 }; |
321 | 336 |
322 } // namespace content | 337 } // namespace content |
323 | 338 |
324 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 339 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
OLD | NEW |