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

Unified Diff: chrome/browser/predictors/resource_prefetch_common.h

Issue 2847183002: predictors: Introduce GlowplugPredictor. (Closed)
Patch Set: GlowplugPredictor -> LoadingPredictor Created 3 years, 7 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: chrome/browser/predictors/resource_prefetch_common.h
diff --git a/chrome/browser/predictors/resource_prefetch_common.h b/chrome/browser/predictors/resource_prefetch_common.h
index c4303271a43cbb4084bb740c0b521a388ec9436d..76af1394e88703225a34265757eb77d95e428155 100644
--- a/chrome/browser/predictors/resource_prefetch_common.h
+++ b/chrome/browser/predictors/resource_prefetch_common.h
@@ -20,6 +20,12 @@ class WebContents;
namespace predictors {
+namespace internal {
+
+bool IsPrefetchingEnabledInternal(Profile* profile, int mode, int mask);
+
+} // namespace internal
+
extern const char kSpeculativeResourcePrefetchingFeatureName[];
extern const char kModeParamName[];
extern const char kLearningMode[];
@@ -30,13 +36,12 @@ extern const char kEnableManifestsParamName[];
extern const char kEnableOriginLearningParamName[];
extern const base::Feature kSpeculativeResourcePrefetchingFeature;
-struct ResourcePrefetchPredictorConfig;
+struct LoadingPredictorConfig;
-// Returns true if prefetching is enabled. And will initilize the |config|
-// fields to the appropritate values.
-bool IsSpeculativeResourcePrefetchingEnabled(
- Profile* profile,
- ResourcePrefetchPredictorConfig* config);
+// Returns true if prefetching is enabled, and initializes |config|, if not
+// nullptr.
+bool IsSpeculativeResourcePrefetchingEnabled(Profile* profile,
+ LoadingPredictorConfig* config);
// Represents the type of key based on which prefetch data is stored.
enum PrefetchKeyType {
@@ -44,9 +49,6 @@ enum PrefetchKeyType {
PREFETCH_KEY_TYPE_URL
};
-// Indicates what caused the prefetch request.
-enum class PrefetchOrigin { NAVIGATION, EXTERNAL };
-
// Represents a single navigation for a render frame.
struct NavigationID {
NavigationID();
@@ -71,75 +73,6 @@ struct NavigationID {
base::TimeTicks creation_time;
};
-// Represents the config for the resource prefetch prediction algorithm.
-struct ResourcePrefetchPredictorConfig {
- // Initializes the config with default values.
- ResourcePrefetchPredictorConfig();
- ResourcePrefetchPredictorConfig(const ResourcePrefetchPredictorConfig& other);
- ~ResourcePrefetchPredictorConfig();
-
- // The mode the prefetcher is running in. Forms a bit map.
- enum Mode {
- LEARNING = 1 << 0,
- PREFETCHING_FOR_NAVIGATION = 1 << 2, // Should also turn on LEARNING.
- PREFETCHING_FOR_EXTERNAL = 1 << 3 // Should also turn on LEARNING.
- };
- int mode;
-
- // Helpers to deal with mode.
- bool IsLearningEnabled() const;
- bool IsPrefetchingEnabledForSomeOrigin(Profile* profile) const;
- bool IsPrefetchingEnabledForOrigin(Profile* profile,
- PrefetchOrigin origin) const;
-
- bool IsLowConfidenceForTest() const;
- bool IsHighConfidenceForTest() const;
- bool IsMoreResourcesEnabledForTest() const;
- bool IsSmallDBEnabledForTest() const;
-
- // If a navigation hasn't seen a load complete event in this much time, it
- // is considered abandoned.
- size_t max_navigation_lifetime_seconds;
-
- // Size of LRU caches for the URL and host data.
- size_t max_urls_to_track;
- size_t max_hosts_to_track;
-
- // The number of times we should have seen a visit to this URL in history
- // to start tracking it. This is to ensure we don't bother with oneoff
- // entries. For hosts we track each one.
- size_t min_url_visit_count;
-
- // The maximum number of resources to store per entry.
- size_t max_resources_per_entry;
- // The maximum number of origins to store per entry.
- size_t max_origins_per_entry;
- // The number of consecutive misses after which we stop tracking a resource
- // URL.
- size_t max_consecutive_misses;
- // The number of consecutive misses after which we stop tracking a redirect
- // endpoint.
- size_t max_redirect_consecutive_misses;
-
- // The minimum confidence (accuracy of hits) required for a resource to be
- // prefetched.
- float min_resource_confidence_to_trigger_prefetch;
- // The minimum number of times we must have a URL on record to prefetch it.
- size_t min_resource_hits_to_trigger_prefetch;
-
- // Maximum number of prefetches that can be inflight for a single navigation.
- size_t max_prefetches_inflight_per_navigation;
- // Maximum number of prefetches that can be inflight for a host for a single
- // navigation.
- size_t max_prefetches_inflight_per_host_per_navigation;
- // True iff the predictor could use a url-based database.
- bool is_url_learning_enabled;
- // True iff the predictor could use manifests.
- bool is_manifests_enabled;
- // True iff origin-based learning is enabled.
- bool is_origin_learning_enabled;
-};
-
} // namespace predictors
#endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_
« no previous file with comments | « chrome/browser/predictors/predictor_database.cc ('k') | chrome/browser/predictors/resource_prefetch_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698