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 #include "chrome/browser/predictors/resource_prefetch_common.h" | 5 #include "chrome/browser/predictors/resource_prefetch_common.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 | 9 |
| 10 #include "base/metrics/field_trial_params.h" | 10 #include "base/metrics/field_trial_params.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 return tab_id == rhs.tab_id && main_frame_url == rhs.main_frame_url; | 125 return tab_id == rhs.tab_id && main_frame_url == rhs.main_frame_url; |
| 126 } | 126 } |
| 127 | 127 |
| 128 ResourcePrefetchPredictorConfig::ResourcePrefetchPredictorConfig() | 128 ResourcePrefetchPredictorConfig::ResourcePrefetchPredictorConfig() |
| 129 : mode(0), | 129 : mode(0), |
| 130 max_navigation_lifetime_seconds(60), | 130 max_navigation_lifetime_seconds(60), |
| 131 max_urls_to_track(500), | 131 max_urls_to_track(500), |
| 132 max_hosts_to_track(200), | 132 max_hosts_to_track(200), |
| 133 min_url_visit_count(2), | 133 min_url_visit_count(2), |
| 134 max_resources_per_entry(50), | 134 max_resources_per_entry(50), |
| 135 max_origins_per_entry(50), | |
| 135 max_consecutive_misses(3), | 136 max_consecutive_misses(3), |
| 136 min_resource_confidence_to_trigger_prefetch(0.7f), | 137 min_resource_confidence_to_trigger_prefetch(0.7f), |
| 137 min_resource_hits_to_trigger_prefetch(2), | 138 min_resource_hits_to_trigger_prefetch(2), |
| 138 max_prefetches_inflight_per_navigation(5), | 139 max_prefetches_inflight_per_navigation(5), |
| 139 max_prefetches_inflight_per_host_per_navigation(3), | 140 max_prefetches_inflight_per_host_per_navigation(3), |
| 140 is_url_learning_enabled(false) { | 141 is_url_learning_enabled(false), |
| 141 } | 142 is_origin_prediction_enabled(false) {} |
|
alexilin
2017/04/10 14:58:27
nit:
Could you add the check of default value for
Benoit L
2017/04/11 09:04:05
Done.
| |
| 142 | 143 |
| 143 ResourcePrefetchPredictorConfig::ResourcePrefetchPredictorConfig( | 144 ResourcePrefetchPredictorConfig::ResourcePrefetchPredictorConfig( |
| 144 const ResourcePrefetchPredictorConfig& other) = default; | 145 const ResourcePrefetchPredictorConfig& other) = default; |
| 145 | 146 |
| 146 ResourcePrefetchPredictorConfig::~ResourcePrefetchPredictorConfig() { | 147 ResourcePrefetchPredictorConfig::~ResourcePrefetchPredictorConfig() { |
| 147 } | 148 } |
| 148 | 149 |
| 149 bool ResourcePrefetchPredictorConfig::IsLearningEnabled() const { | 150 bool ResourcePrefetchPredictorConfig::IsLearningEnabled() const { |
| 150 return (mode & LEARNING) > 0; | 151 return (mode & LEARNING) > 0; |
| 151 } | 152 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 | 186 |
| 186 bool ResourcePrefetchPredictorConfig::IsMoreResourcesEnabledForTest() const { | 187 bool ResourcePrefetchPredictorConfig::IsMoreResourcesEnabledForTest() const { |
| 187 return max_resources_per_entry == 100; | 188 return max_resources_per_entry == 100; |
| 188 } | 189 } |
| 189 | 190 |
| 190 bool ResourcePrefetchPredictorConfig::IsSmallDBEnabledForTest() const { | 191 bool ResourcePrefetchPredictorConfig::IsSmallDBEnabledForTest() const { |
| 191 return max_urls_to_track == 200 && max_hosts_to_track == 100; | 192 return max_urls_to_track == 200 && max_hosts_to_track == 100; |
| 192 } | 193 } |
| 193 | 194 |
| 194 } // namespace predictors | 195 } // namespace predictors |
| OLD | NEW |