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

Unified Diff: chrome/browser/net/predictor.cc

Issue 2871323006: Make Network Predictor skip empty urls (Closed)
Patch Set: address comment 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
« no previous file with comments | « no previous file | chrome/browser/net/predictor_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/predictor.cc
diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc
index 2bb76985c1f3fe406b96bded8cf87e81b314ab89..5d73b277c1d45cc6ef19e618cbbd8d52a8f2c0b9 100644
--- a/chrome/browser/net/predictor.cc
+++ b/chrome/browser/net/predictor.cc
@@ -242,17 +242,19 @@ void Predictor::PreconnectUrlAndSubresources(const GURL& url,
const GURL& first_party_for_cookies) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) ||
BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (!PredictorEnabled() || !url.is_valid() ||
- !url.has_host())
+ if (!PredictorEnabled())
return;
if (!CanPreresolveAndPreconnect())
return;
-
+ const GURL canonicalized_url = CanonicalizeUrl(url);
+ if (!canonicalized_url.is_valid() || !canonicalized_url.has_host())
+ return;
UrlInfo::ResolutionMotivation motivation(UrlInfo::EARLY_LOAD_MOTIVATED);
const int kConnectionsNeeded = 1;
- PreconnectUrl(CanonicalizeUrl(url), first_party_for_cookies, motivation,
+ PreconnectUrl(canonicalized_url, first_party_for_cookies, motivation,
kConnectionsNeeded, kAllowCredentialsOnPreconnectByDefault);
- PredictFrameSubresources(url.GetWithEmptyPath(), first_party_for_cookies);
+ PredictFrameSubresources(canonicalized_url.GetWithEmptyPath(),
+ first_party_for_cookies);
}
std::vector<GURL> Predictor::GetPredictedUrlListAtStartup(
@@ -725,6 +727,7 @@ void Predictor::PreconnectUrl(const GURL& url,
int count) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) ||
BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK(url.is_valid());
if (BrowserThread::CurrentlyOn(BrowserThread::IO)) {
PreconnectUrlOnIOThread(url, first_party_for_cookies, motivation,
« no previous file with comments | « no previous file | chrome/browser/net/predictor_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698