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

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

Issue 2923813002: predictors: Don't call IsUrlPrefetchable twice. (Closed)
Patch Set: . Created 3 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/predictors/loading_predictor_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/predictors/loading_predictor.cc
diff --git a/chrome/browser/predictors/loading_predictor.cc b/chrome/browser/predictors/loading_predictor.cc
index 6a839c966706a990af43400927e3975a590b1548..0bc19562e92891cdb63f4891f0d570682f1f248b 100644
--- a/chrome/browser/predictors/loading_predictor.cc
+++ b/chrome/browser/predictors/loading_predictor.cc
@@ -29,15 +29,17 @@ LoadingPredictor::LoadingPredictor(const LoadingPredictorConfig& config,
LoadingPredictor::~LoadingPredictor() = default;
void LoadingPredictor::PrepareForPageLoad(const GURL& url, HintOrigin origin) {
- if (active_hints_.find(url) != active_hints_.end() ||
- !resource_prefetch_predictor_->IsUrlPrefetchable(url))
+ if (active_hints_.find(url) != active_hints_.end())
+ return;
+ ResourcePrefetchPredictor::Prediction prediction;
+ if (!resource_prefetch_predictor_->GetPrefetchData(url, &prediction))
return;
// To report hint durations.
active_hints_.emplace(url, base::TimeTicks::Now());
if (config_.IsPrefetchingEnabledForOrigin(profile_, origin))
- resource_prefetch_predictor_->StartPrefetching(url);
+ resource_prefetch_predictor_->StartPrefetching(url, prediction);
}
void LoadingPredictor::CancelPageLoadHint(const GURL& url) {
« no previous file with comments | « no previous file | chrome/browser/predictors/loading_predictor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698