OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 namespace content { | 54 namespace content { |
55 | 55 |
56 struct PlatformNotificationData; | 56 struct PlatformNotificationData; |
57 struct PushEventPayload; | 57 struct PushEventPayload; |
58 struct ServiceWorkerClientInfo; | 58 struct ServiceWorkerClientInfo; |
59 class ServiceWorkerProviderContext; | 59 class ServiceWorkerProviderContext; |
60 class ServiceWorkerContextClient; | 60 class ServiceWorkerContextClient; |
61 class ThreadSafeSender; | 61 class ThreadSafeSender; |
62 class EmbeddedWorkerInstanceClientImpl; | 62 class EmbeddedWorkerInstanceClientImpl; |
| 63 class WebWorkerFetchContextInfo; |
63 | 64 |
64 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. | 65 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. |
65 // Unless otherwise noted, all methods are called on the worker thread. | 66 // Unless otherwise noted, all methods are called on the worker thread. |
66 class ServiceWorkerContextClient : public blink::WebServiceWorkerContextClient, | 67 class ServiceWorkerContextClient : public blink::WebServiceWorkerContextClient, |
67 public mojom::ServiceWorkerEventDispatcher { | 68 public mojom::ServiceWorkerEventDispatcher { |
68 public: | 69 public: |
69 using SyncCallback = | 70 using SyncCallback = |
70 base::Callback<void(ServiceWorkerStatusCode, | 71 base::Callback<void(ServiceWorkerStatusCode, |
71 base::Time /* dispatch_event_time */)>; | 72 base::Time /* dispatch_event_time */)>; |
72 using FetchCallback = | 73 using FetchCallback = |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 int payment_request_id, | 184 int payment_request_id, |
184 const blink::WebPaymentAppResponse& response, | 185 const blink::WebPaymentAppResponse& response, |
185 double dispatch_event_time) override; | 186 double dispatch_event_time) override; |
186 void DidHandlePaymentRequestEvent(int payment_request_id, | 187 void DidHandlePaymentRequestEvent(int payment_request_id, |
187 blink::WebServiceWorkerEventResult result, | 188 blink::WebServiceWorkerEventResult result, |
188 double dispatch_event_time) override; | 189 double dispatch_event_time) override; |
189 | 190 |
190 // Called on the main thread. | 191 // Called on the main thread. |
191 blink::WebServiceWorkerNetworkProvider* CreateServiceWorkerNetworkProvider() | 192 blink::WebServiceWorkerNetworkProvider* CreateServiceWorkerNetworkProvider() |
192 override; | 193 override; |
| 194 blink::WebWorkerFetchContextInfo* CreateServiceWorkerFetchContextInfo() |
| 195 override; |
193 blink::WebServiceWorkerProvider* CreateServiceWorkerProvider() override; | 196 blink::WebServiceWorkerProvider* CreateServiceWorkerProvider() override; |
194 | 197 |
195 void PostMessageToClient(const blink::WebString& uuid, | 198 void PostMessageToClient(const blink::WebString& uuid, |
196 const blink::WebString& message, | 199 const blink::WebString& message, |
197 blink::WebMessagePortChannelArray channels) override; | 200 blink::WebMessagePortChannelArray channels) override; |
198 void Focus(const blink::WebString& uuid, | 201 void Focus(const blink::WebString& uuid, |
199 std::unique_ptr<blink::WebServiceWorkerClientCallbacks>) override; | 202 std::unique_ptr<blink::WebServiceWorkerClientCallbacks>) override; |
200 void Navigate( | 203 void Navigate( |
201 const blink::WebString& uuid, | 204 const blink::WebString& uuid, |
202 const blink::WebURL&, | 205 const blink::WebURL&, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 void OnNavigationPreloadError( | 316 void OnNavigationPreloadError( |
314 int fetch_event_id, | 317 int fetch_event_id, |
315 std::unique_ptr<blink::WebServiceWorkerError> error); | 318 std::unique_ptr<blink::WebServiceWorkerError> error); |
316 | 319 |
317 base::WeakPtr<ServiceWorkerContextClient> GetWeakPtr(); | 320 base::WeakPtr<ServiceWorkerContextClient> GetWeakPtr(); |
318 | 321 |
319 const int embedded_worker_id_; | 322 const int embedded_worker_id_; |
320 const int64_t service_worker_version_id_; | 323 const int64_t service_worker_version_id_; |
321 const GURL service_worker_scope_; | 324 const GURL service_worker_scope_; |
322 const GURL script_url_; | 325 const GURL script_url_; |
| 326 int network_provider_id_ = kInvalidServiceWorkerProviderId; |
323 scoped_refptr<ThreadSafeSender> sender_; | 327 scoped_refptr<ThreadSafeSender> sender_; |
324 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 328 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
325 scoped_refptr<base::TaskRunner> worker_task_runner_; | 329 scoped_refptr<base::TaskRunner> worker_task_runner_; |
326 | 330 |
327 scoped_refptr<ServiceWorkerProviderContext> provider_context_; | 331 scoped_refptr<ServiceWorkerProviderContext> provider_context_; |
328 | 332 |
329 // Not owned; this object is destroyed when proxy_ becomes invalid. | 333 // Not owned; this object is destroyed when proxy_ becomes invalid. |
330 blink::WebServiceWorkerContextProxy* proxy_; | 334 blink::WebServiceWorkerContextProxy* proxy_; |
331 | 335 |
332 // This is bound on the worker thread. | 336 // This is bound on the worker thread. |
333 mojom::ServiceWorkerEventDispatcherRequest pending_dispatcher_request_; | 337 mojom::ServiceWorkerEventDispatcherRequest pending_dispatcher_request_; |
334 | 338 |
335 // Renderer-side object corresponding to WebEmbeddedWorkerInstance. | 339 // Renderer-side object corresponding to WebEmbeddedWorkerInstance. |
336 // This is valid from the ctor to workerContextDestroyed. | 340 // This is valid from the ctor to workerContextDestroyed. |
337 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client_; | 341 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client_; |
338 | 342 |
339 // Initialized on the worker thread in workerContextStarted and | 343 // Initialized on the worker thread in workerContextStarted and |
340 // destructed on the worker thread in willDestroyWorkerContext. | 344 // destructed on the worker thread in willDestroyWorkerContext. |
341 std::unique_ptr<WorkerContextData> context_; | 345 std::unique_ptr<WorkerContextData> context_; |
342 | 346 |
343 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); | 347 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); |
344 }; | 348 }; |
345 | 349 |
346 } // namespace content | 350 } // namespace content |
347 | 351 |
348 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 352 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
OLD | NEW |