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

Side by Side Diff: components/offline_pages/background/offliner_policy.h

Issue 2420503002: [Offline Pages] Define separate watchdog timeout for concurrent bg loads (Closed)
Patch Set: Cleaned up 16 lint errors from "git cl lint" 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_
7 7
8 namespace { 8 namespace {
9 const int kMaxStartedTries = 4; 9 const int kMaxStartedTries = 4;
10 const int kMaxCompletedTries = 1; 10 const int kMaxCompletedTries = 1;
11 const int kBackgroundProcessingTimeBudgetSeconds = 170; 11 const int kBackgroundProcessingTimeBudgetSeconds = 170;
12 const int kSinglePageTimeLimitSeconds = 120; 12 const int kSinglePageTimeLimitWhenBackgroundScheduledSeconds = 120;
13 const int kSinglePageTimeLimitForImmediateLoadSeconds = 300;
13 const int kRequestExpirationTimeInSeconds = 60 * 60 * 24 * 7; 14 const int kRequestExpirationTimeInSeconds = 60 * 60 * 24 * 7;
14 } // namespace 15 } // namespace
15 16
16 namespace offline_pages { 17 namespace offline_pages {
17 18
18 // Policy for the Background Offlining system. Some policy will belong to the 19 // Policy for the Background Offlining system. Some policy will belong to the
19 // RequestCoordinator, some to the RequestQueue, and some to the Offliner. 20 // RequestCoordinator, some to the RequestQueue, and some to the Offliner.
20 class OfflinerPolicy { 21 class OfflinerPolicy {
21 public: 22 public:
22 OfflinerPolicy() 23 OfflinerPolicy()
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // plugged in, we should raise this somewhat higher. 80 // plugged in, we should raise this somewhat higher.
80 return 25; 81 return 25;
81 } 82 }
82 83
83 // How many seconds to keep trying new pages for, before we give up, and 84 // How many seconds to keep trying new pages for, before we give up, and
84 // return to the scheduler. 85 // return to the scheduler.
85 int GetBackgroundProcessingTimeBudgetSeconds() const { 86 int GetBackgroundProcessingTimeBudgetSeconds() const {
86 return kBackgroundProcessingTimeBudgetSeconds; 87 return kBackgroundProcessingTimeBudgetSeconds;
87 } 88 }
88 89
89 // How long do we allow a page to load before giving up on it 90 // How long do we allow a page to load before giving up on it when
90 int GetSinglePageTimeLimitInSeconds() const { 91 // background loading was scheduled.
91 return kSinglePageTimeLimitSeconds; 92 int GetSinglePageTimeLimitWhenBackgroundScheduledInSeconds() const {
93 return kSinglePageTimeLimitWhenBackgroundScheduledSeconds;
94 }
95
96 // How long do we allow a page to load before giving up on it when
97 // immediately background loading.
98 int GetSinglePageTimeLimitForImmediateLoadInSeconds() const {
99 return kSinglePageTimeLimitForImmediateLoadSeconds;
92 } 100 }
93 101
94 // How long we allow requests to remain in the system before giving up. 102 // How long we allow requests to remain in the system before giving up.
95 int GetRequestExpirationTimeInSeconds() const { 103 int GetRequestExpirationTimeInSeconds() const {
96 return kRequestExpirationTimeInSeconds; 104 return kRequestExpirationTimeInSeconds;
97 } 105 }
98 106
99 private: 107 private:
100 bool prefer_untried_requests_; 108 bool prefer_untried_requests_;
101 bool prefer_earlier_requests_; 109 bool prefer_earlier_requests_;
102 bool retry_count_is_more_important_than_recency_; 110 bool retry_count_is_more_important_than_recency_;
103 int max_started_tries_; 111 int max_started_tries_;
104 int max_completed_tries_; 112 int max_completed_tries_;
105 }; 113 };
106 } 114 } // namespace offline_pages
115
107 116
108 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ 117 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_
OLDNEW
« 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