| Index: chrome/browser/net/predictor.cc
|
| diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc
|
| index 3981c5e871bde70539efe9e5f546e3f72d7d9469..07cf4756b9b40883610b8d3d87b578e2c23c56df 100644
|
| --- a/chrome/browser/net/predictor.cc
|
| +++ b/chrome/browser/net/predictor.cc
|
| @@ -274,20 +274,25 @@ void Predictor::AnticipateOmniboxUrl(const GURL& url, bool preconnectable) {
|
| }
|
|
|
| void Predictor::PreconnectUrlAndSubresources(const GURL& url) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - if (!predictor_enabled_)
|
| - return;
|
| - if (!url.is_valid() || !url.has_host())
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) ||
|
| + BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| + if (!predictor_enabled_ || !preconnect_enabled() ||
|
| + !url.is_valid() || !url.has_host())
|
| return;
|
| - if (preconnect_enabled()) {
|
| - std::string host = url.HostNoBrackets();
|
| - UrlInfo::ResolutionMotivation motivation(UrlInfo::EARLY_LOAD_MOTIVATED);
|
| - const int kConnectionsNeeded = 1;
|
| +
|
| + std::string host = url.HostNoBrackets();
|
| + UrlInfo::ResolutionMotivation motivation(UrlInfo::EARLY_LOAD_MOTIVATED);
|
| + const int kConnectionsNeeded = 1;
|
| + if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
|
| PreconnectOnUIThread(CanonicalizeUrl(url), motivation,
|
| kConnectionsNeeded,
|
| url_request_context_getter_);
|
| - PredictFrameSubresources(url.GetWithEmptyPath());
|
| + } else {
|
| + PreconnectOnIOThread(CanonicalizeUrl(url), motivation,
|
| + kConnectionsNeeded,
|
| + url_request_context_getter_);
|
| }
|
| + PredictFrameSubresources(url.GetWithEmptyPath());
|
| }
|
|
|
| UrlList Predictor::GetPredictedUrlListAtStartup(
|
|
|