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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 blink::WebServiceWorkerEventResult result); | 287 blink::WebServiceWorkerEventResult result); |
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 void OnGeofencingEventFinished(int request_id); | 293 void OnGeofencingEventFinished(int request_id); |
292 void OnPostMessageToDocument(int client_id, | 294 void OnPostMessageToDocument(int client_id, |
293 const base::string16& message, | 295 const base::string16& message, |
294 const std::vector<int>& sent_message_port_ids); | 296 const std::vector<int>& sent_message_port_ids); |
| 297 void OnSkipWaiting(int request_id); |
295 | 298 |
| 299 void DidSkipWaiting(int request_id); |
296 void ScheduleStopWorker(); | 300 void ScheduleStopWorker(); |
297 void DoomInternal(); | 301 void DoomInternal(); |
298 | 302 |
299 const int64 version_id_; | 303 const int64 version_id_; |
300 int64 registration_id_; | 304 int64 registration_id_; |
301 GURL script_url_; | 305 GURL script_url_; |
302 GURL scope_; | 306 GURL scope_; |
303 Status status_; | 307 Status status_; |
304 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; | 308 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; |
305 scoped_ptr<ServiceWorkerCacheListener> cache_listener_; | 309 scoped_ptr<ServiceWorkerCacheListener> cache_listener_; |
(...skipping 10 matching lines...) Expand all Loading... |
316 IDMap<StatusCallback, IDMapOwnPointer> geofencing_callbacks_; | 320 IDMap<StatusCallback, IDMapOwnPointer> geofencing_callbacks_; |
317 | 321 |
318 ControlleeMap controllee_map_; | 322 ControlleeMap controllee_map_; |
319 ControlleeByIDMap controllee_by_id_; | 323 ControlleeByIDMap controllee_by_id_; |
320 base::WeakPtr<ServiceWorkerContextCore> context_; | 324 base::WeakPtr<ServiceWorkerContextCore> context_; |
321 ObserverList<Listener> listeners_; | 325 ObserverList<Listener> listeners_; |
322 ServiceWorkerScriptCacheMap script_cache_map_; | 326 ServiceWorkerScriptCacheMap script_cache_map_; |
323 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_; | 327 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_; |
324 base::OneShotTimer<ServiceWorkerVersion> update_timer_; | 328 base::OneShotTimer<ServiceWorkerVersion> update_timer_; |
325 bool is_doomed_; | 329 bool is_doomed_; |
| 330 std::vector<int> pending_skip_waiting_requests_; |
| 331 bool skip_waiting_; |
326 | 332 |
327 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 333 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
328 | 334 |
329 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 335 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
330 }; | 336 }; |
331 | 337 |
332 } // namespace content | 338 } // namespace content |
333 | 339 |
334 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 340 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |