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 04e7f8443d184a4bc864550b7aeabf6044831b5c..7b6b0f4b56fb3f99a17324786b869d5113ca7eb7 100644 |
--- a/components/offline_pages/background/offliner_policy.h |
+++ b/components/offline_pages/background/offliner_policy.h |
@@ -13,8 +13,31 @@ class OfflinerPolicy { |
public: |
OfflinerPolicy(){}; |
- // TODO(petewil): Implement and add a .cc file. |
- // Eventually this should get data from a finch experiment. |
+ // TODO(petewil): Numbers here are chosen arbitrarily, do the proper studies |
+ // to get good policy numbers. |
+ |
+ // TODO(petewil): Eventually this should get data from a finch experiment. |
+ |
+ // Returns true if we should prefer retrying already tried requests to |
+ // starting new requests to maximize utility of any cached partial results. |
+ bool ShouldPreferTriedRequests() { return true; } |
+ |
+ // Returns true if we should prefer older requests of equal number of tries. |
+ bool ShouldPreferEarlierRequests() { return true; } |
+ |
+ // The max number of times we will retry a request. |
+ int GetMaxRetries() { return 4; } |
dougarnett
2016/07/18 21:45:44
So if retry count instead of try count, this means
dougarnett
2016/07/18 21:45:44
I wonder if we will want to have different values
dougarnett
2016/07/18 21:45:44
Consider defining these values in constants (eg, D
Pete Williamson
2016/07/18 22:52:09
Done (changed to 2)
Pete Williamson
2016/07/18 22:52:09
This is temporary code, we will eventually change
Pete Williamson
2016/07/18 22:52:09
Considering different values for later
|
+ |
+ // How many seconds to keep trying new pages for, before we call it a day |
dougarnett
2016/07/18 21:45:44
"call it a day" may be bad metaphor for a time in
Pete Williamson
2016/07/18 22:52:09
Done.
|
+ // and return to the scheduler for the time being. |
+ int GetBackgroundTimeBudgetInSeconds() { return 170; } |
dougarnett
2016/07/18 21:45:44
GetBackgroundProcessingTimeBudgetSeconds?
Pete Williamson
2016/07/18 22:52:09
Done.
|
+ |
+ // How long do we allow a page to load before giving up on it |
+ int GetSinglePageTimeBudgetInSeconds() { return 120; } |
dougarnett
2016/07/18 21:45:44
GetBackgroundLoadTimeBudgetSeconds?
[not sure abo
|
+ |
+ // How much battery must we have before fetching a page not explicitly |
+ // requested by the user? |
+ int GetBatteryRequiredForSpeculativeOfflining() { return 50; } |
dougarnett
2016/07/18 21:45:44
"Speculative" might carry more meaning that just n
Pete Williamson
2016/07/18 22:52:09
Went with GetMinimumBatteryLevelForNonUserRequestO
|
}; |
} |