| 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 }; | 76 }; |
| 77 int mode; | 77 int mode; |
| 78 | 78 |
| 79 // Helpers to deal with mode. | 79 // Helpers to deal with mode. |
| 80 bool IsLearningEnabled() const; | 80 bool IsLearningEnabled() const; |
| 81 bool IsPrefetchingEnabled(Profile* profile) const; | 81 bool IsPrefetchingEnabled(Profile* profile) const; |
| 82 bool IsURLLearningEnabled() const; | 82 bool IsURLLearningEnabled() const; |
| 83 bool IsHostLearningEnabled() const; | 83 bool IsHostLearningEnabled() const; |
| 84 bool IsURLPrefetchingEnabled(Profile* profile) const; | 84 bool IsURLPrefetchingEnabled(Profile* profile) const; |
| 85 bool IsHostPrefetchingEnabled(Profile* profile) const; | 85 bool IsHostPrefetchingEnabled(Profile* profile) const; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 116 // Maximum number of prefetches that can be inflight for a single navigation. | 116 // Maximum number of prefetches that can be inflight for a single navigation. |
| 117 size_t max_prefetches_inflight_per_navigation; | 117 size_t max_prefetches_inflight_per_navigation; |
| 118 // Maximum number of prefetches that can be inflight for a host for a single | 118 // Maximum number of prefetches that can be inflight for a host for a single |
| 119 // navigation. | 119 // navigation. |
| 120 size_t max_prefetches_inflight_per_host_per_navigation; | 120 size_t max_prefetches_inflight_per_host_per_navigation; |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 } // namespace predictors | 123 } // namespace predictors |
| 124 | 124 |
| 125 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ | 125 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ |
| OLD | NEW |