| 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 <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 const net::HttpResponseInfo* GetMainScriptHttpResponseInfo(); | 297 const net::HttpResponseInfo* GetMainScriptHttpResponseInfo(); |
| 298 | 298 |
| 299 private: | 299 private: |
| 300 friend class base::RefCounted<ServiceWorkerVersion>; | 300 friend class base::RefCounted<ServiceWorkerVersion>; |
| 301 friend class ServiceWorkerURLRequestJobTest; | 301 friend class ServiceWorkerURLRequestJobTest; |
| 302 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, | 302 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, |
| 303 ActivateWaitingVersion); | 303 ActivateWaitingVersion); |
| 304 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); | 304 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); |
| 305 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, KeepAlive); | 305 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, KeepAlive); |
| 306 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); | 306 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); |
| 307 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, SetDevToolsAttached); |
| 307 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerFailToStartTest, Timeout); | 308 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerFailToStartTest, Timeout); |
| 308 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, | 309 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, |
| 309 TimeoutStartingWorker); | 310 TimeoutStartingWorker); |
| 310 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, | 311 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, |
| 311 TimeoutWorkerInEvent); | 312 TimeoutWorkerInEvent); |
| 312 friend class ServiceWorkerVersionBrowserTest; | 313 friend class ServiceWorkerVersionBrowserTest; |
| 313 | 314 |
| 314 typedef ServiceWorkerVersion self; | 315 typedef ServiceWorkerVersion self; |
| 315 | 316 |
| 316 enum PingState { NOT_PINGING, PINGING, PING_TIMED_OUT }; | 317 enum PingState { NOT_PINGING, PINGING, PING_TIMED_OUT }; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 389 |
| 389 void OnFocusClientFinished(int request_id, | 390 void OnFocusClientFinished(int request_id, |
| 390 const std::string& client_uuid, | 391 const std::string& client_uuid, |
| 391 const ServiceWorkerClientInfo& client); | 392 const ServiceWorkerClientInfo& client); |
| 392 | 393 |
| 393 void DidEnsureLiveRegistrationForStartWorker( | 394 void DidEnsureLiveRegistrationForStartWorker( |
| 394 bool pause_after_download, | 395 bool pause_after_download, |
| 395 const StatusCallback& callback, | 396 const StatusCallback& callback, |
| 396 ServiceWorkerStatusCode status, | 397 ServiceWorkerStatusCode status, |
| 397 const scoped_refptr<ServiceWorkerRegistration>& protect); | 398 const scoped_refptr<ServiceWorkerRegistration>& protect); |
| 399 void StartWorkerInternal(bool pause_after_download); |
| 400 |
| 398 void DidSkipWaiting(int request_id); | 401 void DidSkipWaiting(int request_id); |
| 399 void DidClaimClients(int request_id, ServiceWorkerStatusCode status); | 402 void DidClaimClients(int request_id, ServiceWorkerStatusCode status); |
| 400 void DidGetClients( | 403 void DidGetClients( |
| 401 int request_id, const std::vector<ServiceWorkerClientInfo>& clients); | 404 int request_id, const std::vector<ServiceWorkerClientInfo>& clients); |
| 402 | 405 |
| 403 // The timeout timer periodically calls OnTimeoutTimer, which stops the worker | 406 // The timeout timer periodically calls OnTimeoutTimer, which stops the worker |
| 404 // if it is excessively idle or unresponsive to ping. | 407 // if it is excessively idle or unresponsive to ping. |
| 405 void StartTimeoutTimer(); | 408 void StartTimeoutTimer(); |
| 406 void StopTimeoutTimer(); | 409 void StopTimeoutTimer(); |
| 407 void OnTimeoutTimer(); | 410 void OnTimeoutTimer(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 base::RepeatingTimer<ServiceWorkerVersion> timeout_timer_; | 466 base::RepeatingTimer<ServiceWorkerVersion> timeout_timer_; |
| 464 // Holds the time the worker last started being considered idle. | 467 // Holds the time the worker last started being considered idle. |
| 465 base::TimeTicks idle_time_; | 468 base::TimeTicks idle_time_; |
| 466 // Holds the time that an outstanding ping was sent to the worker. | 469 // Holds the time that an outstanding ping was sent to the worker. |
| 467 base::TimeTicks ping_time_; | 470 base::TimeTicks ping_time_; |
| 468 // The state of the ping protocol. | 471 // The state of the ping protocol. |
| 469 PingState ping_state_; | 472 PingState ping_state_; |
| 470 // Holds the time that the outstanding StartWorker() request started. | 473 // Holds the time that the outstanding StartWorker() request started. |
| 471 base::TimeTicks start_time_; | 474 base::TimeTicks start_time_; |
| 472 | 475 |
| 473 bool is_doomed_; | 476 bool is_doomed_ = false; |
| 477 bool skip_waiting_ = false; |
| 478 bool skip_recording_startup_time_ = false; |
| 479 |
| 474 std::vector<int> pending_skip_waiting_requests_; | 480 std::vector<int> pending_skip_waiting_requests_; |
| 475 bool skip_waiting_; | |
| 476 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; | 481 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; |
| 477 | 482 |
| 478 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 483 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
| 479 | 484 |
| 480 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 485 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
| 481 }; | 486 }; |
| 482 | 487 |
| 483 } // namespace content | 488 } // namespace content |
| 484 | 489 |
| 485 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 490 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| OLD | NEW |