Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: chrome/browser/predictors/loading_predictor.cc

Issue 2887133003: predictors: Refactor resource_prefetch_predictor triggering. (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/predictors/loading_predictor.cc
diff --git a/chrome/browser/predictors/loading_predictor.cc b/chrome/browser/predictors/loading_predictor.cc
index d5bd264009427aead4df1a4926e85807fee38f60..5c6a14e4cff9bb63dcee5159196357fb1ead21fb 100644
--- a/chrome/browser/predictors/loading_predictor.cc
+++ b/chrome/browser/predictors/loading_predictor.cc
@@ -10,15 +10,15 @@
namespace predictors {
LoadingPredictor::LoadingPredictor(const LoadingPredictorConfig& config,
- Profile* profile) {
- resource_prefetch_predictor_ =
- base::MakeUnique<ResourcePrefetchPredictor>(config, profile);
-}
+ Profile* profile)
+ : resource_prefetch_predictor_(
+ base::MakeUnique<ResourcePrefetchPredictor>(config, profile)) {}
alexilin 2017/05/23 11:01:38 Do you think it's better to construct the pointer
Benoit L 2017/05/29 16:45:14 We are trying to remove "new" as possible from Chr
LoadingPredictor::~LoadingPredictor() = default;
void LoadingPredictor::PrepareForPageLoad(const GURL& url, HintOrigin origin) {
- resource_prefetch_predictor_->StartPrefetching(url, origin);
+ if (resource_prefetch_predictor_->CanPrefetchUrlForOrigin(url, origin))
alexilin 2017/05/23 11:01:38 Shouldn't it be like LoadingPredictor tries to get
Benoit L 2017/05/29 16:45:14 That's the eventual goal yes, but it doesn't seem
+ resource_prefetch_predictor_->StartPrefetching(url, origin);
}
void LoadingPredictor::CancelPageLoadHint(const GURL& url) {

Powered by Google App Engine
This is Rietveld 408576698