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

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

Issue 2269173003: Adjust scheduling for non-user requested items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: FGorski CR feedback Created 4 years, 3 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
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d640d2590a8cfae7411d8149ecbd3429f2e6c3b5..66fc7b5fa5547a5b14e0351d653f5b5228939035 100644
--- a/components/offline_pages/background/offliner_policy.h
+++ b/components/offline_pages/background/offliner_policy.h
@@ -10,7 +10,6 @@ const int kMaxStartedTries = 5;
const int kMaxCompletedTries = 1;
const int kBackgroundProcessingTimeBudgetSeconds = 170;
const int kSinglePageTimeLimitSeconds = 120;
-const int kMinimumBatteryPercentageForNonUserRequestOfflining = 50;
const int kRequestExpirationTimeInSeconds = 60 * 60 * 24 * 7;
} // namespace
@@ -65,20 +64,22 @@ class OfflinerPolicy {
// completed, but failed.
int GetMaxCompletedTries() const { return max_completed_tries_; }
- bool PowerRequiredForUserRequestedPage() const { return false; }
-
- bool PowerRequiredForNonUserRequestedPage() const { return true; }
-
- bool UnmeteredNetworkRequiredForUserRequestedPage() const { return false; }
-
- bool UnmeteredNetworkRequiredForNonUserRequestedPage() const { return true; }
+ bool PowerRequired(bool user_requested) const {
+ return (!user_requested);
+ }
- int BatteryPercentageRequiredForUserRequestedPage() const { return 0; }
+ bool UnmeteredNetworkRequired(bool user_requested) const {
+ return !(user_requested);
+ }
- // This is so low because we require the device to be plugged in and charging.
- // If we decide to allow non-user requested pages when not plugged in, we
- // should raise this somewhat higher.
- int BatteryPercentageRequiredForNonUserRequestedPage() const { return 25; }
+ int BatteryPercentageRequired(bool user_requested) const {
+ if (user_requested)
+ return 0;
+ // This is so low because we require the device to be plugged in and
+ // charging. If we decide to allow non-user requested pages when not
+ // plugged in, we should raise this somewhat higher.
+ return 25;
+ }
// How many seconds to keep trying new pages for, before we give up, and
// return to the scheduler.
@@ -96,12 +97,6 @@ class OfflinerPolicy {
return kRequestExpirationTimeInSeconds;
}
- // How much battery must we have before fetching a page not explicitly
- // requested by the user?
- int GetMinimumBatteryPercentageForNonUserRequestOfflining() const {
- return kMinimumBatteryPercentageForNonUserRequestOfflining;
- }
-
private:
bool prefer_untried_requests_;
bool prefer_earlier_requests_;
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698