Chromium Code Reviews| Index: chrome/browser/net/predictor.cc |
| diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc |
| index 6e82188244e7451743d8fe9c2103217ce72ea212..5ec2e457c076e798b7ba17f7582ab134c5954336 100644 |
| --- a/chrome/browser/net/predictor.cc |
| +++ b/chrome/browser/net/predictor.cc |
| @@ -273,19 +273,29 @@ void Predictor::AnticipateOmniboxUrl(const GURL& url, bool preconnectable) { |
| CanonicalizeUrl(url), motivation)); |
| } |
| -void Predictor::PreconnectUrlAndSubresources(const GURL& url) { |
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| +void Predictor::PreconnectUrlAndSubresources( |
| + const GURL& url, |
| + UrlInfo::ResolutionMotivation motivation, |
| + uint32_t motivationVariationId) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
| + BrowserThread::CurrentlyOn(BrowserThread::IO)); |
|
jar (doing other things)
2013/05/04 00:32:05
I need to check... but the old assertion suggests
|
| if (!predictor_enabled_) |
|
jar (doing other things)
2013/05/04 00:32:05
This is vaguely thread safe (it is "only" a bool :
kouhei (in TOK)
2013/05/07 09:16:12
Actually, some methods on this class is already ca
|
| return; |
| if (!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; |
| - PreconnectOnUIThread(CanonicalizeUrl(url), motivation, |
| - kConnectionsNeeded, |
| - url_request_context_getter_); |
| + // TODO(kouhei): pass motivationVariationId |
| + if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| + PreconnectOnUIThread(CanonicalizeUrl(url), motivation, |
| + kConnectionsNeeded, |
| + url_request_context_getter_); |
|
jar (doing other things)
2013/05/04 00:32:05
I have to read the code more to see that your acce
|
| + } else { |
| + PreconnectOnIOThread(CanonicalizeUrl(url), motivation, |
| + kConnectionsNeeded, |
| + url_request_context_getter_); |
| + } |
| PredictFrameSubresources(url.GetWithEmptyPath()); |
| } |
| } |