Chromium Code Reviews| 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_BACKGROUND_OFFLINER_POLICY_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ |
| 7 | 7 |
| 8 namespace { | 8 namespace { |
| 9 const int kMaxStartedTries = 4; | 9 const int kMaxStartedTries = 4; |
| 10 const int kMaxCompletedTries = 1; | 10 const int kMaxCompletedTries = 1; |
| 11 const int kBackgroundProcessingTimeBudgetSeconds = 170; | 11 const int kBackgroundProcessingTimeBudgetSeconds = 170; |
| 12 const int kSinglePageTimeLimitSeconds = 120; | 12 const int kSinglePageTimeLimitWhenBackgroundScheduledSeconds = 120; |
| 13 const int kSinglePageTimeLimitForConcurrentLoadSeconds = 300; | |
|
Pete Williamson
2016/10/12 22:33:24
I wonder if we can improve the naming here a bit m
dougarnett
2016/10/13 19:46:44
Done.
| |
| 13 const int kRequestExpirationTimeInSeconds = 60 * 60 * 24 * 7; | 14 const int kRequestExpirationTimeInSeconds = 60 * 60 * 24 * 7; |
| 14 } // namespace | 15 } // namespace |
| 15 | 16 |
| 16 namespace offline_pages { | 17 namespace offline_pages { |
| 17 | 18 |
| 18 // Policy for the Background Offlining system. Some policy will belong to the | 19 // Policy for the Background Offlining system. Some policy will belong to the |
| 19 // RequestCoordinator, some to the RequestQueue, and some to the Offliner. | 20 // RequestCoordinator, some to the RequestQueue, and some to the Offliner. |
| 20 class OfflinerPolicy { | 21 class OfflinerPolicy { |
| 21 public: | 22 public: |
| 22 OfflinerPolicy() | 23 OfflinerPolicy() |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 return 25; | 81 return 25; |
| 81 } | 82 } |
| 82 | 83 |
| 83 // How many seconds to keep trying new pages for, before we give up, and | 84 // How many seconds to keep trying new pages for, before we give up, and |
| 84 // return to the scheduler. | 85 // return to the scheduler. |
| 85 int GetBackgroundProcessingTimeBudgetSeconds() const { | 86 int GetBackgroundProcessingTimeBudgetSeconds() const { |
| 86 return kBackgroundProcessingTimeBudgetSeconds; | 87 return kBackgroundProcessingTimeBudgetSeconds; |
| 87 } | 88 } |
| 88 | 89 |
| 89 // How long do we allow a page to load before giving up on it | 90 // How long do we allow a page to load before giving up on it |
| 90 int GetSinglePageTimeLimitInSeconds() const { | 91 int GetSinglePageTimeLimitInSeconds(bool is_background_scheduled) const { |
|
Pete Williamson
2016/10/12 22:33:24
maybe rename the variable to indicate scheduled_fr
dougarnett
2016/10/13 19:46:44
trying separate methods
| |
| 91 return kSinglePageTimeLimitSeconds; | 92 return is_background_scheduled |
| 93 ? kSinglePageTimeLimitWhenBackgroundScheduledSeconds | |
| 94 : kSinglePageTimeLimitForConcurrentLoadSeconds; | |
| 92 } | 95 } |
| 93 | 96 |
| 94 // How long we allow requests to remain in the system before giving up. | 97 // How long we allow requests to remain in the system before giving up. |
| 95 int GetRequestExpirationTimeInSeconds() const { | 98 int GetRequestExpirationTimeInSeconds() const { |
| 96 return kRequestExpirationTimeInSeconds; | 99 return kRequestExpirationTimeInSeconds; |
| 97 } | 100 } |
| 98 | 101 |
| 99 private: | 102 private: |
| 100 bool prefer_untried_requests_; | 103 bool prefer_untried_requests_; |
| 101 bool prefer_earlier_requests_; | 104 bool prefer_earlier_requests_; |
| 102 bool retry_count_is_more_important_than_recency_; | 105 bool retry_count_is_more_important_than_recency_; |
| 103 int max_started_tries_; | 106 int max_started_tries_; |
| 104 int max_completed_tries_; | 107 int max_completed_tries_; |
| 105 }; | 108 }; |
| 106 } | 109 } |
| 107 | 110 |
| 108 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ | 111 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ |
| OLD | NEW |