| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // Sets the |stats_collector| which is used to report histograms. | 258 // Sets the |stats_collector| which is used to report histograms. |
| 259 void SetStatsCollector(LoadingStatsCollector* stats_collector); | 259 void SetStatsCollector(LoadingStatsCollector* stats_collector); |
| 260 | 260 |
| 261 // Returns true iff there is PrefetchData that can be used for a | 261 // Returns true iff there is PrefetchData that can be used for a |
| 262 // |main_frame_url| and fills |prediction| with resources that need to be | 262 // |main_frame_url| and fills |prediction| with resources that need to be |
| 263 // prefetched. |prediction| pointer may be nullptr to get return value only. | 263 // prefetched. |prediction| pointer may be nullptr to get return value only. |
| 264 virtual bool GetPrefetchData(const GURL& main_frame_url, | 264 virtual bool GetPrefetchData(const GURL& main_frame_url, |
| 265 Prediction* prediction) const; | 265 Prediction* prediction) const; |
| 266 | 266 |
| 267 private: | 267 private: |
| 268 // Starts prefetching if it is enabled and prefetching data exists for the | 268 // Starts prefetching for |main_frame_url| from a |prediction|. |
| 269 // |main_frame_url| either at the URL or at the host level. | 269 void StartPrefetching(const GURL& main_frame_url, |
| 270 void StartPrefetching(const GURL& main_frame_url); | 270 const Prediction& prediction); |
| 271 | 271 |
| 272 // Stops prefetching that may be in progress corresponding to | 272 // Stops prefetching that may be in progress corresponding to |
| 273 // |main_frame_url|. | 273 // |main_frame_url|. |
| 274 void StopPrefetching(const GURL& main_frame_url); | 274 void StopPrefetching(const GURL& main_frame_url); |
| 275 | 275 |
| 276 friend class LoadingPredictor; | 276 friend class LoadingPredictor; |
| 277 friend class ::PredictorsHandler; | 277 friend class ::PredictorsHandler; |
| 278 friend class ResourcePrefetchPredictorTest; | 278 friend class ResourcePrefetchPredictorTest; |
| 279 friend class ResourcePrefetchPredictorBrowserTest; | 279 friend class ResourcePrefetchPredictorBrowserTest; |
| 280 | 280 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 | 503 |
| 504 private: | 504 private: |
| 505 ResourcePrefetchPredictor* predictor_; | 505 ResourcePrefetchPredictor* predictor_; |
| 506 | 506 |
| 507 DISALLOW_COPY_AND_ASSIGN(TestObserver); | 507 DISALLOW_COPY_AND_ASSIGN(TestObserver); |
| 508 }; | 508 }; |
| 509 | 509 |
| 510 } // namespace predictors | 510 } // namespace predictors |
| 511 | 511 |
| 512 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ | 512 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ |
| OLD | NEW |