Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Side by Side Diff: content/renderer/service_worker/service_worker_context_client.h

Issue 2168513004: [DO NOT COMMIT] ServiceWorker: First touch of mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove an unnecessary file Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/callback.h"
17 #include "base/id_map.h" 17 #include "base/id_map.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "content/child/webmessageportchannel_impl.h" 22 #include "content/child/webmessageportchannel_impl.h"
23 #include "content/common/service_worker/service_worker_types.h" 23 #include "content/common/service_worker/service_worker_types.h"
24 #include "content/renderer/mojo/blink_service_registry_impl.h"
24 #include "ipc/ipc_listener.h" 25 #include "ipc/ipc_listener.h"
26 #include "services/shell/public/cpp/interface_provider.h"
27 #include "services/shell/public/cpp/interface_registry.h"
25 #include "services/shell/public/interfaces/interface_provider.mojom.h" 28 #include "services/shell/public/interfaces/interface_provider.mojom.h"
26 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" 29 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h"
27 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerError.h" 30 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerError.h"
28 #include "third_party/WebKit/public/platform/modules/serviceworker/service_worke r_event_status.mojom.h" 31 #include "third_party/WebKit/public/platform/modules/serviceworker/service_worke r_event_status.mojom.h"
29 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextClient.h" 32 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextClient.h"
30 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextProxy.h" 33 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo ntextProxy.h"
31 #include "v8/include/v8.h" 34 #include "v8/include/v8.h"
32
33 struct ServiceWorkerMsg_ExtendableMessageEvent_Params; 35 struct ServiceWorkerMsg_ExtendableMessageEvent_Params;
34 36
35 namespace base { 37 namespace base {
36 class SingleThreadTaskRunner; 38 class SingleThreadTaskRunner;
37 class TaskRunner; 39 class TaskRunner;
38 } 40 }
39 41
40 namespace blink { 42 namespace blink {
41 class WebDataSource; 43 class WebDataSource;
42 struct WebServiceWorkerClientQueryOptions; 44 struct WebServiceWorkerClientQueryOptions;
43 class WebServiceWorkerContextProxy; 45 class WebServiceWorkerContextProxy;
44 class WebServiceWorkerProvider; 46 class WebServiceWorkerProvider;
45 struct WebSyncRegistration; 47 struct WebSyncRegistration;
46 } 48 }
47 49
48 namespace IPC { 50 namespace IPC {
49 class Message; 51 class Message;
50 } 52 }
51 53
54 namespace shell {
55 class InterfaceProvider;
56 class InterfaceRegistry;
57 }
58
52 namespace content { 59 namespace content {
53 60
61 class BlinkServiceRegistryImpl;
54 struct PlatformNotificationData; 62 struct PlatformNotificationData;
55 struct PushEventPayload; 63 struct PushEventPayload;
56 struct ServiceWorkerClientInfo; 64 struct ServiceWorkerClientInfo;
57 class ServiceWorkerProviderContext; 65 class ServiceWorkerProviderContext;
58 class ServiceWorkerContextClient; 66 class ServiceWorkerContextClient;
59 class ThreadSafeSender; 67 class ThreadSafeSender;
60 class WebServiceWorkerRegistrationImpl; 68 class WebServiceWorkerRegistrationImpl;
61 69
62 // This class provides access to/from an ServiceWorker's WorkerGlobalScope. 70 // This class provides access to/from an ServiceWorker's WorkerGlobalScope.
63 // Unless otherwise noted, all methods are called on the worker thread. 71 // Unless otherwise noted, all methods are called on the worker thread.
64 class ServiceWorkerContextClient 72 class ServiceWorkerContextClient
65 : public blink::WebServiceWorkerContextClient { 73 : public blink::WebServiceWorkerContextClient {
66 public: 74 public:
67 using SyncCallback = 75 using SyncCallback =
68 base::Callback<void(blink::mojom::ServiceWorkerEventStatus)>; 76 base::Callback<void(ServiceWorkerStatusCode)>;
69 77
70 // Returns a thread-specific client instance. This does NOT create a 78 // Returns a thread-specific client instance. This does NOT create a
71 // new instance. 79 // new instance.
72 static ServiceWorkerContextClient* ThreadSpecificInstance(); 80 static ServiceWorkerContextClient* ThreadSpecificInstance();
73 81
74 // Called on the main thread. 82 // Called on the main thread.
75 ServiceWorkerContextClient(int embedded_worker_id, 83 ServiceWorkerContextClient(int embedded_worker_id,
76 int64_t service_worker_version_id, 84 int64_t service_worker_version_id,
77 const GURL& service_worker_scope, 85 const GURL& service_worker_scope,
78 const GURL& script_url, 86 const GURL& script_url,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 blink::WebServiceWorkerClientCallbacks*) override; 178 blink::WebServiceWorkerClientCallbacks*) override;
171 void navigate(const blink::WebString& uuid, 179 void navigate(const blink::WebString& uuid,
172 const blink::WebURL&, 180 const blink::WebURL&,
173 blink::WebServiceWorkerClientCallbacks*) override; 181 blink::WebServiceWorkerClientCallbacks*) override;
174 void skipWaiting( 182 void skipWaiting(
175 blink::WebServiceWorkerSkipWaitingCallbacks* callbacks) override; 183 blink::WebServiceWorkerSkipWaitingCallbacks* callbacks) override;
176 void claim(blink::WebServiceWorkerClientsClaimCallbacks* callbacks) override; 184 void claim(blink::WebServiceWorkerClientsClaimCallbacks* callbacks) override;
177 void registerForeignFetchScopes( 185 void registerForeignFetchScopes(
178 const blink::WebVector<blink::WebURL>& sub_scopes, 186 const blink::WebVector<blink::WebURL>& sub_scopes,
179 const blink::WebVector<blink::WebSecurityOrigin>& origins) override; 187 const blink::WebVector<blink::WebSecurityOrigin>& origins) override;
188 blink::ServiceRegistry* serviceRegistry() override;
180 189
181 virtual void DispatchSyncEvent( 190 virtual void DispatchSyncEvent(
182 const std::string& tag, 191 const std::string& tag,
183 blink::WebServiceWorkerContextProxy::LastChanceOption last_chance, 192 blink::WebServiceWorkerContextProxy::LastChanceOption last_chance,
184 const SyncCallback& callback); 193 const SyncCallback& callback);
185 194
186 private: 195 private:
187 struct WorkerContextData; 196 struct WorkerContextData;
188 197
189 // Get routing_id for sending message to the ServiceWorkerVersion 198 // Get routing_id for sending message to the ServiceWorkerVersion
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // Initialized on the worker thread in workerContextStarted and 261 // Initialized on the worker thread in workerContextStarted and
253 // destructed on the worker thread in willDestroyWorkerContext. 262 // destructed on the worker thread in willDestroyWorkerContext.
254 std::unique_ptr<WorkerContextData> context_; 263 std::unique_ptr<WorkerContextData> context_;
255 264
256 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); 265 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient);
257 }; 266 };
258 267
259 } // namespace content 268 } // namespace content
260 269
261 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ 270 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698