OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_PREDICTORS_GLOWPLUG_CONFIG_H_ | |
6 #define CHROME_BROWSER_PREDICTORS_GLOWPLUG_CONFIG_H_ | |
7 | |
8 #include <cstddef> | |
9 | |
10 class Profile; | |
11 | |
12 namespace predictors { | |
13 | |
14 struct GlowplugPredictorConfig; | |
15 | |
16 // Returns whether glowplug is enabled, and populate |config|, if not nullptr. | |
alexilin
2017/05/12 14:26:45
nit:
/populate/populates
Benoit L
2017/05/12 15:13:11
Done.
| |
17 bool IsGlowplugEnabled(Profile* profile, GlowplugPredictorConfig* config); | |
18 | |
19 // Indicates what caused the page load hint. | |
20 enum class HintOrigin { NAVIGATION, EXTERNAL }; | |
21 | |
22 // Represents the config for the Glowplug predictor. | |
23 struct GlowplugPredictorConfig { | |
24 // Initializes the config with default values. | |
25 GlowplugPredictorConfig(); | |
26 GlowplugPredictorConfig(const GlowplugPredictorConfig& other); | |
27 ~GlowplugPredictorConfig(); | |
28 | |
29 // The mode the prefetcher is running in. Forms a bit map. | |
30 enum Mode { | |
31 LEARNING = 1 << 0, | |
32 PREFETCHING_FOR_NAVIGATION = 1 << 2, // Should also turn on LEARNING. | |
33 PREFETCHING_FOR_EXTERNAL = 1 << 3 // Should also turn on LEARNING. | |
34 }; | |
35 int mode; | |
36 | |
37 // Helpers to deal with mode. | |
38 bool IsLearningEnabled() const; | |
39 bool IsPrefetchingEnabledForSomeOrigin(Profile* profile) const; | |
40 bool IsPrefetchingEnabledForOrigin(Profile* profile, HintOrigin origin) const; | |
41 | |
42 bool IsLowConfidenceForTest() const; | |
43 bool IsHighConfidenceForTest() const; | |
44 bool IsMoreResourcesEnabledForTest() const; | |
45 bool IsSmallDBEnabledForTest() const; | |
46 | |
47 // If a navigation hasn't seen a load complete event in this much time, it | |
48 // is considered abandoned. | |
49 size_t max_navigation_lifetime_seconds; | |
50 | |
51 // Size of LRU caches for the URL and host data. | |
52 size_t max_urls_to_track; | |
53 size_t max_hosts_to_track; | |
54 | |
55 // The number of times we should have seen a visit to this URL in history | |
56 // to start tracking it. This is to ensure we don't bother with oneoff | |
57 // entries. For hosts we track each one. | |
58 size_t min_url_visit_count; | |
59 | |
60 // The maximum number of resources to store per entry. | |
61 size_t max_resources_per_entry; | |
62 // The maximum number of origins to store per entry. | |
63 size_t max_origins_per_entry; | |
64 // The number of consecutive misses after which we stop tracking a resource | |
65 // URL. | |
66 size_t max_consecutive_misses; | |
67 // The number of consecutive misses after which we stop tracking a redirect | |
68 // endpoint. | |
69 size_t max_redirect_consecutive_misses; | |
70 | |
71 // The minimum confidence (accuracy of hits) required for a resource to be | |
72 // prefetched. | |
73 float min_resource_confidence_to_trigger_prefetch; | |
74 // The minimum number of times we must have a URL on record to prefetch it. | |
75 size_t min_resource_hits_to_trigger_prefetch; | |
76 | |
77 // Maximum number of prefetches that can be inflight for a single navigation. | |
78 size_t max_prefetches_inflight_per_navigation; | |
79 // Maximum number of prefetches that can be inflight for a host for a single | |
80 // navigation. | |
81 size_t max_prefetches_inflight_per_host_per_navigation; | |
82 // True iff the predictor could use a url-based database. | |
83 bool is_url_learning_enabled; | |
84 // True iff the predictor could use manifests. | |
85 bool is_manifests_enabled; | |
86 // True iff origin-based learning is enabled. | |
87 bool is_origin_learning_enabled; | |
88 }; | |
89 | |
90 } // namespace predictors | |
91 | |
92 #endif // CHROME_BROWSER_PREDICTORS_GLOWPLUG_CONFIG_H_ | |
OLD | NEW |