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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 233 |
234 ServiceWorkerScriptCacheMap* script_cache_map() { return &script_cache_map_; } | 234 ServiceWorkerScriptCacheMap* script_cache_map() { return &script_cache_map_; } |
235 EmbeddedWorkerInstance* embedded_worker() { return embedded_worker_.get(); } | 235 EmbeddedWorkerInstance* embedded_worker() { return embedded_worker_.get(); } |
236 | 236 |
237 // Dooms this version to have REDUNDANT status and its resources deleted. If | 237 // Dooms this version to have REDUNDANT status and its resources deleted. If |
238 // the version is controlling a page, these changes will happen when the | 238 // the version is controlling a page, these changes will happen when the |
239 // version no longer controls any pages. | 239 // version no longer controls any pages. |
240 void Doom(); | 240 void Doom(); |
241 bool is_doomed() const { return is_doomed_; } | 241 bool is_doomed() const { return is_doomed_; } |
242 | 242 |
| 243 bool skip_waiting() const { return skip_waiting_; } |
| 244 |
243 private: | 245 private: |
244 friend class base::RefCounted<ServiceWorkerVersion>; | 246 friend class base::RefCounted<ServiceWorkerVersion>; |
245 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, | 247 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, |
246 ActivateWaitingVersion); | 248 ActivateWaitingVersion); |
247 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); | 249 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); |
248 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); | 250 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); |
249 typedef ServiceWorkerVersion self; | 251 typedef ServiceWorkerVersion self; |
250 typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap; | 252 typedef std::map<ServiceWorkerProviderHost*, int> ControlleeMap; |
251 typedef IDMap<ServiceWorkerProviderHost> ControlleeByIDMap; | 253 typedef IDMap<ServiceWorkerProviderHost> ControlleeByIDMap; |
252 | 254 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 void OnFetchEventFinished(int request_id, | 288 void OnFetchEventFinished(int request_id, |
287 ServiceWorkerFetchEventResult result, | 289 ServiceWorkerFetchEventResult result, |
288 const ServiceWorkerResponse& response); | 290 const ServiceWorkerResponse& response); |
289 void OnSyncEventFinished(int request_id); | 291 void OnSyncEventFinished(int request_id); |
290 void OnPushEventFinished(int request_id, | 292 void OnPushEventFinished(int request_id, |
291 blink::WebServiceWorkerEventResult result); | 293 blink::WebServiceWorkerEventResult result); |
292 void OnGeofencingEventFinished(int request_id); | 294 void OnGeofencingEventFinished(int request_id); |
293 void OnPostMessageToDocument(int client_id, | 295 void OnPostMessageToDocument(int client_id, |
294 const base::string16& message, | 296 const base::string16& message, |
295 const std::vector<int>& sent_message_port_ids); | 297 const std::vector<int>& sent_message_port_ids); |
| 298 void OnSkipWaiting(int request_id); |
296 | 299 |
| 300 void DidSkipWaiting(int request_id); |
297 void ScheduleStopWorker(); | 301 void ScheduleStopWorker(); |
298 void DoomInternal(); | 302 void DoomInternal(); |
299 | 303 |
300 const int64 version_id_; | 304 const int64 version_id_; |
301 int64 registration_id_; | 305 int64 registration_id_; |
302 GURL script_url_; | 306 GURL script_url_; |
303 GURL scope_; | 307 GURL scope_; |
304 Status status_; | 308 Status status_; |
305 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; | 309 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; |
306 scoped_ptr<ServiceWorkerCacheListener> cache_listener_; | 310 scoped_ptr<ServiceWorkerCacheListener> cache_listener_; |
(...skipping 10 matching lines...) Expand all Loading... |
317 IDMap<StatusCallback, IDMapOwnPointer> geofencing_callbacks_; | 321 IDMap<StatusCallback, IDMapOwnPointer> geofencing_callbacks_; |
318 | 322 |
319 ControlleeMap controllee_map_; | 323 ControlleeMap controllee_map_; |
320 ControlleeByIDMap controllee_by_id_; | 324 ControlleeByIDMap controllee_by_id_; |
321 base::WeakPtr<ServiceWorkerContextCore> context_; | 325 base::WeakPtr<ServiceWorkerContextCore> context_; |
322 ObserverList<Listener> listeners_; | 326 ObserverList<Listener> listeners_; |
323 ServiceWorkerScriptCacheMap script_cache_map_; | 327 ServiceWorkerScriptCacheMap script_cache_map_; |
324 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_; | 328 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_; |
325 base::OneShotTimer<ServiceWorkerVersion> update_timer_; | 329 base::OneShotTimer<ServiceWorkerVersion> update_timer_; |
326 bool is_doomed_; | 330 bool is_doomed_; |
| 331 std::vector<int> pending_skip_waiting_requests_; |
| 332 bool skip_waiting_; |
327 | 333 |
328 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 334 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
329 | 335 |
330 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 336 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
331 }; | 337 }; |
332 | 338 |
333 } // namespace content | 339 } // namespace content |
334 | 340 |
335 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 341 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |