OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/browser_thread.h" | 10 #include "chrome/browser/browser_thread.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 return; | 49 return; |
50 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 50 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
51 LOG(DFATAL) << "This must be run only on the IO thread."; | 51 LOG(DFATAL) << "This must be run only on the IO thread."; |
52 return; | 52 return; |
53 } | 53 } |
54 | 54 |
55 // We are now commited to doing the async preconnection call. | 55 // We are now commited to doing the async preconnection call. |
56 UMA_HISTOGRAM_ENUMERATION("Net.PreconnectMotivation", motivation_, | 56 UMA_HISTOGRAM_ENUMERATION("Net.PreconnectMotivation", motivation_, |
57 UrlInfo::MAX_MOTIVATED); | 57 UrlInfo::MAX_MOTIVATED); |
58 | 58 |
59 URLRequestContext* context = getter->GetURLRequestContext(); | 59 net::URLRequestContext* context = getter->GetURLRequestContext(); |
60 net::HttpTransactionFactory* factory = context->http_transaction_factory(); | 60 net::HttpTransactionFactory* factory = context->http_transaction_factory(); |
61 net::HttpNetworkSession* session = factory->GetSession(); | 61 net::HttpNetworkSession* session = factory->GetSession(); |
62 | 62 |
63 request_info_.reset(new net::HttpRequestInfo()); | 63 request_info_.reset(new net::HttpRequestInfo()); |
64 request_info_->url = url; | 64 request_info_->url = url; |
65 request_info_->method = "GET"; | 65 request_info_->method = "GET"; |
66 // It almost doesn't matter whether we use net::LOWEST or net::HIGHEST | 66 // It almost doesn't matter whether we use net::LOWEST or net::HIGHEST |
67 // priority here, as we won't make a request, and will surrender the created | 67 // priority here, as we won't make a request, and will surrender the created |
68 // socket to the pool as soon as we can. However, we would like to mark the | 68 // socket to the pool as soon as we can. However, we would like to mark the |
69 // speculative socket as such, and IF we use a net::LOWEST priority, and if | 69 // speculative socket as such, and IF we use a net::LOWEST priority, and if |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 net_log_, &io_callback_); | 111 net_log_, &io_callback_); |
112 if (rv != net::ERR_IO_PENDING) | 112 if (rv != net::ERR_IO_PENDING) |
113 delete this; | 113 delete this; |
114 } | 114 } |
115 | 115 |
116 void Preconnect::OnPreconnectComplete(int error_code) { | 116 void Preconnect::OnPreconnectComplete(int error_code) { |
117 delete this; | 117 delete this; |
118 } | 118 } |
119 | 119 |
120 } // namespace chrome_browser_net | 120 } // namespace chrome_browser_net |
OLD | NEW |