| Index: chrome/browser/predictors/resource_prefetch_predictor.h
|
| diff --git a/chrome/browser/predictors/resource_prefetch_predictor.h b/chrome/browser/predictors/resource_prefetch_predictor.h
|
| index 2cd3c950895ace6aabeb4aa0cf8d2067fa9263e0..38d2d0765b7c99d4216ccb7b1597bb13c119cb3d 100644
|
| --- a/chrome/browser/predictors/resource_prefetch_predictor.h
|
| +++ b/chrome/browser/predictors/resource_prefetch_predictor.h
|
| @@ -23,6 +23,7 @@
|
| #include "chrome/browser/predictors/resource_prefetch_common.h"
|
| #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h"
|
| #include "chrome/browser/predictors/resource_prefetcher.h"
|
| +#include "chrome/browser/predictors/resource_prefetcher_manager.h"
|
| #include "components/history/core/browser/history_db_task.h"
|
| #include "components/history/core/browser/history_service_observer.h"
|
| #include "components/history/core/browser/history_types.h"
|
| @@ -244,7 +245,7 @@ class ResourcePrefetchPredictor
|
| std::unique_ptr<ResourcePrefetcher::PrefetcherStats> stats);
|
|
|
| // Returns true if prefetching data exists for the |main_frame_url|.
|
| - virtual bool IsUrlPrefetchable(const GURL& main_frame_url);
|
| + virtual bool IsUrlPrefetchable(const GURL& main_frame_url) const;
|
|
|
| // Returns true iff |resource| has sufficient confidence level and required
|
| // number of hits.
|
| @@ -260,6 +261,10 @@ class ResourcePrefetchPredictor
|
| void SetObserverForTesting(TestObserver* observer);
|
|
|
| private:
|
| + // Return whether the predictor has data about a URL and can prefetch it
|
| + // for a given origin with the current configuration.
|
| + bool CanPrefetchUrlForOrigin(const GURL& url, HintOrigin origin) const;
|
| +
|
| // Starts prefetching if it is enabled for |origin| and prefetching data
|
| // exists for the |main_frame_url| either at the URL or at the host level.
|
| void StartPrefetching(const GURL& main_frame_url, HintOrigin origin);
|
| @@ -309,6 +314,8 @@ class ResourcePrefetchPredictor
|
| TestPrefetchingDurationHistogram);
|
| FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest,
|
| TestRecordFirstContentfulPaint);
|
| + FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest,
|
| + TestCanPrefetchUrlForOrigin);
|
|
|
| enum InitializationState {
|
| NOT_INITIALIZED = 0,
|
| @@ -473,6 +480,12 @@ class ResourcePrefetchPredictor
|
| tables_ = tables;
|
| }
|
|
|
| + // For testing.
|
| + void set_mock_resource_prefetcher_manager(
|
| + scoped_refptr<ResourcePrefetcherManager> prefetch_manager) {
|
| + prefetch_manager_ = prefetch_manager;
|
| + }
|
| +
|
| Profile* const profile_;
|
| TestObserver* observer_;
|
| const LoadingPredictorConfig config_;
|
|
|