| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PREDICTOR_H_ | 5 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ |
| 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ | 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // Size of LRU caches for the Url data. | 75 // Size of LRU caches for the Url data. |
| 76 size_t max_urls_to_track; // Default 500 | 76 size_t max_urls_to_track; // Default 500 |
| 77 // The number of times, we should have seen a visit to this Url in history | 77 // The number of times, we should have seen a visit to this Url in history |
| 78 // to start tracking it. This is to ensure we dont bother with oneoff | 78 // to start tracking it. This is to ensure we dont bother with oneoff |
| 79 // entries. | 79 // entries. |
| 80 int min_url_visit_count; // Default 3 | 80 int min_url_visit_count; // Default 3 |
| 81 // The maximum number of resources to store per entry. | 81 // The maximum number of resources to store per entry. |
| 82 int max_resources_per_entry; // Default 50 | 82 int max_resources_per_entry; // Default 50 |
| 83 // The number of consecutive misses after we stop tracking a resource Url. | 83 // The number of consecutive misses after we stop tracking a resource Url. |
| 84 int max_consecutive_misses; // Default 3 | 84 int max_consecutive_misses; // Default 3 |
| 85 // The number of resources we should report accuracy stats on. | |
| 86 int num_resources_assumed_prefetched; // Default 25 | |
| 87 }; | 85 }; |
| 88 | 86 |
| 89 // Stores the data that we need to get from the URLRequest. | 87 // Stores the data that we need to get from the URLRequest. |
| 90 struct URLRequestSummary { | 88 struct URLRequestSummary { |
| 91 URLRequestSummary(); | 89 URLRequestSummary(); |
| 92 URLRequestSummary(const URLRequestSummary& other); | 90 URLRequestSummary(const URLRequestSummary& other); |
| 93 ~URLRequestSummary(); | 91 ~URLRequestSummary(); |
| 94 | 92 |
| 95 NavigationID navigation_id; | 93 NavigationID navigation_id; |
| 96 GURL resource_url; | 94 GURL resource_url; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 void RemoveAnEntryFromUrlDB(); | 187 void RemoveAnEntryFromUrlDB(); |
| 190 void DeleteAllUrls(); | 188 void DeleteAllUrls(); |
| 191 void DeleteUrls(const history::URLRows& urls); | 189 void DeleteUrls(const history::URLRows& urls); |
| 192 | 190 |
| 193 bool ShouldTrackUrl(const GURL& url); | 191 bool ShouldTrackUrl(const GURL& url); |
| 194 void CleanupAbandonedNavigations(const NavigationID& navigation_id); | 192 void CleanupAbandonedNavigations(const NavigationID& navigation_id); |
| 195 void OnNavigationComplete(const NavigationID& navigation_id); | 193 void OnNavigationComplete(const NavigationID& navigation_id); |
| 196 void LearnUrlNavigation(const GURL& main_frame_url, | 194 void LearnUrlNavigation(const GURL& main_frame_url, |
| 197 const std::vector<URLRequestSummary>& new_value); | 195 const std::vector<URLRequestSummary>& new_value); |
| 198 void MaybeReportAccuracyStats(const NavigationID& navigation_id) const; | 196 void MaybeReportAccuracyStats(const NavigationID& navigation_id) const; |
| 197 void ReportAccuracyHistograms(const UrlTableRowVector& predicted, |
| 198 const std::map<GURL, bool>& actual_resources, |
| 199 int total_resources_fetched_from_network, |
| 200 int max_assumed_prefetched) const; |
| 199 | 201 |
| 200 void SetTablesForTesting( | 202 void SetTablesForTesting( |
| 201 scoped_refptr<ResourcePrefetchPredictorTables> tables); | 203 scoped_refptr<ResourcePrefetchPredictorTables> tables); |
| 202 | 204 |
| 203 Profile* const profile_; | 205 Profile* const profile_; |
| 204 Config config_; | 206 Config config_; |
| 205 InitializationState initialization_state_; | 207 InitializationState initialization_state_; |
| 206 scoped_refptr<ResourcePrefetchPredictorTables> tables_; | 208 scoped_refptr<ResourcePrefetchPredictorTables> tables_; |
| 207 content::NotificationRegistrar notification_registrar_; | 209 content::NotificationRegistrar notification_registrar_; |
| 208 | 210 |
| 209 NavigationMap inflight_navigations_; | 211 NavigationMap inflight_navigations_; |
| 210 UrlTableCacheMap url_table_cache_; | 212 UrlTableCacheMap url_table_cache_; |
| 211 | 213 |
| 212 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor); | 214 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor); |
| 213 }; | 215 }; |
| 214 | 216 |
| 215 } // namespace predictors | 217 } // namespace predictors |
| 216 | 218 |
| 217 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ | 219 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ |
| OLD | NEW |