| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 namespace content { | 55 namespace content { |
| 56 | 56 |
| 57 struct PlatformNotificationData; | 57 struct PlatformNotificationData; |
| 58 struct PushEventPayload; | 58 struct PushEventPayload; |
| 59 struct ServiceWorkerClientInfo; | 59 struct ServiceWorkerClientInfo; |
| 60 class ServiceWorkerProviderContext; | 60 class ServiceWorkerProviderContext; |
| 61 class ServiceWorkerContextClient; | 61 class ServiceWorkerContextClient; |
| 62 class ThreadSafeSender; | 62 class ThreadSafeSender; |
| 63 class EmbeddedWorkerInstanceClientImpl; | 63 class EmbeddedWorkerInstanceClientImpl; |
| 64 class WebWorkerFetchContext; |
| 64 | 65 |
| 65 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. | 66 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. |
| 66 // Unless otherwise noted, all methods are called on the worker thread. | 67 // Unless otherwise noted, all methods are called on the worker thread. |
| 67 class ServiceWorkerContextClient : public blink::WebServiceWorkerContextClient, | 68 class ServiceWorkerContextClient : public blink::WebServiceWorkerContextClient, |
| 68 public mojom::ServiceWorkerEventDispatcher { | 69 public mojom::ServiceWorkerEventDispatcher { |
| 69 public: | 70 public: |
| 70 using SyncCallback = | 71 using SyncCallback = |
| 71 base::OnceCallback<void(ServiceWorkerStatusCode, | 72 base::OnceCallback<void(ServiceWorkerStatusCode, |
| 72 base::Time /* dispatch_event_time */)>; | 73 base::Time /* dispatch_event_time */)>; |
| 73 using FetchCallback = | 74 using FetchCallback = |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 int payment_request_id, | 191 int payment_request_id, |
| 191 const blink::WebPaymentAppResponse& response, | 192 const blink::WebPaymentAppResponse& response, |
| 192 double dispatch_event_time) override; | 193 double dispatch_event_time) override; |
| 193 void DidHandlePaymentRequestEvent(int payment_request_id, | 194 void DidHandlePaymentRequestEvent(int payment_request_id, |
| 194 blink::WebServiceWorkerEventResult result, | 195 blink::WebServiceWorkerEventResult result, |
| 195 double dispatch_event_time) override; | 196 double dispatch_event_time) override; |
| 196 | 197 |
| 197 // Called on the main thread. | 198 // Called on the main thread. |
| 198 blink::WebServiceWorkerNetworkProvider* CreateServiceWorkerNetworkProvider() | 199 blink::WebServiceWorkerNetworkProvider* CreateServiceWorkerNetworkProvider() |
| 199 override; | 200 override; |
| 201 std::unique_ptr<blink::WebWorkerFetchContext> |
| 202 CreateServiceWorkerFetchContext() override; |
| 200 blink::WebServiceWorkerProvider* CreateServiceWorkerProvider() override; | 203 blink::WebServiceWorkerProvider* CreateServiceWorkerProvider() override; |
| 201 | 204 |
| 202 void PostMessageToClient(const blink::WebString& uuid, | 205 void PostMessageToClient(const blink::WebString& uuid, |
| 203 const blink::WebString& message, | 206 const blink::WebString& message, |
| 204 blink::WebMessagePortChannelArray channels) override; | 207 blink::WebMessagePortChannelArray channels) override; |
| 205 void Focus(const blink::WebString& uuid, | 208 void Focus(const blink::WebString& uuid, |
| 206 std::unique_ptr<blink::WebServiceWorkerClientCallbacks>) override; | 209 std::unique_ptr<blink::WebServiceWorkerClientCallbacks>) override; |
| 207 void Navigate( | 210 void Navigate( |
| 208 const blink::WebString& uuid, | 211 const blink::WebString& uuid, |
| 209 const blink::WebURL&, | 212 const blink::WebURL&, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 void OnNavigationPreloadError( | 324 void OnNavigationPreloadError( |
| 322 int fetch_event_id, | 325 int fetch_event_id, |
| 323 std::unique_ptr<blink::WebServiceWorkerError> error); | 326 std::unique_ptr<blink::WebServiceWorkerError> error); |
| 324 | 327 |
| 325 base::WeakPtr<ServiceWorkerContextClient> GetWeakPtr(); | 328 base::WeakPtr<ServiceWorkerContextClient> GetWeakPtr(); |
| 326 | 329 |
| 327 const int embedded_worker_id_; | 330 const int embedded_worker_id_; |
| 328 const int64_t service_worker_version_id_; | 331 const int64_t service_worker_version_id_; |
| 329 const GURL service_worker_scope_; | 332 const GURL service_worker_scope_; |
| 330 const GURL script_url_; | 333 const GURL script_url_; |
| 334 int network_provider_id_ = kInvalidServiceWorkerProviderId; |
| 331 scoped_refptr<ThreadSafeSender> sender_; | 335 scoped_refptr<ThreadSafeSender> sender_; |
| 332 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 336 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 333 scoped_refptr<base::TaskRunner> worker_task_runner_; | 337 scoped_refptr<base::TaskRunner> worker_task_runner_; |
| 334 | 338 |
| 335 scoped_refptr<ServiceWorkerProviderContext> provider_context_; | 339 scoped_refptr<ServiceWorkerProviderContext> provider_context_; |
| 336 | 340 |
| 337 // Not owned; this object is destroyed when proxy_ becomes invalid. | 341 // Not owned; this object is destroyed when proxy_ becomes invalid. |
| 338 blink::WebServiceWorkerContextProxy* proxy_; | 342 blink::WebServiceWorkerContextProxy* proxy_; |
| 339 | 343 |
| 340 // This is bound on the worker thread. | 344 // This is bound on the worker thread. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 351 // Initialized on the worker thread in workerContextStarted and | 355 // Initialized on the worker thread in workerContextStarted and |
| 352 // destructed on the worker thread in willDestroyWorkerContext. | 356 // destructed on the worker thread in willDestroyWorkerContext. |
| 353 std::unique_ptr<WorkerContextData> context_; | 357 std::unique_ptr<WorkerContextData> context_; |
| 354 | 358 |
| 355 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); | 359 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); |
| 356 }; | 360 }; |
| 357 | 361 |
| 358 } // namespace content | 362 } // namespace content |
| 359 | 363 |
| 360 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 364 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
| OLD | NEW |