Chromium Code Reviews| Index: components/offline_pages/background/offliner_policy.h |
| diff --git a/components/offline_pages/background/offliner_policy.h b/components/offline_pages/background/offliner_policy.h |
| index ee2cc0db615b05a614ff0ce23379ac3e1fa54196..36d805df0d7a24b967cd01834c7dc83fa17c6802 100644 |
| --- a/components/offline_pages/background/offliner_policy.h |
| +++ b/components/offline_pages/background/offliner_policy.h |
| @@ -18,7 +18,16 @@ namespace offline_pages { |
| // RequestCoordinator, some to the RequestQueue, and some to the Offliner. |
| class OfflinerPolicy { |
| public: |
| - OfflinerPolicy(){}; |
| + OfflinerPolicy() |
| + : prefer_untried_requests_(false), |
|
fgorski
2016/07/25 16:22:57
please put that into the .cc file.
Pete Williamson
2016/07/25 19:54:20
There is no .cc file yet. It will be coming in a
|
| + prefer_earlier_requests_(true), |
| + retry_count_is_more_important_than_recency_(true) {} |
| + |
| + OfflinerPolicy(bool prefer_untried, bool prefer_earlier, |
|
fgorski
2016/07/25 16:22:57
same here + git cl format.
Pete Williamson
2016/07/25 19:54:20
Format done
|
| + bool prefer_retry_count) |
| + : prefer_untried_requests_(prefer_untried), |
| + prefer_earlier_requests_(prefer_earlier), |
| + retry_count_is_more_important_than_recency_(prefer_retry_count) {} |
| // TODO(petewil): Numbers here are chosen arbitrarily, do the proper studies |
| // to get good policy numbers. |
| @@ -26,14 +35,16 @@ class OfflinerPolicy { |
| // TODO(petewil): Eventually this should get data from a finch experiment. |
| // Returns true if we should prefer retrying lesser tried requests. |
| - bool ShouldPreferUntriedRequests() { return false; } |
| + bool ShouldPreferUntriedRequests() { return prefer_untried_requests_; } |
|
fgorski
2016/07/25 16:22:57
Can this method be marked const?
Same for the 2 th
Pete Williamson
2016/07/25 19:54:21
Done.
|
| // Returns true if we should prefer older requests of equal number of tries. |
| - bool ShouldPreferEarlierRequests() { return true; } |
| + bool ShouldPreferEarlierRequests() { return prefer_earlier_requests_; } |
| // Returns true if retry count is considered more important than recency in |
| // picking which request to try next. |
| - bool RetryCountIsMoreImportantThanRecency() { return true; } |
| + bool RetryCountIsMoreImportantThanRecency() { |
| + return retry_count_is_more_important_than_recency_; |
| + } |
| // The max number of times we will retry a request. |
| int GetMaxRetries() { return kMaxRetries; } |
| @@ -54,6 +65,11 @@ class OfflinerPolicy { |
| int GetMinimumBatteryPercentageForNonUserRequestOfflining() { |
| return kMinimumBatteryPercentageForNonUserRequestOfflining; |
| } |
| + |
| + private: |
| + bool prefer_untried_requests_; |
| + bool prefer_earlier_requests_; |
| + bool retry_count_is_more_important_than_recency_; |
| }; |
| } |