| 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_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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 RedirectDataMap* redirect_map); | 304 RedirectDataMap* redirect_map); |
| 305 | 305 |
| 306 // Updates information about final redirect destination for |key| in | 306 // Updates information about final redirect destination for |key| in |
| 307 // |redirect_map| and correspondingly updates the predictor database. | 307 // |redirect_map| and correspondingly updates the predictor database. |
| 308 void LearnRedirect(const std::string& key, | 308 void LearnRedirect(const std::string& key, |
| 309 PrefetchKeyType key_type, | 309 PrefetchKeyType key_type, |
| 310 const std::string& final_redirect, | 310 const std::string& final_redirect, |
| 311 size_t max_redirect_map_size, | 311 size_t max_redirect_map_size, |
| 312 RedirectDataMap* redirect_map); | 312 RedirectDataMap* redirect_map); |
| 313 | 313 |
| 314 // Reports overall page load time. | 314 // Returns true iff the |data_map| contains PrefetchData that can be used |
| 315 void ReportPageLoadTimeStats(base::TimeDelta plt) const; | 315 // for |main_frame_key| prefetching. |
| 316 bool IsDataPrefetchable(const std::string& main_frame_key, |
| 317 const PrefetchDataMap& data_map) const; |
| 316 | 318 |
| 317 // Reports page load time for prefetched and not prefetched pages. | 319 // Returns true iff |resource| has sufficient confidence level and required |
| 318 void ReportPageLoadTimePrefetchStats( | 320 // number of hits. |
| 319 base::TimeDelta plt, | 321 bool IsResourcePrefetchable(const ResourceData& resource) const; |
| 320 bool prefetched, | 322 |
| 321 base::Callback<void(int)> report_network_type_callback, | 323 // Reports database readiness metric defined as percentage of navigated hosts |
| 322 PrefetchKeyType key_type) const; | 324 // found in DB for last X entries in history. |
| 325 void ReportDatabaseReadiness(const history::TopHostsList& top_hosts) const; |
| 323 | 326 |
| 324 // history::HistoryServiceObserver: | 327 // history::HistoryServiceObserver: |
| 325 void OnURLsDeleted(history::HistoryService* history_service, | 328 void OnURLsDeleted(history::HistoryService* history_service, |
| 326 bool all_history, | 329 bool all_history, |
| 327 bool expired, | 330 bool expired, |
| 328 const history::URLRows& deleted_rows, | 331 const history::URLRows& deleted_rows, |
| 329 const std::set<GURL>& favicon_urls) override; | 332 const std::set<GURL>& favicon_urls) override; |
| 330 void OnHistoryServiceLoaded( | 333 void OnHistoryServiceLoaded( |
| 331 history::HistoryService* history_service) override; | 334 history::HistoryService* history_service) override; |
| 332 | 335 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 386 |
| 384 private: | 387 private: |
| 385 ResourcePrefetchPredictor* predictor_; | 388 ResourcePrefetchPredictor* predictor_; |
| 386 | 389 |
| 387 DISALLOW_COPY_AND_ASSIGN(TestObserver); | 390 DISALLOW_COPY_AND_ASSIGN(TestObserver); |
| 388 }; | 391 }; |
| 389 | 392 |
| 390 } // namespace predictors | 393 } // namespace predictors |
| 391 | 394 |
| 392 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ | 395 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ |
| OLD | NEW |