| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/net/preconnect.h" | 5 #include "chrome/browser/net/preconnect.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "content/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 NewRunnableFunction(PreconnectOnIOThread, url, motivation, | 30 NewRunnableFunction(PreconnectOnIOThread, url, motivation, |
| 31 count)); | 31 count)); |
| 32 return; | 32 return; |
| 33 } | 33 } |
| 34 | 34 |
| 35 | 35 |
| 36 void PreconnectOnIOThread( | 36 void PreconnectOnIOThread( |
| 37 const GURL& url, | 37 const GURL& url, |
| 38 UrlInfo::ResolutionMotivation motivation, | 38 UrlInfo::ResolutionMotivation motivation, |
| 39 int count) { | 39 int count) { |
| 40 net::URLRequestContextGetter* getter = Profile::GetDefaultRequestContext(); | 40 net::URLRequestContextGetter* getter = |
| 41 Profile::Deprecated::GetDefaultRequestContext(); |
| 41 if (!getter) | 42 if (!getter) |
| 42 return; | 43 return; |
| 43 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 44 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 44 LOG(DFATAL) << "This must be run only on the IO thread."; | 45 LOG(DFATAL) << "This must be run only on the IO thread."; |
| 45 return; | 46 return; |
| 46 } | 47 } |
| 47 | 48 |
| 48 // We are now commited to doing the async preconnection call. | 49 // We are now commited to doing the async preconnection call. |
| 49 UMA_HISTOGRAM_ENUMERATION("Net.PreconnectMotivation", motivation, | 50 UMA_HISTOGRAM_ENUMERATION("Net.PreconnectMotivation", motivation, |
| 50 UrlInfo::MAX_MOTIVATED); | 51 UrlInfo::MAX_MOTIVATED); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 99 |
| 99 // All preconnects should perform EV certificate verification. | 100 // All preconnects should perform EV certificate verification. |
| 100 ssl_config.verify_ev_cert = true; | 101 ssl_config.verify_ev_cert = true; |
| 101 | 102 |
| 102 net::HttpStreamFactory* http_stream_factory = session->http_stream_factory(); | 103 net::HttpStreamFactory* http_stream_factory = session->http_stream_factory(); |
| 103 http_stream_factory->PreconnectStreams( | 104 http_stream_factory->PreconnectStreams( |
| 104 count, request_info, ssl_config, net::BoundNetLog()); | 105 count, request_info, ssl_config, net::BoundNetLog()); |
| 105 } | 106 } |
| 106 | 107 |
| 107 } // namespace chrome_browser_net | 108 } // namespace chrome_browser_net |
| OLD | NEW |