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