| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_POLICY_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_POLICY_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_POLICY_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_POLICY_H_ |
| 7 | 7 |
| 8 namespace { | 8 namespace { |
| 9 // The max number of started tries is to guard against pages that make the | 9 // The max number of started tries is to guard against pages that make the |
| 10 // prerenderer crash. It should be greater than or equal to the max number of | 10 // prerenderer crash. It should be greater than or equal to the max number of |
| 11 // completed tries. | 11 // completed tries. |
| 12 const int kMaxStartedTries = 5; | 12 const int kMaxStartedTries = 5; |
| 13 // The number of max completed tries is based on Gin2G-poor testing showing that | 13 // The number of max completed tries is based on Gin2G-poor testing showing that |
| 14 // we often need about 4 tries with a 2 minute window, or 3 retries with a 3 | 14 // we often need about 4 tries with a 2 minute window, or 3 retries with a 3 |
| 15 // minute window. Also, we count one try now for foreground/disabled requests. | 15 // minute window. Also, we count one try now for foreground/disabled requests. |
| 16 const int kMaxCompletedTries = 3; | 16 const int kMaxCompletedTries = 3; |
| 17 // By the time we get to a week, the user has forgotten asking for a page. | 17 // By the time we get to a week, the user has forgotten asking for a page. |
| 18 const int kRequestExpirationTimeInSeconds = 60 * 60 * 24 * 7; | 18 const int kRequestExpirationTimeInSeconds = 60 * 60 * 24 * 7; |
| 19 | 19 |
| 20 // Scheduled background processing time limits. | 20 // Scheduled background processing time limits. |
| 21 const int kDozeModeBackgroundServiceWindowSeconds = 60 * 3; | 21 const int kDozeModeBackgroundServiceWindowSeconds = 60 * 3; |
| 22 const int kDefaultBackgroundProcessingTimeBudgetSeconds = | 22 const int kDefaultBackgroundProcessingTimeBudgetSeconds = |
| 23 kDozeModeBackgroundServiceWindowSeconds - 10; | 23 kDozeModeBackgroundServiceWindowSeconds - 10; |
| 24 const int kSinglePageTimeLimitWhenBackgroundScheduledSeconds = | 24 const int kSinglePageTimeLimitWhenBackgroundScheduledSeconds = |
| 25 kDozeModeBackgroundServiceWindowSeconds - 10; | 25 kDozeModeBackgroundServiceWindowSeconds - 10; |
| 26 | 26 |
| 27 // Immediate processing time limits. | 27 // Immediate processing time limits. Note: experiments on GIN-2g-poor show many |
| 28 // Note: experiments on GIN-2g-poor show many page requests took 3 or 4 | 28 // page requests took 3 or 4 attempts in background scheduled mode with timeout |
| 29 // attempts in background scheduled mode with timeout of 2 minutes. So for | 29 // of 2 minutes. So for immediate processing mode, give page requests just under |
| 30 // immediate processing mode, give page requests 4 times that limit (8 min). | 30 // 5 minutes, which is the timeout limit for the prerender itself. Then budget |
| 31 // Then budget up to 5 of those requests in processing window. | 31 // up to 3 of those requests in processing window. |
| 32 const int kSinglePageTimeLimitForImmediateLoadSeconds = 60 * 8; | 32 const int kSinglePageTimeLimitForImmediateLoadSeconds = 60 * 4 + 50; |
| 33 const int kImmediateLoadProcessingTimeBudgetSeconds = | 33 const int kImmediateLoadProcessingTimeBudgetSeconds = |
| 34 kSinglePageTimeLimitForImmediateLoadSeconds * 5; | 34 kSinglePageTimeLimitForImmediateLoadSeconds * 5; |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 namespace offline_pages { | 37 namespace offline_pages { |
| 38 | 38 |
| 39 // Policy for the Background Offlining system. Some policy will belong to the | 39 // Policy for the Background Offlining system. Some policy will belong to the |
| 40 // RequestCoordinator, some to the RequestQueue, and some to the Offliner. | 40 // RequestCoordinator, some to the RequestQueue, and some to the Offliner. |
| 41 class OfflinerPolicy { | 41 class OfflinerPolicy { |
| 42 public: | 42 public: |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 bool prefer_untried_requests_; | 139 bool prefer_untried_requests_; |
| 140 bool prefer_earlier_requests_; | 140 bool prefer_earlier_requests_; |
| 141 bool retry_count_is_more_important_than_recency_; | 141 bool retry_count_is_more_important_than_recency_; |
| 142 int max_started_tries_; | 142 int max_started_tries_; |
| 143 int max_completed_tries_; | 143 int max_completed_tries_; |
| 144 int background_scheduled_processing_time_budget_; | 144 int background_scheduled_processing_time_budget_; |
| 145 }; | 145 }; |
| 146 } // namespace offline_pages | 146 } // namespace offline_pages |
| 147 | 147 |
| 148 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_POLICY_H_ | 148 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_POLICY_H_ |
| OLD | NEW |