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

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

Issue 2776203003: Revert of [Offline Pages] Add Android version check for timeout in offliner policy. (Closed)
Patch Set: Created 3 years, 9 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/core/background/pick_request_task_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/core/background/offliner_policy.h
diff --git a/components/offline_pages/core/background/offliner_policy.h b/components/offline_pages/core/background/offliner_policy.h
index b4fc28c0f7e88fff7f79046ac12de603acfe9be1..d828d4c6ea6ba5992bad1b020b6c41bc5ddf0509 100644
--- a/components/offline_pages/core/background/offliner_policy.h
+++ b/components/offline_pages/core/background/offliner_policy.h
@@ -4,8 +4,6 @@
#ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_POLICY_H_
#define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_POLICY_H_
-
-#include "base/sys_info.h"
namespace {
// The max number of started tries is to guard against pages that make the
@@ -19,21 +17,12 @@
// By the time we get to a week, the user has forgotten asking for a page.
const int kRequestExpirationTimeInSeconds = 60 * 60 * 24 * 7;
-// Scheduled background processing time limits for doze mode, which requires
-// Android version >= 6.0 (API level >= 23). Otherwise the scheduled background
-// processing time should be the same as immediate loading (4 min 50 secs), it's
-// capped by the Prerenderer's 5 minute timeout.
+// Scheduled background processing time limits.
const int kDozeModeBackgroundServiceWindowSeconds = 60 * 3;
const int kDefaultBackgroundProcessingTimeBudgetSeconds =
kDozeModeBackgroundServiceWindowSeconds - 10;
const int kSinglePageTimeLimitWhenBackgroundScheduledSeconds =
kDozeModeBackgroundServiceWindowSeconds - 10;
-
-const int kNonDozeModeBackgroundServiceWindowSeconds = 60 * 5;
-const int kNonDozeDefaultBackgroundProcessingTimeBudgetSeconds =
- kNonDozeModeBackgroundServiceWindowSeconds - 10;
-const int kNonDozeSinglePageTimeLimitWhenBackgroundScheduledSeconds =
- kNonDozeModeBackgroundServiceWindowSeconds - 10;
// Immediate processing time limits. Note: experiments on GIN-2g-poor show many
// page requests took 3 or 4 attempts in background scheduled mode with timeout
@@ -56,29 +45,24 @@
prefer_earlier_requests_(true),
retry_count_is_more_important_than_recency_(true),
max_started_tries_(kMaxStartedTries),
- max_completed_tries_(kMaxCompletedTries) {
- int32_t os_major_version = 0;
- int32_t os_minor_version = 0;
- int32_t os_bugfix_version = 0;
- base::SysInfo::OperatingSystemVersionNumbers(
- &os_major_version, &os_minor_version, &os_bugfix_version);
- if (os_major_version < 6)
- has_doze_mode_ = false;
- else
- has_doze_mode_ = true;
- }
+ max_completed_tries_(kMaxCompletedTries),
+ background_scheduled_processing_time_budget_(
+ kDefaultBackgroundProcessingTimeBudgetSeconds) {}
// Constructor for unit tests.
OfflinerPolicy(bool prefer_untried,
bool prefer_earlier,
bool prefer_retry_count,
int max_started_tries,
- int max_completed_tries)
+ int max_completed_tries,
+ int background_processing_time_budget)
: prefer_untried_requests_(prefer_untried),
prefer_earlier_requests_(prefer_earlier),
retry_count_is_more_important_than_recency_(prefer_retry_count),
max_started_tries_(max_started_tries),
- max_completed_tries_(max_completed_tries) {}
+ max_completed_tries_(max_completed_tries),
+ background_scheduled_processing_time_budget_(
+ background_processing_time_budget) {}
// TODO(petewil): Numbers here are chosen arbitrarily, do the proper studies
// to get good policy numbers. Eventually this should get data from a finch
@@ -125,9 +109,7 @@
// TODO(dougarnett): Consider parameterizing these time limit/budget
// calls with processing mode.
int GetProcessingTimeBudgetWhenBackgroundScheduledInSeconds() const {
- if (has_doze_mode_)
- return kDefaultBackgroundProcessingTimeBudgetSeconds;
- return kNonDozeDefaultBackgroundProcessingTimeBudgetSeconds;
+ return background_scheduled_processing_time_budget_;
}
// How many seconds to keep trying new pages for, before we give up, when
@@ -139,9 +121,7 @@
// How long do we allow a page to load before giving up on it when
// background loading was scheduled.
int GetSinglePageTimeLimitWhenBackgroundScheduledInSeconds() const {
- if (has_doze_mode_)
- return kSinglePageTimeLimitWhenBackgroundScheduledSeconds;
- return kNonDozeSinglePageTimeLimitWhenBackgroundScheduledSeconds;
+ return kSinglePageTimeLimitWhenBackgroundScheduledSeconds;
}
// How long do we allow a page to load before giving up on it when
@@ -159,9 +139,9 @@
bool prefer_untried_requests_;
bool prefer_earlier_requests_;
bool retry_count_is_more_important_than_recency_;
- bool has_doze_mode_;
int max_started_tries_;
int max_completed_tries_;
+ int background_scheduled_processing_time_budget_;
};
} // namespace offline_pages
« no previous file with comments | « no previous file | components/offline_pages/core/background/pick_request_task_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698