| 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/feature_list.h" | 10 #include "base/feature_list.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "components/sessions/core/session_id.h" | 12 #include "components/sessions/core/session_id.h" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 class Profile; | 15 class Profile; |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 class WebContents; | 18 class WebContents; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace predictors { | 21 namespace predictors { |
| 22 | 22 |
| 23 extern const char kSpeculativeResourcePrefetchingFeatureName[]; | 23 extern const char kSpeculativeResourcePrefetchingFeatureName[]; |
| 24 extern const char kModeParamName[]; | 24 extern const char kModeParamName[]; |
| 25 extern const char kLearningMode[]; | 25 extern const char kLearningMode[]; |
| 26 extern const char kExternalPrefetchingMode[]; | 26 extern const char kExternalPrefetchingMode[]; |
| 27 extern const char kPrefetchingMode[]; | 27 extern const char kPrefetchingMode[]; |
| 28 extern const char kEnableUrlLearningParamName[]; | 28 extern const char kEnableUrlLearningParamName[]; |
| 29 extern const char kEnableManifestsParamName[]; |
| 29 extern const base::Feature kSpeculativeResourcePrefetchingFeature; | 30 extern const base::Feature kSpeculativeResourcePrefetchingFeature; |
| 30 | 31 |
| 31 struct ResourcePrefetchPredictorConfig; | 32 struct ResourcePrefetchPredictorConfig; |
| 32 | 33 |
| 33 // Returns true if prefetching is enabled. And will initilize the |config| | 34 // Returns true if prefetching is enabled. And will initilize the |config| |
| 34 // fields to the appropritate values. | 35 // fields to the appropritate values. |
| 35 bool IsSpeculativeResourcePrefetchingEnabled( | 36 bool IsSpeculativeResourcePrefetchingEnabled( |
| 36 Profile* profile, | 37 Profile* profile, |
| 37 ResourcePrefetchPredictorConfig* config); | 38 ResourcePrefetchPredictorConfig* config); |
| 38 | 39 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // The minimum number of times we must have a URL on record to prefetch it. | 120 // The minimum number of times we must have a URL on record to prefetch it. |
| 120 size_t min_resource_hits_to_trigger_prefetch; | 121 size_t min_resource_hits_to_trigger_prefetch; |
| 121 | 122 |
| 122 // Maximum number of prefetches that can be inflight for a single navigation. | 123 // Maximum number of prefetches that can be inflight for a single navigation. |
| 123 size_t max_prefetches_inflight_per_navigation; | 124 size_t max_prefetches_inflight_per_navigation; |
| 124 // Maximum number of prefetches that can be inflight for a host for a single | 125 // Maximum number of prefetches that can be inflight for a host for a single |
| 125 // navigation. | 126 // navigation. |
| 126 size_t max_prefetches_inflight_per_host_per_navigation; | 127 size_t max_prefetches_inflight_per_host_per_navigation; |
| 127 // True iff the predictor could use a url-based database. | 128 // True iff the predictor could use a url-based database. |
| 128 bool is_url_learning_enabled; | 129 bool is_url_learning_enabled; |
| 130 // True iff the predictor could use manifests. |
| 131 bool is_manifests_enabled; |
| 129 }; | 132 }; |
| 130 | 133 |
| 131 } // namespace predictors | 134 } // namespace predictors |
| 132 | 135 |
| 133 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ | 136 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ |
| OLD | NEW |