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

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

Issue 2113383002: More detailed implementation of the RequestPicker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix time check and MeetsConditions check Created 4 years, 5 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
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 offline_pages { 8 namespace offline_pages {
9 9
10 // Policy for the Background Offlining system. Some policy will belong to the 10 // Policy for the Background Offlining system. Some policy will belong to the
11 // RequestCoordinator, some to the RequestQueue, and some to the Offliner. 11 // RequestCoordinator, some to the RequestQueue, and some to the Offliner.
12 class OfflinerPolicy { 12 class OfflinerPolicy {
13 public: 13 public:
14 OfflinerPolicy(){}; 14 OfflinerPolicy(){};
15 15
16 // TODO(petewil): Implement and add a .cc file. 16 // TODO(petewil): Numbers here are chosen arbitrarily, do the proper studies
17 // Eventually this should get data from a finch experiment. 17 // to get good policy numbers.
18
19 // TODO(petewil): Eventually this should get data from a finch experiment.
20
21 // Returns true if we should prefer retrying already tried requests to
22 // starting new requests to maximize utility of any cached partial results.
23 bool ShouldPreferTriedRequests() { return true; }
24
25 // Returns true if we should prefer older requests of equal number of tries.
26 bool ShouldPreferEarlierRequests() { return true; }
27
28 // The max number of times we will retry a request.
29 int GetMaxRetries() { return 4; }
dougarnett 2016/07/18 21:45:44 So if retry count instead of try count, this means
dougarnett 2016/07/18 21:45:44 I wonder if we will want to have different values
dougarnett 2016/07/18 21:45:44 Consider defining these values in constants (eg, D
Pete Williamson 2016/07/18 22:52:09 Done (changed to 2)
Pete Williamson 2016/07/18 22:52:09 This is temporary code, we will eventually change
Pete Williamson 2016/07/18 22:52:09 Considering different values for later
30
31 // How many seconds to keep trying new pages for, before we call it a day
dougarnett 2016/07/18 21:45:44 "call it a day" may be bad metaphor for a time in
Pete Williamson 2016/07/18 22:52:09 Done.
32 // and return to the scheduler for the time being.
33 int GetBackgroundTimeBudgetInSeconds() { return 170; }
dougarnett 2016/07/18 21:45:44 GetBackgroundProcessingTimeBudgetSeconds?
Pete Williamson 2016/07/18 22:52:09 Done.
34
35 // How long do we allow a page to load before giving up on it
36 int GetSinglePageTimeBudgetInSeconds() { return 120; }
dougarnett 2016/07/18 21:45:44 GetBackgroundLoadTimeBudgetSeconds? [not sure abo
37
38 // How much battery must we have before fetching a page not explicitly
39 // requested by the user?
40 int GetBatteryRequiredForSpeculativeOfflining() { return 50; }
dougarnett 2016/07/18 21:45:44 "Speculative" might carry more meaning that just n
Pete Williamson 2016/07/18 22:52:09 Went with GetMinimumBatteryLevelForNonUserRequestO
18 }; 41 };
19 } 42 }
20 43
21 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ 44 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698