| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "chrome/browser/predictors/loading_predictor.h" | 5 #include "chrome/browser/predictors/loading_predictor.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/predictors/resource_prefetch_predictor.h" | 8 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
| 9 | 9 |
| 10 namespace predictors { | 10 namespace predictors { |
| 11 | 11 |
| 12 LoadingPredictor::LoadingPredictor(const LoadingPredictorConfig& config, | 12 LoadingPredictor::LoadingPredictor(const LoadingPredictorConfig& config, |
| 13 Profile* profile) { | 13 Profile* profile) { |
| 14 resource_prefetch_predictor_ = | 14 resource_prefetch_predictor_ = |
| 15 base::MakeUnique<ResourcePrefetchPredictor>(config, profile); | 15 base::MakeUnique<ResourcePrefetchPredictor>(config, profile); |
| 16 } | 16 } |
| 17 | 17 |
| 18 LoadingPredictor::~LoadingPredictor() = default; | 18 LoadingPredictor::~LoadingPredictor() = default; |
| 19 | 19 |
| 20 void LoadingPredictor::PrepareForPageLoad(const GURL& url, HintOrigin origin) { | 20 void LoadingPredictor::PrepareForPageLoad(const GURL& url, HintOrigin origin) { |
| 21 resource_prefetch_predictor_->StartPrefetching(url, origin); | 21 resource_prefetch_predictor_->StartPrefetching(url, origin); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void LoadingPredictor::CancelPageLoadHint(const GURL& url) { | 24 void LoadingPredictor::CancelPageLoadHint(const GURL& url) { |
| 25 resource_prefetch_predictor_->StopPrefetching(url); | 25 resource_prefetch_predictor_->StopPrefetching(url); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void LoadingPredictor::StartInitialization() { |
| 29 resource_prefetch_predictor_->StartInitialization(); |
| 30 } |
| 31 |
| 28 ResourcePrefetchPredictor* LoadingPredictor::resource_prefetch_predictor() | 32 ResourcePrefetchPredictor* LoadingPredictor::resource_prefetch_predictor() |
| 29 const { | 33 const { |
| 30 return resource_prefetch_predictor_.get(); | 34 return resource_prefetch_predictor_.get(); |
| 31 } | 35 } |
| 32 | 36 |
| 33 void LoadingPredictor::Shutdown() { | 37 void LoadingPredictor::Shutdown() { |
| 34 resource_prefetch_predictor_->Shutdown(); | 38 resource_prefetch_predictor_->Shutdown(); |
| 35 } | 39 } |
| 36 | 40 |
| 37 } // namespace predictors | 41 } // namespace predictors |
| OLD | NEW |