Chromium Code Reviews| Index: content/browser/service_worker/service_worker_version.h |
| diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h |
| index 44079ce1a513ea159ebfc56c3ed4a1eeba30b32c..10956169469f873cf9a5d31adb2d426dc022e5f7 100644 |
| --- a/content/browser/service_worker/service_worker_version.h |
| +++ b/content/browser/service_worker/service_worker_version.h |
| @@ -410,6 +410,12 @@ class CONTENT_EXPORT ServiceWorkerVersion |
| return external_request_uuid_to_request_id_.size(); |
| } |
| + // Returns the amount of time left until the request with the latest |
| + // expiration time expires. |
| + base::TimeDelta remaining_timeout() const { |
| + return max_request_expiration_time_ - tick_clock_->NowTicks(); |
| + } |
| + |
| private: |
| friend class base::RefCounted<ServiceWorkerVersion>; |
| friend class ServiceWorkerMetrics; |
| @@ -787,6 +793,11 @@ class CONTENT_EXPORT ServiceWorkerVersion |
| // to update once the worker stops, but will also update if it stays alive too |
| // long. |
| base::TimeTicks stale_time_; |
| + // The latest expiration time of all requests that have ever been started. In |
| + // particular this is not just the maximum of the expiration times of all |
| + // currently existing requests, but also takes into account the former |
| + // expiration times of finished requests. |
|
falken
2016/12/05 02:31:51
Thanks for the precise comment.
|
| + base::TimeTicks max_request_expiration_time_; |
| // Keeps track of requests for timeout purposes. Requests are sorted by |
| // their expiration time (soonest to expire on top of the priority queue). The |