| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 class PredictorsHandler; | 32 class PredictorsHandler; |
| 33 class Profile; | 33 class Profile; |
| 34 | 34 |
| 35 namespace net { | 35 namespace net { |
| 36 class URLRequest; | 36 class URLRequest; |
| 37 } | 37 } |
| 38 | 38 |
| 39 namespace predictors { | 39 namespace predictors { |
| 40 | 40 |
| 41 namespace internal { |
| 42 constexpr char kResourcePrefetchPredictorPrecisionHistogram[] = |
| 43 "ResourcePrefetchPredictor.LearningPrecision"; |
| 44 constexpr char kResourcePrefetchPredictorRecallHistogram[] = |
| 45 "ResourcePrefetchPredictor.LearningRecall"; |
| 46 } // namespace internal |
| 47 |
| 41 class TestObserver; | 48 class TestObserver; |
| 42 class ResourcePrefetcherManager; | 49 class ResourcePrefetcherManager; |
| 43 | 50 |
| 44 // Contains logic for learning what can be prefetched and for kicking off | 51 // Contains logic for learning what can be prefetched and for kicking off |
| 45 // speculative prefetching. | 52 // speculative prefetching. |
| 46 // - The class is a profile keyed service owned by the profile. | 53 // - The class is a profile keyed service owned by the profile. |
| 47 // - All the non-static methods of this class need to be called on the UI | 54 // - All the non-static methods of this class need to be called on the UI |
| 48 // thread. | 55 // thread. |
| 49 // | 56 // |
| 50 // The overall flow of the resource prefetching algorithm is as follows: | 57 // The overall flow of the resource prefetching algorithm is as follows: |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, OnMainFrameRequest); | 198 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, OnMainFrameRequest); |
| 192 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, OnMainFrameRedirect); | 199 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, OnMainFrameRedirect); |
| 193 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, | 200 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, |
| 194 OnSubresourceResponse); | 201 OnSubresourceResponse); |
| 195 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, GetCorrectPLT); | 202 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, GetCorrectPLT); |
| 196 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, HandledResourceTypes); | 203 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, HandledResourceTypes); |
| 197 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, | 204 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, |
| 198 PopulatePrefetcherRequest); | 205 PopulatePrefetcherRequest); |
| 199 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, GetRedirectEndpoint); | 206 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, GetRedirectEndpoint); |
| 200 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, GetPrefetchData); | 207 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, GetPrefetchData); |
| 208 FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest, |
| 209 TestPrecisionRecallHistograms); |
| 201 | 210 |
| 202 enum InitializationState { | 211 enum InitializationState { |
| 203 NOT_INITIALIZED = 0, | 212 NOT_INITIALIZED = 0, |
| 204 INITIALIZING = 1, | 213 INITIALIZING = 1, |
| 205 INITIALIZED = 2 | 214 INITIALIZED = 2 |
| 206 }; | 215 }; |
| 207 | 216 |
| 208 typedef ResourcePrefetchPredictorTables::PrefetchDataMap PrefetchDataMap; | 217 typedef ResourcePrefetchPredictorTables::PrefetchDataMap PrefetchDataMap; |
| 209 typedef ResourcePrefetchPredictorTables::RedirectDataMap RedirectDataMap; | 218 typedef ResourcePrefetchPredictorTables::RedirectDataMap RedirectDataMap; |
| 210 | 219 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 395 |
| 387 private: | 396 private: |
| 388 ResourcePrefetchPredictor* predictor_; | 397 ResourcePrefetchPredictor* predictor_; |
| 389 | 398 |
| 390 DISALLOW_COPY_AND_ASSIGN(TestObserver); | 399 DISALLOW_COPY_AND_ASSIGN(TestObserver); |
| 391 }; | 400 }; |
| 392 | 401 |
| 393 } // namespace predictors | 402 } // namespace predictors |
| 394 | 403 |
| 395 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ | 404 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ |
| OLD | NEW |