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

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

Issue 2425873003: [Offline Pages] Add evaluation test support in RequestCoordinator. (Closed)
Patch Set: Addressed comments. Created 4 years, 2 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 a82f5e68715a150a86a1dd4ec4d1f1b7755bd974..d3424f39eb7a7b53e568fb8b75789655a990a8dc 100644
--- a/components/offline_pages/background/offliner_policy.h
+++ b/components/offline_pages/background/offliner_policy.h
@@ -8,7 +8,7 @@
namespace {
const int kMaxStartedTries = 4;
const int kMaxCompletedTries = 1;
-const int kBackgroundProcessingTimeBudgetSeconds = 170;
+const int kDefaultBackgroundProcessingTimeBudgetSeconds = 170;
const int kSinglePageTimeLimitWhenBackgroundScheduledSeconds = 120;
const int kSinglePageTimeLimitForImmediateLoadSeconds = 300;
const int kRequestExpirationTimeInSeconds = 60 * 60 * 24 * 7;
@@ -25,19 +25,23 @@ class OfflinerPolicy {
prefer_earlier_requests_(true),
retry_count_is_more_important_than_recency_(false),
max_started_tries_(kMaxStartedTries),
- max_completed_tries_(kMaxCompletedTries) {}
+ max_completed_tries_(kMaxCompletedTries),
+ background_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_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
@@ -84,7 +88,7 @@ class OfflinerPolicy {
// How many seconds to keep trying new pages for, before we give up, and
// return to the scheduler.
int GetBackgroundProcessingTimeBudgetSeconds() const {
- return kBackgroundProcessingTimeBudgetSeconds;
+ return background_processing_time_budget_;
}
// How long do we allow a page to load before giving up on it when
@@ -110,6 +114,7 @@ class OfflinerPolicy {
bool retry_count_is_more_important_than_recency_;
int max_started_tries_;
int max_completed_tries_;
+ int background_processing_time_budget_;
};
} // namespace offline_pages

Powered by Google App Engine
This is Rietveld 408576698