OLD | NEW |
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_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 228 |
229 ServiceWorkerScriptCacheMap* script_cache_map() { return &script_cache_map_; } | 229 ServiceWorkerScriptCacheMap* script_cache_map() { return &script_cache_map_; } |
230 EmbeddedWorkerInstance* embedded_worker() { return embedded_worker_.get(); } | 230 EmbeddedWorkerInstance* embedded_worker() { return embedded_worker_.get(); } |
231 | 231 |
232 // Dooms this version to have REDUNDANT status and its resources deleted. If | 232 // Dooms this version to have REDUNDANT status and its resources deleted. If |
233 // the version is controlling a page, these changes will happen when the | 233 // the version is controlling a page, these changes will happen when the |
234 // version no longer controls any pages. | 234 // version no longer controls any pages. |
235 void Doom(); | 235 void Doom(); |
236 bool is_doomed() const { return is_doomed_; } | 236 bool is_doomed() const { return is_doomed_; } |
237 | 237 |
| 238 bool skip_waiting() const { return skip_waiting_; } |
| 239 |
238 private: | 240 private: |
239 friend class base::RefCounted<ServiceWorkerVersion>; | 241 friend class base::RefCounted<ServiceWorkerVersion>; |
240 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, | 242 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, |
241 ActivateWaitingVersion); | 243 ActivateWaitingVersion); |
242 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); | 244 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); |
243 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); | 245 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); |
244 typedef ServiceWorkerVersion self; | 246 typedef ServiceWorkerVersion self; |
245 typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap; | 247 typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap; |
246 typedef IDMap<ServiceWorkerProviderHost> ControlleeByIDMap; | 248 typedef IDMap<ServiceWorkerProviderHost> ControlleeByIDMap; |
247 | 249 |
(...skipping 27 matching lines...) Expand all Loading... |
275 blink::WebServiceWorkerEventResult result); | 277 blink::WebServiceWorkerEventResult result); |
276 void OnFetchEventFinished(int request_id, | 278 void OnFetchEventFinished(int request_id, |
277 ServiceWorkerFetchEventResult result, | 279 ServiceWorkerFetchEventResult result, |
278 const ServiceWorkerResponse& response); | 280 const ServiceWorkerResponse& response); |
279 void OnSyncEventFinished(int request_id); | 281 void OnSyncEventFinished(int request_id); |
280 void OnPushEventFinished(int request_id); | 282 void OnPushEventFinished(int request_id); |
281 void OnGeofencingEventFinished(int request_id); | 283 void OnGeofencingEventFinished(int request_id); |
282 void OnPostMessageToDocument(int client_id, | 284 void OnPostMessageToDocument(int client_id, |
283 const base::string16& message, | 285 const base::string16& message, |
284 const std::vector<int>& sent_message_port_ids); | 286 const std::vector<int>& sent_message_port_ids); |
| 287 void OnSkipWaiting(int request_id); |
285 | 288 |
| 289 void DidSkipWaiting(int request_id); |
286 void ScheduleStopWorker(); | 290 void ScheduleStopWorker(); |
287 void DoomInternal(); | 291 void DoomInternal(); |
288 | 292 |
289 const int64 version_id_; | 293 const int64 version_id_; |
290 int64 registration_id_; | 294 int64 registration_id_; |
291 GURL script_url_; | 295 GURL script_url_; |
292 GURL scope_; | 296 GURL scope_; |
293 Status status_; | 297 Status status_; |
294 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; | 298 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; |
295 scoped_ptr<ServiceWorkerCacheListener> cache_listener_; | 299 scoped_ptr<ServiceWorkerCacheListener> cache_listener_; |
(...skipping 10 matching lines...) Expand all Loading... |
306 IDMap<StatusCallback, IDMapOwnPointer> geofencing_callbacks_; | 310 IDMap<StatusCallback, IDMapOwnPointer> geofencing_callbacks_; |
307 | 311 |
308 ControlleeMap controllee_map_; | 312 ControlleeMap controllee_map_; |
309 ControlleeByIDMap controllee_by_id_; | 313 ControlleeByIDMap controllee_by_id_; |
310 base::WeakPtr<ServiceWorkerContextCore> context_; | 314 base::WeakPtr<ServiceWorkerContextCore> context_; |
311 ObserverList<Listener> listeners_; | 315 ObserverList<Listener> listeners_; |
312 ServiceWorkerScriptCacheMap script_cache_map_; | 316 ServiceWorkerScriptCacheMap script_cache_map_; |
313 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_; | 317 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_; |
314 base::OneShotTimer<ServiceWorkerVersion> update_timer_; | 318 base::OneShotTimer<ServiceWorkerVersion> update_timer_; |
315 bool is_doomed_; | 319 bool is_doomed_; |
| 320 std::vector<int> pending_skip_waiting_requests_; |
| 321 bool skip_waiting_; |
316 | 322 |
317 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 323 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
318 | 324 |
319 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 325 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
320 }; | 326 }; |
321 | 327 |
322 } // namespace content | 328 } // namespace content |
323 | 329 |
324 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 330 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |