| 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; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 bool prefer_retry_count, | 32 bool prefer_retry_count, |
| 33 int max_started_tries, | 33 int max_started_tries, |
| 34 int max_completed_tries) | 34 int max_completed_tries) |
| 35 : prefer_untried_requests_(prefer_untried), | 35 : prefer_untried_requests_(prefer_untried), |
| 36 prefer_earlier_requests_(prefer_earlier), | 36 prefer_earlier_requests_(prefer_earlier), |
| 37 retry_count_is_more_important_than_recency_(prefer_retry_count), | 37 retry_count_is_more_important_than_recency_(prefer_retry_count), |
| 38 max_started_tries_(max_started_tries), | 38 max_started_tries_(max_started_tries), |
| 39 max_completed_tries_(max_completed_tries) {} | 39 max_completed_tries_(max_completed_tries) {} |
| 40 | 40 |
| 41 // TODO(petewil): Numbers here are chosen arbitrarily, do the proper studies | 41 // TODO(petewil): Numbers here are chosen arbitrarily, do the proper studies |
| 42 // to get good policy numbers. | 42 // to get good policy numbers. Eventually this should get data from a finch |
| 43 | 43 // experiment. |
| 44 // TODO(petewil): Eventually this should get data from a finch experiment. | |
| 45 | 44 |
| 46 // Returns true if we should prefer retrying lesser tried requests. | 45 // Returns true if we should prefer retrying lesser tried requests. |
| 47 bool ShouldPreferUntriedRequests() const { return prefer_untried_requests_; } | 46 bool ShouldPreferUntriedRequests() const { return prefer_untried_requests_; } |
| 48 | 47 |
| 49 // Returns true if we should prefer older requests of equal number of tries. | 48 // Returns true if we should prefer older requests of equal number of tries. |
| 50 bool ShouldPreferEarlierRequests() const { return prefer_earlier_requests_; } | 49 bool ShouldPreferEarlierRequests() const { return prefer_earlier_requests_; } |
| 51 | 50 |
| 52 // Returns true if retry count is considered more important than recency in | 51 // Returns true if retry count is considered more important than recency in |
| 53 // picking which request to try next. | 52 // picking which request to try next. |
| 54 bool RetryCountIsMoreImportantThanRecency() const { | 53 bool RetryCountIsMoreImportantThanRecency() const { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 private: | 99 private: |
| 101 bool prefer_untried_requests_; | 100 bool prefer_untried_requests_; |
| 102 bool prefer_earlier_requests_; | 101 bool prefer_earlier_requests_; |
| 103 bool retry_count_is_more_important_than_recency_; | 102 bool retry_count_is_more_important_than_recency_; |
| 104 int max_started_tries_; | 103 int max_started_tries_; |
| 105 int max_completed_tries_; | 104 int max_completed_tries_; |
| 106 }; | 105 }; |
| 107 } | 106 } |
| 108 | 107 |
| 109 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ | 108 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ |
| OLD | NEW |