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 <queue> | 9 #include <queue> |
10 #include <set> | 10 #include <set> |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, SetDevToolsAttached); | 312 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, SetDevToolsAttached); |
313 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerWaitForeverInFetchTest, RequestTimeout); | 313 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerWaitForeverInFetchTest, RequestTimeout); |
314 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerFailToStartTest, Timeout); | 314 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerFailToStartTest, Timeout); |
315 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, | 315 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, |
316 TimeoutStartingWorker); | 316 TimeoutStartingWorker); |
317 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, | 317 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, |
318 TimeoutWorkerInEvent); | 318 TimeoutWorkerInEvent); |
319 friend class ServiceWorkerVersionBrowserTest; | 319 friend class ServiceWorkerVersionBrowserTest; |
320 | 320 |
321 typedef ServiceWorkerVersion self; | 321 typedef ServiceWorkerVersion self; |
| 322 using ServiceWorkerClients = std::vector<ServiceWorkerClientInfo>; |
322 | 323 |
323 enum RequestType { | 324 enum RequestType { |
324 REQUEST_ACTIVATE, | 325 REQUEST_ACTIVATE, |
325 REQUEST_INSTALL, | 326 REQUEST_INSTALL, |
326 REQUEST_FETCH, | 327 REQUEST_FETCH, |
327 REQUEST_SYNC, | 328 REQUEST_SYNC, |
328 REQUEST_NOTIFICATION_CLICK, | 329 REQUEST_NOTIFICATION_CLICK, |
329 REQUEST_PUSH, | 330 REQUEST_PUSH, |
330 REQUEST_GEOFENCING, | 331 REQUEST_GEOFENCING, |
331 REQUEST_CROSS_ORIGIN_CONNECT | 332 REQUEST_CROSS_ORIGIN_CONNECT |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 const ServiceWorkerClientInfo& client); | 419 const ServiceWorkerClientInfo& client); |
419 | 420 |
420 void DidEnsureLiveRegistrationForStartWorker( | 421 void DidEnsureLiveRegistrationForStartWorker( |
421 bool pause_after_download, | 422 bool pause_after_download, |
422 const StatusCallback& callback, | 423 const StatusCallback& callback, |
423 ServiceWorkerStatusCode status, | 424 ServiceWorkerStatusCode status, |
424 const scoped_refptr<ServiceWorkerRegistration>& protect); | 425 const scoped_refptr<ServiceWorkerRegistration>& protect); |
425 void StartWorkerInternal(bool pause_after_download); | 426 void StartWorkerInternal(bool pause_after_download); |
426 | 427 |
427 void DidSkipWaiting(int request_id); | 428 void DidSkipWaiting(int request_id); |
428 void DidGetClients( | 429 |
429 int request_id, const std::vector<ServiceWorkerClientInfo>& clients); | 430 void GetWindowClients(int request_id, |
| 431 const ServiceWorkerClientQueryOptions& options); |
| 432 void DidGetWindowClients(int request_id, |
| 433 const ServiceWorkerClientQueryOptions& options, |
| 434 scoped_ptr<ServiceWorkerClients> clients); |
| 435 void GetNonWindowClients(int request_id, |
| 436 const ServiceWorkerClientQueryOptions& options, |
| 437 ServiceWorkerClients* clients); |
430 | 438 |
431 // The timeout timer periodically calls OnTimeoutTimer, which stops the worker | 439 // The timeout timer periodically calls OnTimeoutTimer, which stops the worker |
432 // if it is excessively idle or unresponsive to ping. | 440 // if it is excessively idle or unresponsive to ping. |
433 void StartTimeoutTimer(); | 441 void StartTimeoutTimer(); |
434 void StopTimeoutTimer(); | 442 void StopTimeoutTimer(); |
435 void OnTimeoutTimer(); | 443 void OnTimeoutTimer(); |
436 | 444 |
437 // The ping protocol is for terminating workers that are taking excessively | 445 // The ping protocol is for terminating workers that are taking excessively |
438 // long executing JavaScript (e.g., stuck in while(true) {}). Periodically a | 446 // long executing JavaScript (e.g., stuck in while(true) {}). Periodically a |
439 // ping IPC is sent to the worker context and if we timeout waiting for a | 447 // ping IPC is sent to the worker context and if we timeout waiting for a |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; | 527 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; |
520 | 528 |
521 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 529 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
522 | 530 |
523 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 531 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
524 }; | 532 }; |
525 | 533 |
526 } // namespace content | 534 } // namespace content |
527 | 535 |
528 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 536 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |