Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ | 5 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ |
| 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ | 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 // Represents the config for the resource prefetch prediction algorithm. It is | 62 // Represents the config for the resource prefetch prediction algorithm. It is |
| 63 // useful for running experiments. | 63 // useful for running experiments. |
| 64 struct ResourcePrefetchPredictorConfig { | 64 struct ResourcePrefetchPredictorConfig { |
| 65 // Initializes the config with default values. | 65 // Initializes the config with default values. |
| 66 ResourcePrefetchPredictorConfig(); | 66 ResourcePrefetchPredictorConfig(); |
| 67 ResourcePrefetchPredictorConfig(const ResourcePrefetchPredictorConfig& other); | 67 ResourcePrefetchPredictorConfig(const ResourcePrefetchPredictorConfig& other); |
| 68 ~ResourcePrefetchPredictorConfig(); | 68 ~ResourcePrefetchPredictorConfig(); |
| 69 | 69 |
| 70 // The mode the prefetcher is running in. Forms a bit map. | 70 // The mode the prefetcher is running in. Forms a bit map. |
| 71 enum Mode { | 71 enum Mode { |
| 72 URL_LEARNING = 1 << 0, | 72 URL_LEARNING = 1 << 0, |
| 73 HOST_LEARNING = 1 << 1, | 73 HOST_LEARNING = 1 << 1, |
| 74 URL_PREFETCHING = 1 << 2, // Should also turn on URL_LEARNING. | 74 URL_PREFETCHING = 1 << 2, // Should also turn on URL_LEARNING. |
| 75 HOST_PRFETCHING = 1 << 3 // Should also turn on HOST_LEARNING. | 75 HOST_PREFETCHING = 1 << 3, // Should also turn on HOST_LEARNING. |
| 76 EXTERNAL_ONLY = 1 << 4 | |
|
pasko
2016/11/17 15:59:04
we need to explain somewhere what an 'external' re
Benoit L
2016/11/21 13:40:32
Done.
| |
| 76 }; | 77 }; |
| 77 int mode; | 78 int mode; |
| 78 | 79 |
| 79 // Helpers to deal with mode. | 80 // Helpers to deal with mode. |
| 80 bool IsLearningEnabled() const; | 81 bool IsLearningEnabled() const; |
| 81 bool IsPrefetchingEnabled(Profile* profile) const; | 82 bool IsPrefetchingEnabled(Profile* profile) const; |
| 82 bool IsURLLearningEnabled() const; | 83 bool IsURLLearningEnabled() const; |
| 83 bool IsHostLearningEnabled() const; | 84 bool IsHostLearningEnabled() const; |
| 85 bool ExternalPrefetchingOnly() const; | |
| 84 bool IsURLPrefetchingEnabled(Profile* profile) const; | 86 bool IsURLPrefetchingEnabled(Profile* profile) const; |
| 85 bool IsHostPrefetchingEnabled(Profile* profile) const; | 87 bool IsHostPrefetchingEnabled(Profile* profile) const; |
| 86 | 88 |
| 87 bool IsLowConfidenceForTest() const; | 89 bool IsLowConfidenceForTest() const; |
| 88 bool IsHighConfidenceForTest() const; | 90 bool IsHighConfidenceForTest() const; |
| 89 bool IsMoreResourcesEnabledForTest() const; | 91 bool IsMoreResourcesEnabledForTest() const; |
| 90 bool IsSmallDBEnabledForTest() const; | 92 bool IsSmallDBEnabledForTest() const; |
| 91 | 93 |
| 92 // If a navigation hasn't seen a load complete event in this much time, it | 94 // If a navigation hasn't seen a load complete event in this much time, it |
| 93 // is considered abandoned. | 95 // is considered abandoned. |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 116 // Maximum number of prefetches that can be inflight for a single navigation. | 118 // Maximum number of prefetches that can be inflight for a single navigation. |
| 117 size_t max_prefetches_inflight_per_navigation; | 119 size_t max_prefetches_inflight_per_navigation; |
| 118 // Maximum number of prefetches that can be inflight for a host for a single | 120 // Maximum number of prefetches that can be inflight for a host for a single |
| 119 // navigation. | 121 // navigation. |
| 120 size_t max_prefetches_inflight_per_host_per_navigation; | 122 size_t max_prefetches_inflight_per_host_per_navigation; |
| 121 }; | 123 }; |
| 122 | 124 |
| 123 } // namespace predictors | 125 } // namespace predictors |
| 124 | 126 |
| 125 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ | 127 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ |
| OLD | NEW |