| 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 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/callback.h" |
| 16 #include "base/id_map.h" | 17 #include "base/id_map.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 19 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
| 20 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 21 #include "content/child/webmessageportchannel_impl.h" | 22 #include "content/child/webmessageportchannel_impl.h" |
| 22 #include "content/common/service_worker/service_worker_types.h" | 23 #include "content/common/service_worker/service_worker_types.h" |
| 23 #include "ipc/ipc_listener.h" | 24 #include "ipc/ipc_listener.h" |
| 24 #include "services/shell/public/interfaces/interface_provider.mojom.h" | 25 #include "services/shell/public/interfaces/interface_provider.mojom.h" |
| 25 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" | 26 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 class ServiceWorkerContextClient; | 58 class ServiceWorkerContextClient; |
| 58 class ThreadSafeSender; | 59 class ThreadSafeSender; |
| 59 class WebServiceWorkerRegistrationImpl; | 60 class WebServiceWorkerRegistrationImpl; |
| 60 | 61 |
| 61 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. | 62 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. |
| 62 // Unless otherwise noted, all methods are called on the worker thread. | 63 // Unless otherwise noted, all methods are called on the worker thread. |
| 63 class ServiceWorkerContextClient | 64 class ServiceWorkerContextClient |
| 64 : public blink::WebServiceWorkerContextClient { | 65 : public blink::WebServiceWorkerContextClient { |
| 65 public: | 66 public: |
| 66 using SyncCallback = | 67 using SyncCallback = |
| 67 mojo::Callback<void(blink::mojom::ServiceWorkerEventStatus)>; | 68 base::Callback<void(blink::mojom::ServiceWorkerEventStatus)>; |
| 68 | 69 |
| 69 // Returns a thread-specific client instance. This does NOT create a | 70 // Returns a thread-specific client instance. This does NOT create a |
| 70 // new instance. | 71 // new instance. |
| 71 static ServiceWorkerContextClient* ThreadSpecificInstance(); | 72 static ServiceWorkerContextClient* ThreadSpecificInstance(); |
| 72 | 73 |
| 73 // Called on the main thread. | 74 // Called on the main thread. |
| 74 ServiceWorkerContextClient(int embedded_worker_id, | 75 ServiceWorkerContextClient(int embedded_worker_id, |
| 75 int64_t service_worker_version_id, | 76 int64_t service_worker_version_id, |
| 76 const GURL& service_worker_scope, | 77 const GURL& service_worker_scope, |
| 77 const GURL& script_url, | 78 const GURL& script_url, |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // Initialized on the worker thread in workerContextStarted and | 249 // Initialized on the worker thread in workerContextStarted and |
| 249 // destructed on the worker thread in willDestroyWorkerContext. | 250 // destructed on the worker thread in willDestroyWorkerContext. |
| 250 std::unique_ptr<WorkerContextData> context_; | 251 std::unique_ptr<WorkerContextData> context_; |
| 251 | 252 |
| 252 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); | 253 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); |
| 253 }; | 254 }; |
| 254 | 255 |
| 255 } // namespace content | 256 } // namespace content |
| 256 | 257 |
| 257 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ | 258 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ |
| OLD | NEW |