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

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
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..3b60b4371614ada5faf2048f6f1777d75bef0cb5 100644
--- a/chrome/browser/predictors/resource_prefetch_common.h
+++ b/chrome/browser/predictors/resource_prefetch_common.h
@@ -59,30 +59,28 @@ 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();
ResourcePrefetchPredictorConfig(const ResourcePrefetchPredictorConfig& other);
~ResourcePrefetchPredictorConfig();
+ // Indicates what caused the prefetch request.
+ enum Origin { ORIGIN_NAVIGATION = 0, ORIGIN_EXTERNAL = 1 };
pasko 2016/11/29 14:44:44 Please move it out of ResourcePrefetchPredictorCon
Benoit L 2016/11/29 17:02:51 Done.
+
// 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 IsAnyPrefetchingEnabled(Profile* profile) const;
+ bool IsPrefetchingEnabled(Profile* profile, Origin origin) const;
pasko 2016/11/29 14:44:44 how about: IsPrefetchingEnabledForOrigin(profile,
Benoit L 2016/11/29 17:02:51 Done.
bool IsLowConfidenceForTest() const;
bool IsHighConfidenceForTest() const;
« no previous file with comments | « no previous file | chrome/browser/predictors/resource_prefetch_common.cc » ('j') | chrome/common/chrome_switches.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698