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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // case it will observe resource loads made directly by the service worker. | 45 // case it will observe resource loads made directly by the service worker. |
46 class CONTENT_EXPORT ServiceWorkerProviderHost | 46 class CONTENT_EXPORT ServiceWorkerProviderHost |
47 : public NON_EXPORTED_BASE(ServiceWorkerRegistration::Listener), | 47 : public NON_EXPORTED_BASE(ServiceWorkerRegistration::Listener), |
48 public base::SupportsWeakPtr<ServiceWorkerProviderHost> { | 48 public base::SupportsWeakPtr<ServiceWorkerProviderHost> { |
49 public: | 49 public: |
50 using GetClientInfoCallback = | 50 using GetClientInfoCallback = |
51 base::Callback<void(const ServiceWorkerClientInfo&)>; | 51 base::Callback<void(const ServiceWorkerClientInfo&)>; |
52 using GetRegistrationForReadyCallback = | 52 using GetRegistrationForReadyCallback = |
53 base::Callback<void(ServiceWorkerRegistration* reigstration)>; | 53 base::Callback<void(ServiceWorkerRegistration* reigstration)>; |
54 | 54 |
| 55 // PlzNavigate |
| 56 // This value is used for the render_process_id for browser-initiated |
| 57 // navigations. |
| 58 static int kVirtualProcessIDForBrowserRequest; |
| 59 |
| 60 // PlzNavigate |
| 61 // Returns the next SWProvider ID for navigations. |
| 62 static int GetNextNavigationProviderId(); |
| 63 |
55 // 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 |
56 // MSG_ROUTING_NONE. When this provider host is for a Document, | 65 // MSG_ROUTING_NONE. When this provider host is for a Document, |
57 // |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 |
58 // a Shared Worker, |route_id| is the Shared Worker route ID. | 67 // a Shared Worker, |route_id| is the Shared Worker route ID. |
59 // |provider_type| gives additional information whether the provider is | 68 // |provider_type| gives additional information whether the provider is |
60 // created for controller (ServiceWorker) or controllee (Document or | 69 // created for controller (ServiceWorker) or controllee (Document or |
61 // SharedWorker). | 70 // SharedWorker). |
62 ServiceWorkerProviderHost(int render_process_id, | 71 ServiceWorkerProviderHost(int render_process_id, |
63 int route_id, | 72 int route_id, |
64 int provider_id, | 73 int provider_id, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 void CompleteCrossSiteTransfer( | 204 void CompleteCrossSiteTransfer( |
196 int new_process_id, | 205 int new_process_id, |
197 int new_frame_id, | 206 int new_frame_id, |
198 int new_provider_id, | 207 int new_provider_id, |
199 ServiceWorkerProviderType new_provider_type, | 208 ServiceWorkerProviderType new_provider_type, |
200 ServiceWorkerDispatcherHost* dispatcher_host); | 209 ServiceWorkerDispatcherHost* dispatcher_host); |
201 ServiceWorkerDispatcherHost* dispatcher_host() const { | 210 ServiceWorkerDispatcherHost* dispatcher_host() const { |
202 return dispatcher_host_; | 211 return dispatcher_host_; |
203 } | 212 } |
204 | 213 |
| 214 // PlzNavigate |
| 215 // Completes initialization of provider hosts used for navigation requests. |
| 216 void CompleteNavigationInitialized( |
| 217 int process_id, |
| 218 int route_id, |
| 219 ServiceWorkerDispatcherHost* dispatcher_host); |
| 220 |
205 // Sends event messages to the renderer. Events for the worker are queued up | 221 // Sends event messages to the renderer. Events for the worker are queued up |
206 // until the worker thread id is known via SetReadyToSendMessagesToWorker(). | 222 // until the worker thread id is known via SetReadyToSendMessagesToWorker(). |
207 void SendUpdateFoundMessage( | 223 void SendUpdateFoundMessage( |
208 int registration_handle_id); | 224 int registration_handle_id); |
209 void SendSetVersionAttributesMessage( | 225 void SendSetVersionAttributesMessage( |
210 int registration_handle_id, | 226 int registration_handle_id, |
211 ChangedVersionAttributesMask changed_mask, | 227 ChangedVersionAttributesMask changed_mask, |
212 ServiceWorkerVersion* installing_version, | 228 ServiceWorkerVersion* installing_version, |
213 ServiceWorkerVersion* waiting_version, | 229 ServiceWorkerVersion* waiting_version, |
214 ServiceWorkerVersion* active_version); | 230 ServiceWorkerVersion* active_version); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 Update_ElongatedScript); | 262 Update_ElongatedScript); |
247 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerWriteToCacheJobTest, | 263 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerWriteToCacheJobTest, |
248 Update_EmptyScript); | 264 Update_EmptyScript); |
249 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, | 265 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, |
250 UpdateBefore24Hours); | 266 UpdateBefore24Hours); |
251 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, | 267 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, |
252 UpdateAfter24Hours); | 268 UpdateAfter24Hours); |
253 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, | 269 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, |
254 UpdateForceBypassCache); | 270 UpdateForceBypassCache); |
255 | 271 |
| 272 // PlzNavigate |
| 273 // Next SWProvider ID for navigations, starting at -2 and going down. |
| 274 static int next_navigation_provider_id_; |
| 275 |
256 struct OneShotGetReadyCallback { | 276 struct OneShotGetReadyCallback { |
257 GetRegistrationForReadyCallback callback; | 277 GetRegistrationForReadyCallback callback; |
258 bool called; | 278 bool called; |
259 | 279 |
260 explicit OneShotGetReadyCallback( | 280 explicit OneShotGetReadyCallback( |
261 const GetRegistrationForReadyCallback& callback); | 281 const GetRegistrationForReadyCallback& callback); |
262 ~OneShotGetReadyCallback(); | 282 ~OneShotGetReadyCallback(); |
263 }; | 283 }; |
264 | 284 |
265 // ServiceWorkerRegistration::Listener overrides. | 285 // ServiceWorkerRegistration::Listener overrides. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 bool allow_association_; | 336 bool allow_association_; |
317 | 337 |
318 std::vector<base::Closure> queued_events_; | 338 std::vector<base::Closure> queued_events_; |
319 | 339 |
320 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 340 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
321 }; | 341 }; |
322 | 342 |
323 } // namespace content | 343 } // namespace content |
324 | 344 |
325 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 345 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
OLD | NEW |