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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 ServiceWorkerScriptCacheMap* script_cache_map() { return &script_cache_map_; } | 245 ServiceWorkerScriptCacheMap* script_cache_map() { return &script_cache_map_; } |
246 EmbeddedWorkerInstance* embedded_worker() { return embedded_worker_.get(); } | 246 EmbeddedWorkerInstance* embedded_worker() { return embedded_worker_.get(); } |
247 | 247 |
248 // Dooms this version to have REDUNDANT status and its resources deleted. If | 248 // Dooms this version to have REDUNDANT status and its resources deleted. If |
249 // the version is controlling a page, these changes will happen when the | 249 // the version is controlling a page, these changes will happen when the |
250 // version no longer controls any pages. | 250 // version no longer controls any pages. |
251 void Doom(); | 251 void Doom(); |
252 bool is_doomed() const { return is_doomed_; } | 252 bool is_doomed() const { return is_doomed_; } |
253 | 253 |
| 254 bool skip_waiting() const { return skip_waiting_; } |
| 255 |
254 private: | 256 private: |
255 class GetClientDocumentsCallback; | 257 class GetClientDocumentsCallback; |
256 class GetClientInfoCallback; | 258 class GetClientInfoCallback; |
257 | 259 |
258 friend class base::RefCounted<ServiceWorkerVersion>; | 260 friend class base::RefCounted<ServiceWorkerVersion>; |
259 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, | 261 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, |
260 ActivateWaitingVersion); | 262 ActivateWaitingVersion); |
261 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); | 263 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); |
262 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); | 264 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); |
263 typedef ServiceWorkerVersion self; | 265 typedef ServiceWorkerVersion self; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 const ServiceWorkerResponse& response); | 307 const ServiceWorkerResponse& response); |
306 void OnSyncEventFinished(int request_id); | 308 void OnSyncEventFinished(int request_id); |
307 void OnNotificationClickEventFinished(int request_id); | 309 void OnNotificationClickEventFinished(int request_id); |
308 void OnPushEventFinished(int request_id, | 310 void OnPushEventFinished(int request_id, |
309 blink::WebServiceWorkerEventResult result); | 311 blink::WebServiceWorkerEventResult result); |
310 void OnGeofencingEventFinished(int request_id); | 312 void OnGeofencingEventFinished(int request_id); |
311 void OnPostMessageToDocument(int client_id, | 313 void OnPostMessageToDocument(int client_id, |
312 const base::string16& message, | 314 const base::string16& message, |
313 const std::vector<int>& sent_message_port_ids); | 315 const std::vector<int>& sent_message_port_ids); |
314 void OnFocusClient(int request_id, int client_id); | 316 void OnFocusClient(int request_id, int client_id); |
| 317 void OnSkipWaiting(int request_id); |
315 | 318 |
316 void OnFocusClientFinished(int request_id, bool result); | 319 void OnFocusClientFinished(int request_id, bool result); |
| 320 void DidSkipWaiting(int request_id); |
317 void ScheduleStopWorker(); | 321 void ScheduleStopWorker(); |
318 void DoomInternal(); | 322 void DoomInternal(); |
319 | 323 |
320 const int64 version_id_; | 324 const int64 version_id_; |
321 int64 registration_id_; | 325 int64 registration_id_; |
322 GURL script_url_; | 326 GURL script_url_; |
323 GURL scope_; | 327 GURL scope_; |
324 Status status_; | 328 Status status_; |
325 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; | 329 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; |
326 scoped_ptr<ServiceWorkerCacheListener> cache_listener_; | 330 scoped_ptr<ServiceWorkerCacheListener> cache_listener_; |
(...skipping 12 matching lines...) Expand all Loading... |
339 IDMap<GetClientInfoCallback, IDMapOwnPointer> get_client_info_callbacks_; | 343 IDMap<GetClientInfoCallback, IDMapOwnPointer> get_client_info_callbacks_; |
340 | 344 |
341 ControlleeMap controllee_map_; | 345 ControlleeMap controllee_map_; |
342 ControlleeByIDMap controllee_by_id_; | 346 ControlleeByIDMap controllee_by_id_; |
343 base::WeakPtr<ServiceWorkerContextCore> context_; | 347 base::WeakPtr<ServiceWorkerContextCore> context_; |
344 ObserverList<Listener> listeners_; | 348 ObserverList<Listener> listeners_; |
345 ServiceWorkerScriptCacheMap script_cache_map_; | 349 ServiceWorkerScriptCacheMap script_cache_map_; |
346 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_; | 350 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_; |
347 base::OneShotTimer<ServiceWorkerVersion> update_timer_; | 351 base::OneShotTimer<ServiceWorkerVersion> update_timer_; |
348 bool is_doomed_; | 352 bool is_doomed_; |
| 353 std::vector<int> pending_skip_waiting_requests_; |
| 354 bool skip_waiting_; |
349 | 355 |
350 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 356 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
351 | 357 |
352 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 358 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
353 }; | 359 }; |
354 | 360 |
355 } // namespace content | 361 } // namespace content |
356 | 362 |
357 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 363 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |