| 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;
|
|
|