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

Side by Side Diff: content/child/service_worker/service_worker_dispatcher.h

Issue 2443103002: service worker: Implement NavigationPreloadManager.getState (Closed)
Patch Set: rm file added in bad merge Created 4 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ 6 #define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 blink::WebServiceWorkerProvider::WebServiceWorkerGetRegistrationCallbacks 62 blink::WebServiceWorkerProvider::WebServiceWorkerGetRegistrationCallbacks
63 WebServiceWorkerGetRegistrationCallbacks; 63 WebServiceWorkerGetRegistrationCallbacks;
64 typedef 64 typedef
65 blink::WebServiceWorkerProvider::WebServiceWorkerGetRegistrationsCallbacks 65 blink::WebServiceWorkerProvider::WebServiceWorkerGetRegistrationsCallbacks
66 WebServiceWorkerGetRegistrationsCallbacks; 66 WebServiceWorkerGetRegistrationsCallbacks;
67 typedef blink::WebServiceWorkerProvider:: 67 typedef blink::WebServiceWorkerProvider::
68 WebServiceWorkerGetRegistrationForReadyCallbacks 68 WebServiceWorkerGetRegistrationForReadyCallbacks
69 WebServiceWorkerGetRegistrationForReadyCallbacks; 69 WebServiceWorkerGetRegistrationForReadyCallbacks;
70 using WebEnableNavigationPreloadCallbacks = 70 using WebEnableNavigationPreloadCallbacks =
71 blink::WebServiceWorkerRegistration::WebEnableNavigationPreloadCallbacks; 71 blink::WebServiceWorkerRegistration::WebEnableNavigationPreloadCallbacks;
72 using WebGetNavigationPreloadStateCallbacks = blink::
73 WebServiceWorkerRegistration::WebGetNavigationPreloadStateCallbacks;
72 74
73 ServiceWorkerDispatcher( 75 ServiceWorkerDispatcher(
74 ThreadSafeSender* thread_safe_sender, 76 ThreadSafeSender* thread_safe_sender,
75 base::SingleThreadTaskRunner* main_thread_task_runner); 77 base::SingleThreadTaskRunner* main_thread_task_runner);
76 ~ServiceWorkerDispatcher() override; 78 ~ServiceWorkerDispatcher() override;
77 79
78 void OnMessageReceived(const IPC::Message& msg); 80 void OnMessageReceived(const IPC::Message& msg);
79 81
80 // Corresponds to navigator.serviceWorker.register(). 82 // Corresponds to navigator.serviceWorker.register().
81 void RegisterServiceWorker( 83 void RegisterServiceWorker(
(...skipping 22 matching lines...) Expand all
104 void GetRegistrationForReady( 106 void GetRegistrationForReady(
105 int provider_id, 107 int provider_id,
106 WebServiceWorkerGetRegistrationForReadyCallbacks* callbacks); 108 WebServiceWorkerGetRegistrationForReadyCallbacks* callbacks);
107 109
108 // Corresponds to NavigationPreloadManager.enable/disable. 110 // Corresponds to NavigationPreloadManager.enable/disable.
109 void EnableNavigationPreload( 111 void EnableNavigationPreload(
110 int provider_id, 112 int provider_id,
111 int64_t registration_id, 113 int64_t registration_id,
112 bool enable, 114 bool enable,
113 std::unique_ptr<WebEnableNavigationPreloadCallbacks> callbacks); 115 std::unique_ptr<WebEnableNavigationPreloadCallbacks> callbacks);
116 // Corresponds to NavigationPreloadManager.getState.
117 void GetNavigationPreloadState(
118 int provider_id,
119 int64_t registration_id,
120 std::unique_ptr<WebGetNavigationPreloadStateCallbacks> callbacks);
114 121
115 // Called when a new provider context for a document is created. Usually 122 // Called when a new provider context for a document is created. Usually
116 // this happens when a new document is being loaded, and is called much 123 // this happens when a new document is being loaded, and is called much
117 // earlier than AddScriptClient. 124 // earlier than AddScriptClient.
118 // (This is attached only to the document thread's ServiceWorkerDispatcher) 125 // (This is attached only to the document thread's ServiceWorkerDispatcher)
119 void AddProviderContext(ServiceWorkerProviderContext* provider_context); 126 void AddProviderContext(ServiceWorkerProviderContext* provider_context);
120 void RemoveProviderContext(ServiceWorkerProviderContext* provider_context); 127 void RemoveProviderContext(ServiceWorkerProviderContext* provider_context);
121 128
122 // Called when navigator.serviceWorker is instantiated or detached 129 // Called when navigator.serviceWorker is instantiated or detached
123 // for a document whose provider can be identified by |provider_id|. 130 // for a document whose provider can be identified by |provider_id|.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 typedef IDMap<WebServiceWorkerUnregistrationCallbacks, 171 typedef IDMap<WebServiceWorkerUnregistrationCallbacks,
165 IDMapOwnPointer> UnregistrationCallbackMap; 172 IDMapOwnPointer> UnregistrationCallbackMap;
166 typedef IDMap<WebServiceWorkerGetRegistrationCallbacks, 173 typedef IDMap<WebServiceWorkerGetRegistrationCallbacks,
167 IDMapOwnPointer> GetRegistrationCallbackMap; 174 IDMapOwnPointer> GetRegistrationCallbackMap;
168 typedef IDMap<WebServiceWorkerGetRegistrationsCallbacks, 175 typedef IDMap<WebServiceWorkerGetRegistrationsCallbacks,
169 IDMapOwnPointer> GetRegistrationsCallbackMap; 176 IDMapOwnPointer> GetRegistrationsCallbackMap;
170 typedef IDMap<WebServiceWorkerGetRegistrationForReadyCallbacks, 177 typedef IDMap<WebServiceWorkerGetRegistrationForReadyCallbacks,
171 IDMapOwnPointer> GetRegistrationForReadyCallbackMap; 178 IDMapOwnPointer> GetRegistrationForReadyCallbackMap;
172 using EnableNavigationPreloadCallbackMap = 179 using EnableNavigationPreloadCallbackMap =
173 IDMap<WebEnableNavigationPreloadCallbacks, IDMapOwnPointer>; 180 IDMap<WebEnableNavigationPreloadCallbacks, IDMapOwnPointer>;
181 using GetNavigationPreloadStateCallbackMap =
182 IDMap<WebGetNavigationPreloadStateCallbacks, IDMapOwnPointer>;
174 183
175 typedef std::map<int, blink::WebServiceWorkerProviderClient*> 184 typedef std::map<int, blink::WebServiceWorkerProviderClient*>
176 ProviderClientMap; 185 ProviderClientMap;
177 typedef std::map<int, ServiceWorkerProviderContext*> ProviderContextMap; 186 typedef std::map<int, ServiceWorkerProviderContext*> ProviderContextMap;
178 typedef std::map<int, ServiceWorkerProviderContext*> WorkerToProviderMap; 187 typedef std::map<int, ServiceWorkerProviderContext*> WorkerToProviderMap;
179 typedef std::map<int, WebServiceWorkerImpl*> WorkerObjectMap; 188 typedef std::map<int, WebServiceWorkerImpl*> WorkerObjectMap;
180 typedef std::map<int, WebServiceWorkerRegistrationImpl*> 189 typedef std::map<int, WebServiceWorkerRegistrationImpl*>
181 RegistrationObjectMap; 190 RegistrationObjectMap;
182 191
183 friend class ServiceWorkerDispatcherTest; 192 friend class ServiceWorkerDispatcherTest;
(...skipping 25 matching lines...) Expand all
209 int thread_id, 218 int thread_id,
210 int request_id, 219 int request_id,
211 const std::vector<ServiceWorkerRegistrationObjectInfo>& infos, 220 const std::vector<ServiceWorkerRegistrationObjectInfo>& infos,
212 const std::vector<ServiceWorkerVersionAttributes>& attrs); 221 const std::vector<ServiceWorkerVersionAttributes>& attrs);
213 void OnDidGetRegistrationForReady( 222 void OnDidGetRegistrationForReady(
214 int thread_id, 223 int thread_id,
215 int request_id, 224 int request_id,
216 const ServiceWorkerRegistrationObjectInfo& info, 225 const ServiceWorkerRegistrationObjectInfo& info,
217 const ServiceWorkerVersionAttributes& attrs); 226 const ServiceWorkerVersionAttributes& attrs);
218 void OnDidEnableNavigationPreload(int thread_id, int request_id); 227 void OnDidEnableNavigationPreload(int thread_id, int request_id);
228 void OnDidGetNavigationPreloadState(int thread_id,
229 int request_id,
230 bool enabled);
219 void OnRegistrationError(int thread_id, 231 void OnRegistrationError(int thread_id,
220 int request_id, 232 int request_id,
221 blink::WebServiceWorkerError::ErrorType error_type, 233 blink::WebServiceWorkerError::ErrorType error_type,
222 const base::string16& message); 234 const base::string16& message);
223 void OnUpdateError(int thread_id, 235 void OnUpdateError(int thread_id,
224 int request_id, 236 int request_id,
225 blink::WebServiceWorkerError::ErrorType error_type, 237 blink::WebServiceWorkerError::ErrorType error_type,
226 const base::string16& message); 238 const base::string16& message);
227 void OnUnregistrationError(int thread_id, 239 void OnUnregistrationError(int thread_id,
228 int request_id, 240 int request_id,
229 blink::WebServiceWorkerError::ErrorType error_type, 241 blink::WebServiceWorkerError::ErrorType error_type,
230 const base::string16& message); 242 const base::string16& message);
231 void OnGetRegistrationError( 243 void OnGetRegistrationError(
232 int thread_id, 244 int thread_id,
233 int request_id, 245 int request_id,
234 blink::WebServiceWorkerError::ErrorType error_type, 246 blink::WebServiceWorkerError::ErrorType error_type,
235 const base::string16& message); 247 const base::string16& message);
236 void OnGetRegistrationsError( 248 void OnGetRegistrationsError(
237 int thread_id, 249 int thread_id,
238 int request_id, 250 int request_id,
239 blink::WebServiceWorkerError::ErrorType error_type, 251 blink::WebServiceWorkerError::ErrorType error_type,
240 const base::string16& message); 252 const base::string16& message);
241 void OnEnableNavigationPreloadError( 253 void OnEnableNavigationPreloadError(
242 int thread_id, 254 int thread_id,
243 int request_id, 255 int request_id,
244 blink::WebServiceWorkerError::ErrorType error_type, 256 blink::WebServiceWorkerError::ErrorType error_type,
245 const std::string& message); 257 const std::string& message);
258 void OnGetNavigationPreloadStateError(
259 int thread_id,
260 int request_id,
261 blink::WebServiceWorkerError::ErrorType error_type,
262 const std::string& message);
246 void OnServiceWorkerStateChanged(int thread_id, 263 void OnServiceWorkerStateChanged(int thread_id,
247 int handle_id, 264 int handle_id,
248 blink::WebServiceWorkerState state); 265 blink::WebServiceWorkerState state);
249 void OnSetVersionAttributes(int thread_id, 266 void OnSetVersionAttributes(int thread_id,
250 int registration_handle_id, 267 int registration_handle_id,
251 int changed_mask, 268 int changed_mask,
252 const ServiceWorkerVersionAttributes& attributes); 269 const ServiceWorkerVersionAttributes& attributes);
253 void OnUpdateFound(int thread_id, 270 void OnUpdateFound(int thread_id,
254 int registration_handle_id); 271 int registration_handle_id);
255 void OnSetControllerServiceWorker(int thread_id, 272 void OnSetControllerServiceWorker(int thread_id,
(...skipping 20 matching lines...) Expand all
276 std::unique_ptr<ServiceWorkerHandleReference> Adopt( 293 std::unique_ptr<ServiceWorkerHandleReference> Adopt(
277 const ServiceWorkerObjectInfo& info); 294 const ServiceWorkerObjectInfo& info);
278 295
279 RegistrationCallbackMap pending_registration_callbacks_; 296 RegistrationCallbackMap pending_registration_callbacks_;
280 UpdateCallbackMap pending_update_callbacks_; 297 UpdateCallbackMap pending_update_callbacks_;
281 UnregistrationCallbackMap pending_unregistration_callbacks_; 298 UnregistrationCallbackMap pending_unregistration_callbacks_;
282 GetRegistrationCallbackMap pending_get_registration_callbacks_; 299 GetRegistrationCallbackMap pending_get_registration_callbacks_;
283 GetRegistrationsCallbackMap pending_get_registrations_callbacks_; 300 GetRegistrationsCallbackMap pending_get_registrations_callbacks_;
284 GetRegistrationForReadyCallbackMap get_for_ready_callbacks_; 301 GetRegistrationForReadyCallbackMap get_for_ready_callbacks_;
285 EnableNavigationPreloadCallbackMap enable_navigation_preload_callbacks_; 302 EnableNavigationPreloadCallbackMap enable_navigation_preload_callbacks_;
303 GetNavigationPreloadStateCallbackMap get_navigation_preload_state_callbacks_;
286 304
287 ProviderClientMap provider_clients_; 305 ProviderClientMap provider_clients_;
288 ProviderContextMap provider_contexts_; 306 ProviderContextMap provider_contexts_;
289 307
290 WorkerObjectMap service_workers_; 308 WorkerObjectMap service_workers_;
291 RegistrationObjectMap registrations_; 309 RegistrationObjectMap registrations_;
292 310
293 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 311 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
294 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 312 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
295 313
296 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher); 314 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher);
297 }; 315 };
298 316
299 } // namespace content 317 } // namespace content
300 318
301 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_ 319 #endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698