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

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

Issue 2218403002: Change database scheme - add state and start tracking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Stop clearing last request time Created 4 years, 4 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 5a6591aec46621559a02c1d8e5fbbe9dba42a865..d640d2590a8cfae7411d8149ecbd3429f2e6c3b5 100644
--- a/components/offline_pages/background/offliner_policy.h
+++ b/components/offline_pages/background/offliner_policy.h
@@ -6,7 +6,8 @@
#define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_
namespace {
-const int kMaxTries = 1;
+const int kMaxStartedTries = 5;
+const int kMaxCompletedTries = 1;
const int kBackgroundProcessingTimeBudgetSeconds = 170;
const int kSinglePageTimeLimitSeconds = 120;
const int kMinimumBatteryPercentageForNonUserRequestOfflining = 50;
@@ -22,14 +23,21 @@ class OfflinerPolicy {
OfflinerPolicy()
: prefer_untried_requests_(false),
prefer_earlier_requests_(true),
- retry_count_is_more_important_than_recency_(false) {}
+ retry_count_is_more_important_than_recency_(false),
+ max_started_tries_(kMaxStartedTries),
+ max_completed_tries_(kMaxCompletedTries) {}
+ // Constructor for unit tests.
OfflinerPolicy(bool prefer_untried,
bool prefer_earlier,
- bool prefer_retry_count)
+ bool prefer_retry_count,
+ int max_started_tries,
+ int max_completed_tries)
: prefer_untried_requests_(prefer_untried),
prefer_earlier_requests_(prefer_earlier),
- retry_count_is_more_important_than_recency_(prefer_retry_count) {}
+ retry_count_is_more_important_than_recency_(prefer_retry_count),
+ max_started_tries_(max_started_tries),
+ max_completed_tries_(max_completed_tries) {}
// TODO(petewil): Numbers here are chosen arbitrarily, do the proper studies
// to get good policy numbers.
@@ -48,8 +56,14 @@ class OfflinerPolicy {
return retry_count_is_more_important_than_recency_;
}
- // The max number of times we will retry a request.
- int GetMaxTries() const { return kMaxTries; }
+ // The max number of times we will start a request. Not all started attempts
+ // will complete. This may be caused by prerenderer issues or chromium being
+ // swapped out of memory.
+ int GetMaxStartedTries() const { return max_started_tries_; }
+
+ // The max number of times we will retry a request when the attempt
+ // completed, but failed.
+ int GetMaxCompletedTries() const { return max_completed_tries_; }
bool PowerRequiredForUserRequestedPage() const { return false; }
@@ -92,6 +106,8 @@ class OfflinerPolicy {
bool prefer_untried_requests_;
bool prefer_earlier_requests_;
bool retry_count_is_more_important_than_recency_;
+ int max_started_tries_;
+ int max_completed_tries_;
};
}

Powered by Google App Engine
This is Rietveld 408576698