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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 const std::string& status_message); | 298 const std::string& status_message); |
299 | 299 |
300 // Sets the status code to pass to StartWorker callbacks if start fails. | 300 // Sets the status code to pass to StartWorker callbacks if start fails. |
301 void SetStartWorkerStatusCode(ServiceWorkerStatusCode status); | 301 void SetStartWorkerStatusCode(ServiceWorkerStatusCode status); |
302 | 302 |
303 // Sets this version's status to REDUNDANT and deletes its resources. | 303 // Sets this version's status to REDUNDANT and deletes its resources. |
304 // The version must not have controllees. | 304 // The version must not have controllees. |
305 void Doom(); | 305 void Doom(); |
306 bool is_redundant() const { return status_ == REDUNDANT; } | 306 bool is_redundant() const { return status_ == REDUNDANT; } |
307 | 307 |
| 308 // The max-age value. |
| 309 base::TimeDelta max_age() const { return max_age_; } |
| 310 void set_max_age(base::TimeDelta max_age) { max_age_ = max_age; } |
| 311 |
308 bool skip_waiting() const { return skip_waiting_; } | 312 bool skip_waiting() const { return skip_waiting_; } |
309 void set_skip_waiting(bool skip_waiting) { skip_waiting_ = skip_waiting; } | 313 void set_skip_waiting(bool skip_waiting) { skip_waiting_ = skip_waiting; } |
310 | 314 |
311 bool force_bypass_cache_for_scripts() { | 315 bool force_bypass_cache_for_scripts() { |
312 return force_bypass_cache_for_scripts_; | 316 return force_bypass_cache_for_scripts_; |
313 } | 317 } |
314 void set_force_bypass_cache_for_scripts(bool force_bypass_cache_for_scripts) { | 318 void set_force_bypass_cache_for_scripts(bool force_bypass_cache_for_scripts) { |
315 force_bypass_cache_for_scripts_ = force_bypass_cache_for_scripts; | 319 force_bypass_cache_for_scripts_ = force_bypass_cache_for_scripts; |
316 } | 320 } |
317 | 321 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 // to update once the worker stops, but will also update if it stays alive too | 604 // to update once the worker stops, but will also update if it stays alive too |
601 // long. | 605 // long. |
602 base::TimeTicks stale_time_; | 606 base::TimeTicks stale_time_; |
603 | 607 |
604 // New requests are added to |requests_| along with their entry in a callback | 608 // New requests are added to |requests_| along with their entry in a callback |
605 // map. The timeout timer periodically checks |requests_| for entries that | 609 // map. The timeout timer periodically checks |requests_| for entries that |
606 // should time out or have already been fulfilled (i.e., removed from the | 610 // should time out or have already been fulfilled (i.e., removed from the |
607 // callback map). | 611 // callback map). |
608 std::queue<RequestInfo> requests_; | 612 std::queue<RequestInfo> requests_; |
609 | 613 |
| 614 base::TimeDelta max_age_; |
610 bool skip_waiting_ = false; | 615 bool skip_waiting_ = false; |
611 bool skip_recording_startup_time_ = false; | 616 bool skip_recording_startup_time_ = false; |
612 bool force_bypass_cache_for_scripts_ = false; | 617 bool force_bypass_cache_for_scripts_ = false; |
613 bool is_update_scheduled_ = false; | 618 bool is_update_scheduled_ = false; |
614 bool in_dtor_ = false; | 619 bool in_dtor_ = false; |
615 | 620 |
616 std::vector<int> pending_skip_waiting_requests_; | 621 std::vector<int> pending_skip_waiting_requests_; |
617 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; | 622 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; |
618 | 623 |
619 // The status when StartWorker was invoked. Used for UMA. | 624 // The status when StartWorker was invoked. Used for UMA. |
620 Status prestart_status_ = NEW; | 625 Status prestart_status_ = NEW; |
621 // If not OK, the reason that StartWorker failed. Used for | 626 // If not OK, the reason that StartWorker failed. Used for |
622 // running |start_callbacks_|. | 627 // running |start_callbacks_|. |
623 ServiceWorkerStatusCode start_worker_status_ = SERVICE_WORKER_OK; | 628 ServiceWorkerStatusCode start_worker_status_ = SERVICE_WORKER_OK; |
624 | 629 |
625 scoped_ptr<PingController> ping_controller_; | 630 scoped_ptr<PingController> ping_controller_; |
626 scoped_ptr<Metrics> metrics_; | 631 scoped_ptr<Metrics> metrics_; |
627 | 632 |
628 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 633 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
629 | 634 |
630 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 635 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
631 }; | 636 }; |
632 | 637 |
633 } // namespace content | 638 } // namespace content |
634 | 639 |
635 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 640 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |