Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Unified Diff: components/offline_pages/background/offliner_policy.h

Issue 2113383002: More detailed implementation of the RequestPicker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix merge Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..ee2cc0db615b05a614ff0ce23379ac3e1fa54196 100644
--- a/components/offline_pages/background/offliner_policy.h
+++ b/components/offline_pages/background/offliner_policy.h
@@ -5,6 +5,13 @@
#ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_
#define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_
+namespace {
+const int kMaxRetries = 2;
+const int kBackgroundTimeBudgetSeconds = 170;
+const int kSinglePageTimeBudgetSeconds = 120;
+const int kMinimumBatteryPercentageForNonUserRequestOfflining = 50;
+} // namespace
+
namespace offline_pages {
// Policy for the Background Offlining system. Some policy will belong to the
@@ -13,8 +20,40 @@ 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 lesser tried requests.
+ bool ShouldPreferUntriedRequests() { return false; }
+
+ // Returns true if we should prefer older requests of equal number of tries.
+ bool ShouldPreferEarlierRequests() { return true; }
+
+ // Returns true if retry count is considered more important than recency in
+ // picking which request to try next.
+ bool RetryCountIsMoreImportantThanRecency() { return true; }
+
+ // The max number of times we will retry a request.
+ int GetMaxRetries() { return kMaxRetries; }
+
+ // How many seconds to keep trying new pages for, before we give up, and
+ // return to the scheduler.
+ int GetBackgroundProcessingTimeBudgetSeconds() {
+ return kBackgroundTimeBudgetSeconds;
+ }
+
+ // How long do we allow a page to load before giving up on it
+ int GetSinglePageTimeBudgetInSeconds() {
+ return kSinglePageTimeBudgetSeconds;
+ }
+
+ // How much battery must we have before fetching a page not explicitly
+ // requested by the user?
+ int GetMinimumBatteryPercentageForNonUserRequestOfflining() {
+ return kMinimumBatteryPercentageForNonUserRequestOfflining;
+ }
};
}
« no previous file with comments | « components/offline_pages/background/device_conditions.h ('k') | components/offline_pages/background/request_coordinator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698