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

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

Issue 2538743002: predictors: Add a origin for prefetch requests, remove the URL/host settings. (Closed)
Patch Set: . Created 4 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/predictors/resource_prefetch_common.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cfb422ce1fb715c8bb9c42e486e3043914e94d31..7dd2139bbb25e2b54d3b805954d8f6d416bccb6c 100644
--- a/chrome/browser/predictors/resource_prefetch_common.h
+++ b/chrome/browser/predictors/resource_prefetch_common.h
@@ -32,6 +32,9 @@ 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();
@@ -59,8 +62,7 @@ struct NavigationID {
base::TimeTicks creation_time;
};
-// Represents the config for the resource prefetch prediction algorithm. It is
-// useful for running experiments.
+// Represents the config for the resource prefetch prediction algorithm.
struct ResourcePrefetchPredictorConfig {
// Initializes the config with default values.
ResourcePrefetchPredictorConfig();
@@ -69,20 +71,17 @@ struct ResourcePrefetchPredictorConfig {
// The mode the prefetcher is running in. Forms a bit map.
enum Mode {
- URL_LEARNING = 1 << 0,
- HOST_LEARNING = 1 << 1,
- URL_PREFETCHING = 1 << 2, // Should also turn on URL_LEARNING.
- HOST_PREFETCHING = 1 << 3 // Should also turn on HOST_LEARNING.
+ LEARNING = 1 << 0,
+ PREFETCHING_FOR_NAVIGATION = 1 << 2, // Also enables LEARNING.
+ PREFETCHING_FOR_EXTERNAL = 1 << 3 // Also enables LEARNING.
};
int mode;
// Helpers to deal with mode.
bool IsLearningEnabled() const;
- bool IsPrefetchingEnabled(Profile* profile) const;
- bool IsURLLearningEnabled() const;
- bool IsHostLearningEnabled() const;
- bool IsURLPrefetchingEnabled(Profile* profile) const;
- bool IsHostPrefetchingEnabled(Profile* profile) const;
+ bool IsPrefetchingEnabledForSomeOrigin(Profile* profile) const;
+ bool IsPrefetchingEnabledForOrigin(Profile* profile,
+ PrefetchOrigin origin) const;
bool IsLowConfidenceForTest() const;
bool IsHighConfidenceForTest() const;
« no previous file with comments | « no previous file | chrome/browser/predictors/resource_prefetch_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698