diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-16 21:24:41 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-16 21:24:41 +0000 |
commit | b9823c0cae09ee428d05ca79933d53609cde13a4 (patch) | |
tree | a4177d4951ce5e441b5b1c1e689eeaa2dc482531 | |
parent | 3f6fa6d4ce076abcd1e424383ea7278a24fd41c7 (diff) | |
download | chromium_src-b9823c0cae09ee428d05ca79933d53609cde13a4.zip chromium_src-b9823c0cae09ee428d05ca79933d53609cde13a4.tar.gz chromium_src-b9823c0cae09ee428d05ca79933d53609cde13a4.tar.bz2 |
Add a priority parameter for HostResolver::RequestInfo's constructor
Use DEFAULT_PRIORITY when there isn't already a priority
available.
This has the net effect of changing the priority of
host resolver requests that didn't specify one from
MEDIUM to DEFAULT_PRIORITY (= LOWEST). This is okay,
as those requests apparently didn't care what priority
they wanted.
BUG=166689
TBR=mmenke@chromium.org
Review URL: https://codereview.chromium.org/23146004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218093 0039d316-1c4b-4281-b951-d872f2087c98
32 files changed, 176 insertions, 112 deletions
diff --git a/chrome/browser/devtools/tethering_adb_filter.cc b/chrome/browser/devtools/tethering_adb_filter.cc index 8bf35ad..09b138b 100644 --- a/chrome/browser/devtools/tethering_adb_filter.cc +++ b/chrome/browser/devtools/tethering_adb_filter.cc @@ -77,11 +77,13 @@ class SocketTunnel { host_resolver_ = net::HostResolver::CreateDefaultResolver(NULL); net::HostResolver::RequestInfo request_info( - net::HostPortPair(tokens[0], port)); + net::HostPortPair(tokens[0], port), net::DEFAULT_PRIORITY); result = host_resolver_->Resolve( - request_info, &address_list_, + request_info, + &address_list_, base::Bind(&SocketTunnel::OnResolved, base::Unretained(this)), - NULL, net::BoundNetLog()); + NULL, + net::BoundNetLog()); if (result != net::ERR_IO_PENDING) OnResolved(result); } diff --git a/chrome/browser/extensions/api/dns/dns_api.cc b/chrome/browser/extensions/api/dns/dns_api.cc index 1c91f41..f917f5d 100644 --- a/chrome/browser/extensions/api/dns/dns_api.cc +++ b/chrome/browser/extensions/api/dns/dns_api.cc @@ -58,11 +58,14 @@ void DnsResolveFunction::WorkOnIOThread() { // determining its answer. net::HostPortPair host_port_pair(hostname_, 0); - net::HostResolver::RequestInfo request_info(host_port_pair); + net::HostResolver::RequestInfo request_info(host_port_pair, + net::DEFAULT_PRIORITY); int resolve_result = host_resolver->Resolve( - request_info, addresses_.get(), + request_info, + addresses_.get(), base::Bind(&DnsResolveFunction::OnLookupFinished, this), - request_handle_.get(), net::BoundNetLog()); + request_handle_.get(), + net::BoundNetLog()); // Balanced in OnLookupFinished. AddRef(); diff --git a/chrome/browser/extensions/api/socket/socket_api.cc b/chrome/browser/extensions/api/socket/socket_api.cc index 8c1a55b..ea34b49 100644 --- a/chrome/browser/extensions/api/socket/socket_api.cc +++ b/chrome/browser/extensions/api/socket/socket_api.cc @@ -106,11 +106,14 @@ void SocketExtensionWithDnsLookupFunction::StartDnsLookup( // determining its answer. net::HostPortPair host_port_pair(hostname, 0); - net::HostResolver::RequestInfo request_info(host_port_pair); + net::HostResolver::RequestInfo request_info(host_port_pair, + net::DEFAULT_PRIORITY); int resolve_result = host_resolver->Resolve( - request_info, addresses_.get(), + request_info, + addresses_.get(), base::Bind(&SocketExtensionWithDnsLookupFunction::OnDnsLookup, this), - request_handle_.get(), net::BoundNetLog()); + request_handle_.get(), + net::BoundNetLog()); if (resolve_result != net::ERR_IO_PENDING) OnDnsLookup(resolve_result); diff --git a/chrome/browser/net/network_stats.cc b/chrome/browser/net/network_stats.cc index 1bc3161e..4898a4b 100644 --- a/chrome/browser/net/network_stats.cc +++ b/chrome/browser/net/network_stats.cc @@ -147,7 +147,8 @@ bool NetworkStats::Start(net::HostResolver* host_resolver, scoped_ptr<net::SingleRequestHostResolver> resolver( new net::SingleRequestHostResolver(host_resolver)); - net::HostResolver::RequestInfo request(server_host_port_pair); + net::HostResolver::RequestInfo request(server_host_port_pair, + net::DEFAULT_PRIORITY); int rv = resolver->Resolve(request, &addresses_, diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc index 6e8e2fe..4823910 100644 --- a/chrome/browser/net/predictor.cc +++ b/chrome/browser/net/predictor.cc @@ -101,7 +101,7 @@ class Predictor::LookupRequest { // anything else ==> Host was not found synchronously. int Start() { net::HostResolver::RequestInfo resolve_info( - net::HostPortPair::FromURL(url_)); + net::HostPortPair::FromURL(url_), net::DEFAULT_PRIORITY); // Make a note that this is a speculative resolve request. This allows us // to separate it from real navigations in the observer's callback, and diff --git a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc index f1249d5..f945056 100644 --- a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc +++ b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc @@ -49,9 +49,11 @@ class P2PSocketDispatcherHost::DnsRequest { if (host_name_.at(host_name_.size() - 1) != '.') host_name_ = host_name_ + '.'; - net::HostResolver::RequestInfo info(net::HostPortPair(host_name_, 0)); + net::HostResolver::RequestInfo info(net::HostPortPair(host_name_, 0), + net::DEFAULT_PRIORITY); int result = resolver_.Resolve( - info, &addresses_, + info, + &addresses_, base::Bind(&P2PSocketDispatcherHost::DnsRequest::OnDone, base::Unretained(this)), net::BoundNetLog()); diff --git a/content/browser/renderer_host/pepper/pepper_host_resolver_message_filter.cc b/content/browser/renderer_host/pepper/pepper_host_resolver_message_filter.cc index e0e17b3..86e1b96 100644 --- a/content/browser/renderer_host/pepper/pepper_host_resolver_message_filter.cc +++ b/content/browser/renderer_host/pepper/pepper_host_resolver_message_filter.cc @@ -169,7 +169,7 @@ void PepperHostResolverMessageFilter::DoResolve( } net::HostResolver::RequestInfo request_info( - net::HostPortPair(host_port.host, host_port.port)); + net::HostPortPair(host_port.host, host_port.port), net::DEFAULT_PRIORITY); PrepareRequestInfo(hint, &request_info); scoped_ptr<ReplyMessageContext> bound_info(new ReplyMessageContext(context)); diff --git a/content/browser/renderer_host/pepper/pepper_tcp_socket.cc b/content/browser/renderer_host/pepper/pepper_tcp_socket.cc index 05b2e09..eaf4383 100644 --- a/content/browser/renderer_host/pepper/pepper_tcp_socket.cc +++ b/content/browser/renderer_host/pepper/pepper_tcp_socket.cc @@ -86,11 +86,13 @@ void PepperTCPSocket::Connect(const std::string& host, uint16_t port) { } connection_state_ = CONNECT_IN_PROGRESS; - net::HostResolver::RequestInfo request_info(net::HostPortPair(host, port)); - resolver_.reset(new net::SingleRequestHostResolver( - manager_->GetHostResolver())); + net::HostResolver::RequestInfo request_info(net::HostPortPair(host, port), + net::DEFAULT_PRIORITY); + resolver_.reset( + new net::SingleRequestHostResolver(manager_->GetHostResolver())); int net_result = resolver_->Resolve( - request_info, &address_list_, + request_info, + &address_list_, base::Bind(&PepperTCPSocket::OnResolveCompleted, base::Unretained(this)), net::BoundNetLog()); if (net_result != net::ERR_IO_PENDING) diff --git a/net/dns/host_resolver.cc b/net/dns/host_resolver.cc index d74be91..1f3e309 100644 --- a/net/dns/host_resolver.cc +++ b/net/dns/host_resolver.cc @@ -93,14 +93,14 @@ HostResolver::Options::Options() enable_caching(true) { } -HostResolver::RequestInfo::RequestInfo(const HostPortPair& host_port_pair) +HostResolver::RequestInfo::RequestInfo(const HostPortPair& host_port_pair, + RequestPriority priority) : host_port_pair_(host_port_pair), address_family_(ADDRESS_FAMILY_UNSPECIFIED), host_resolver_flags_(0), allow_cached_response_(true), is_speculative_(false), - priority_(MEDIUM) { -} + priority_(priority) {} HostResolver::~HostResolver() { } diff --git a/net/dns/host_resolver.h b/net/dns/host_resolver.h index 558a1dd..8d3c228 100644 --- a/net/dns/host_resolver.h +++ b/net/dns/host_resolver.h @@ -53,11 +53,12 @@ class NET_EXPORT HostResolver { bool enable_caching; }; - // The parameters for doing a Resolve(). A hostname and port are required, - // the rest are optional (and have reasonable defaults). + // The parameters for doing a Resolve(). A hostname, port, and + // priority are required; the rest are optional (and have reasonable + // defaults). class NET_EXPORT RequestInfo { public: - explicit RequestInfo(const HostPortPair& host_port_pair); + RequestInfo(const HostPortPair& host_port_pair, RequestPriority priority); const HostPortPair& host_port_pair() const { return host_port_pair_; } void set_host_port_pair(const HostPortPair& host_port_pair) { @@ -86,7 +87,6 @@ class NET_EXPORT HostResolver { void set_is_speculative(bool b) { is_speculative_ = b; } RequestPriority priority() const { return priority_; } - void set_priority(RequestPriority priority) { priority_ = priority; } private: // The hostname to resolve, and the port to use in resulting sockaddrs. diff --git a/net/dns/host_resolver_impl_unittest.cc b/net/dns/host_resolver_impl_unittest.cc index f6b7f69..dfe0fc8 100644 --- a/net/dns/host_resolver_impl_unittest.cc +++ b/net/dns/host_resolver_impl_unittest.cc @@ -468,8 +468,7 @@ class HostResolverImplTest : public testing::Test { int port, RequestPriority priority, AddressFamily family) { - HostResolver::RequestInfo info(HostPortPair(hostname, port)); - info.set_priority(priority); + HostResolver::RequestInfo info(HostPortPair(hostname, port), priority); info.set_address_family(family); return CreateRequest(info); } @@ -815,7 +814,8 @@ TEST_F(HostResolverImplTest, BypassCache) { // Ok good. Now make sure that if we ask to bypass the cache, it can no // longer service the request synchronously. - HostResolver::RequestInfo info(HostPortPair(hostname, 71)); + HostResolver::RequestInfo info(HostPortPair(hostname, 71), + DEFAULT_PRIORITY); info.set_allow_cached_response(false); EXPECT_EQ(ERR_IO_PENDING, CreateRequest(info)->Resolve()); } else if (71 == req->info().port()) { @@ -1186,7 +1186,8 @@ TEST_F(HostResolverImplTest, ResolveFromCache) { proc_->AddRuleForAllFamilies("just.testing", "192.168.1.42"); proc_->SignalMultiple(1u); // Need only one. - HostResolver::RequestInfo info(HostPortPair("just.testing", 80)); + HostResolver::RequestInfo info(HostPortPair("just.testing", 80), + DEFAULT_PRIORITY); // First hit will miss the cache. EXPECT_EQ(ERR_DNS_CACHE_MISS, CreateRequest(info)->ResolveFromCache()); @@ -1227,7 +1228,7 @@ TEST_F(HostResolverImplTest, MultipleAttempts) { NULL)); // Resolve "host1". - HostResolver::RequestInfo info(HostPortPair("host1", 70)); + HostResolver::RequestInfo info(HostPortPair("host1", 70), DEFAULT_PRIORITY); Request* req = CreateRequest(info); EXPECT_EQ(ERR_IO_PENDING, req->Resolve()); @@ -1603,7 +1604,8 @@ TEST_F(HostResolverImplDnsTest, DualFamilyLocalhost) { if (!saw_ipv4 && !saw_ipv6) return; - HostResolver::RequestInfo info(HostPortPair("localhost", 80)); + HostResolver::RequestInfo info(HostPortPair("localhost", 80), + DEFAULT_PRIORITY); info.set_address_family(ADDRESS_FAMILY_UNSPECIFIED); info.set_host_resolver_flags(HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6); diff --git a/net/dns/mapped_host_resolver_unittest.cc b/net/dns/mapped_host_resolver_unittest.cc index d859466..571392d 100644 --- a/net/dns/mapped_host_resolver_unittest.cc +++ b/net/dns/mapped_host_resolver_unittest.cc @@ -40,10 +40,13 @@ TEST(MappedHostResolverTest, Inclusion) { // Try resolving "www.google.com:80". There are no mappings yet, so this // hits |resolver_impl| and fails. TestCompletionCallback callback; - rv = resolver->Resolve(HostResolver::RequestInfo( - HostPortPair("www.google.com", 80)), - &address_list, callback.callback(), NULL, - BoundNetLog()); + rv = resolver->Resolve( + HostResolver::RequestInfo(HostPortPair("www.google.com", 80), + DEFAULT_PRIORITY), + &address_list, + callback.callback(), + NULL, + BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); rv = callback.WaitForResult(); EXPECT_EQ(ERR_NAME_NOT_RESOLVED, rv); @@ -52,10 +55,13 @@ TEST(MappedHostResolverTest, Inclusion) { EXPECT_TRUE(resolver->AddRuleFromString("map *.google.com baz.com")); // Try resolving "www.google.com:80". Should be remapped to "baz.com:80". - rv = resolver->Resolve(HostResolver::RequestInfo( - HostPortPair("www.google.com", 80)), - &address_list, callback.callback(), NULL, - BoundNetLog()); + rv = resolver->Resolve( + HostResolver::RequestInfo(HostPortPair("www.google.com", 80), + DEFAULT_PRIORITY), + &address_list, + callback.callback(), + NULL, + BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); rv = callback.WaitForResult(); EXPECT_EQ(OK, rv); @@ -63,9 +69,12 @@ TEST(MappedHostResolverTest, Inclusion) { // Try resolving "foo.com:77". This will NOT be remapped, so result // is "foo.com:77". - rv = resolver->Resolve(HostResolver::RequestInfo(HostPortPair("foo.com", 77)), - &address_list, callback.callback(), NULL, - BoundNetLog()); + rv = resolver->Resolve( + HostResolver::RequestInfo(HostPortPair("foo.com", 77), DEFAULT_PRIORITY), + &address_list, + callback.callback(), + NULL, + BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); rv = callback.WaitForResult(); EXPECT_EQ(OK, rv); @@ -75,10 +84,13 @@ TEST(MappedHostResolverTest, Inclusion) { EXPECT_TRUE(resolver->AddRuleFromString("Map *.org proxy:99")); // Try resolving "chromium.org:61". Should be remapped to "proxy:99". - rv = resolver->Resolve(HostResolver::RequestInfo - (HostPortPair("chromium.org", 61)), - &address_list, callback.callback(), NULL, - BoundNetLog()); + rv = + resolver->Resolve(HostResolver::RequestInfo( + HostPortPair("chromium.org", 61), DEFAULT_PRIORITY), + &address_list, + callback.callback(), + NULL, + BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); rv = callback.WaitForResult(); EXPECT_EQ(OK, rv); @@ -107,10 +119,13 @@ TEST(MappedHostResolverTest, Exclusion) { EXPECT_TRUE(resolver->AddRuleFromString("EXCLUDE *.google.com")); // Try resolving "www.google.com". Should not be remapped due to exclusion). - rv = resolver->Resolve(HostResolver::RequestInfo( - HostPortPair("www.google.com", 80)), - &address_list, callback.callback(), NULL, - BoundNetLog()); + rv = resolver->Resolve( + HostResolver::RequestInfo(HostPortPair("www.google.com", 80), + DEFAULT_PRIORITY), + &address_list, + callback.callback(), + NULL, + BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); rv = callback.WaitForResult(); EXPECT_EQ(OK, rv); @@ -118,8 +133,10 @@ TEST(MappedHostResolverTest, Exclusion) { // Try resolving "chrome.com:80". Should be remapped to "baz:80". rv = resolver->Resolve(HostResolver::RequestInfo( - HostPortPair("chrome.com", 80)), - &address_list, callback.callback(), NULL, + HostPortPair("chrome.com", 80), DEFAULT_PRIORITY), + &address_list, + callback.callback(), + NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); rv = callback.WaitForResult(); @@ -145,10 +162,13 @@ TEST(MappedHostResolverTest, SetRulesFromString) { resolver->SetRulesFromString("map *.com baz , map *.net bar:60"); // Try resolving "www.google.com". Should be remapped to "baz". - rv = resolver->Resolve(HostResolver::RequestInfo( - HostPortPair("www.google.com", 80)), - &address_list, callback.callback(), NULL, - BoundNetLog()); + rv = resolver->Resolve( + HostResolver::RequestInfo(HostPortPair("www.google.com", 80), + DEFAULT_PRIORITY), + &address_list, + callback.callback(), + NULL, + BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); rv = callback.WaitForResult(); EXPECT_EQ(OK, rv); @@ -156,8 +176,10 @@ TEST(MappedHostResolverTest, SetRulesFromString) { // Try resolving "chrome.net:80". Should be remapped to "bar:60". rv = resolver->Resolve(HostResolver::RequestInfo( - HostPortPair("chrome.net", 80)), - &address_list, callback.callback(), NULL, + HostPortPair("chrome.net", 80), DEFAULT_PRIORITY), + &address_list, + callback.callback(), + NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); rv = callback.WaitForResult(); @@ -196,17 +218,22 @@ TEST(MappedHostResolverTest, MapToError) { // Try resolving www.google.com --> Should give an error. TestCompletionCallback callback1; - rv = resolver->Resolve(HostResolver::RequestInfo( - HostPortPair("www.google.com", 80)), - &address_list, callback1.callback(), NULL, - BoundNetLog()); + rv = resolver->Resolve( + HostResolver::RequestInfo(HostPortPair("www.google.com", 80), + DEFAULT_PRIORITY), + &address_list, + callback1.callback(), + NULL, + BoundNetLog()); EXPECT_EQ(ERR_NAME_NOT_RESOLVED, rv); // Try resolving www.foo.com --> Should succeed. TestCompletionCallback callback2; rv = resolver->Resolve(HostResolver::RequestInfo( - HostPortPair("www.foo.com", 80)), - &address_list, callback2.callback(), NULL, + HostPortPair("www.foo.com", 80), DEFAULT_PRIORITY), + &address_list, + callback2.callback(), + NULL, BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); rv = callback2.WaitForResult(); diff --git a/net/dns/single_request_host_resolver_unittest.cc b/net/dns/single_request_host_resolver_unittest.cc index 1b0198f..6512df6 100644 --- a/net/dns/single_request_host_resolver_unittest.cc +++ b/net/dns/single_request_host_resolver_unittest.cc @@ -75,7 +75,8 @@ TEST(SingleRequestHostResolverTest, NormalResolve) { // Resolve "watsup:90" using our SingleRequestHostResolver. AddressList addrlist; TestCompletionCallback callback; - HostResolver::RequestInfo request(HostPortPair("watsup", 90)); + HostResolver::RequestInfo request(HostPortPair("watsup", 90), + DEFAULT_PRIORITY); int rv = single_request_resolver.Resolve( request, &addrlist, callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); @@ -96,7 +97,8 @@ TEST(SingleRequestHostResolverTest, Cancel) { // Resolve "watsup:90" using our SingleRequestHostResolver. AddressList addrlist; TestCompletionCallback callback; - HostResolver::RequestInfo request(HostPortPair("watsup", 90)); + HostResolver::RequestInfo request(HostPortPair("watsup", 90), + DEFAULT_PRIORITY); int rv = single_request_resolver.Resolve( request, &addrlist, callback.callback(), BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index f9f7b82..e389f8d 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -647,7 +647,8 @@ int FtpNetworkTransaction::DoLoop(int result) { int FtpNetworkTransaction::DoCtrlResolveHost() { next_state_ = STATE_CTRL_RESOLVE_HOST_COMPLETE; - HostResolver::RequestInfo info(HostPortPair::FromURL(request_->url)); + HostResolver::RequestInfo info(HostPortPair::FromURL(request_->url), + DEFAULT_PRIORITY); // No known referrer. return resolver_.Resolve( info, &addresses_, diff --git a/net/http/http_auth_handler_negotiate.cc b/net/http/http_auth_handler_negotiate.cc index 21f5d65..8143744 100644 --- a/net/http/http_auth_handler_negotiate.cc +++ b/net/http/http_auth_handler_negotiate.cc @@ -287,7 +287,8 @@ int HttpAuthHandlerNegotiate::DoResolveCanonicalName() { // TODO(cbentzel): Add reverse DNS lookup for numeric addresses. DCHECK(!single_resolve_.get()); - HostResolver::RequestInfo info(HostPortPair(origin_.host(), 0)); + HostResolver::RequestInfo info(HostPortPair(origin_.host(), 0), + DEFAULT_PRIORITY); info.set_host_resolver_flags(HOST_RESOLVER_CANONNAME); single_resolve_.reset(new SingleRequestHostResolver(resolver_)); return single_resolve_->Resolve( diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 2f0b711..f2273ce 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -7282,8 +7282,12 @@ void HttpNetworkTransactionTest::BypassHostCacheOnRefreshHelper( AddressList addrlist; TestCompletionCallback callback; int rv = session_deps_.host_resolver->Resolve( - HostResolver::RequestInfo(HostPortPair("www.google.com", 80)), &addrlist, - callback.callback(), NULL, BoundNetLog()); + HostResolver::RequestInfo(HostPortPair("www.google.com", 80), + DEFAULT_PRIORITY), + &addrlist, + callback.callback(), + NULL, + BoundNetLog()); EXPECT_EQ(ERR_IO_PENDING, rv); rv = callback.WaitForResult(); EXPECT_EQ(OK, rv); @@ -7291,8 +7295,12 @@ void HttpNetworkTransactionTest::BypassHostCacheOnRefreshHelper( // Verify that it was added to host cache, by doing a subsequent async lookup // and confirming it completes synchronously. rv = session_deps_.host_resolver->Resolve( - HostResolver::RequestInfo(HostPortPair("www.google.com", 80)), &addrlist, - callback.callback(), NULL, BoundNetLog()); + HostResolver::RequestInfo(HostPortPair("www.google.com", 80), + DEFAULT_PRIORITY), + &addrlist, + callback.callback(), + NULL, + BoundNetLog()); ASSERT_EQ(OK, rv); // Inject a failure the next time that "www.google.com" is resolved. This way @@ -10485,7 +10493,7 @@ WRAPPED_TEST_P(HttpNetworkTransactionTest, MAYBE_UseIPConnectionPooling) { // Preload www.gmail.com into HostCache. HostPortPair host_port("www.gmail.com", 443); - HostResolver::RequestInfo resolve_info(host_port); + HostResolver::RequestInfo resolve_info(host_port, DEFAULT_PRIORITY); AddressList ignored; rv = session_deps_.host_resolver->Resolve(resolve_info, &ignored, callback.callback(), NULL, @@ -10730,7 +10738,8 @@ WRAPPED_TEST_P(HttpNetworkTransactionTest, EXPECT_EQ("hello!", response_data); // Preload cache entries into HostCache. - HostResolver::RequestInfo resolve_info(HostPortPair("www.gmail.com", 443)); + HostResolver::RequestInfo resolve_info(HostPortPair("www.gmail.com", 443), + DEFAULT_PRIORITY); AddressList ignored; rv = host_resolver.Resolve(resolve_info, &ignored, callback.callback(), NULL, BoundNetLog()); diff --git a/net/proxy/proxy_resolver_v8_tracing.cc b/net/proxy/proxy_resolver_v8_tracing.cc index 4f6f5fc1..7bbf79d 100644 --- a/net/proxy/proxy_resolver_v8_tracing.cc +++ b/net/proxy/proxy_resolver_v8_tracing.cc @@ -971,7 +971,7 @@ HostResolver::RequestInfo ProxyResolverV8Tracing::Job::MakeDnsRequestInfo( host_port.set_host(GetHostName()); } - HostResolver::RequestInfo info(host_port); + HostResolver::RequestInfo info(host_port, DEFAULT_PRIORITY); // The non-ex flavors are limited to IPv4 results. if (op == MY_IP_ADDRESS || op == DNS_RESOLVE) { diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc index 0722b58..ac637cf 100644 --- a/net/quic/quic_network_transaction_unittest.cc +++ b/net/quic/quic_network_transaction_unittest.cc @@ -677,7 +677,8 @@ TEST_F(QuicNetworkTransactionTest, ZeroRTTWithNoHttpRace) { // synchronously. host_resolver_.set_synchronous_mode(true); host_resolver_.rules()->AddIPLiteralRule("www.google.com", "192.168.0.1", ""); - HostResolver::RequestInfo info(HostPortPair("www.google.com", 80)); + HostResolver::RequestInfo info(HostPortPair("www.google.com", 80), + DEFAULT_PRIORITY); AddressList address; host_resolver_.Resolve(info, &address, CompletionCallback(), NULL, net_log_.bound()); diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc index 86bd8a1..0057964 100644 --- a/net/quic/quic_stream_factory.cc +++ b/net/quic/quic_stream_factory.cc @@ -147,9 +147,9 @@ void QuicStreamFactory::Job::OnIOComplete(int rv) { int QuicStreamFactory::Job::DoResolveHost() { io_state_ = STATE_RESOLVE_HOST_COMPLETE; return host_resolver_.Resolve( - HostResolver::RequestInfo(host_port_proxy_pair_.first), &address_list_, - base::Bind(&QuicStreamFactory::Job::OnIOComplete, - base::Unretained(this)), + HostResolver::RequestInfo(host_port_proxy_pair_.first, DEFAULT_PRIORITY), + &address_list_, + base::Bind(&QuicStreamFactory::Job::OnIOComplete, base::Unretained(this)), net_log_); } diff --git a/net/socket/socks5_client_socket_unittest.cc b/net/socket/socks5_client_socket_unittest.cc index 4c9240f..7dfbab2 100644 --- a/net/socket/socks5_client_socket_unittest.cc +++ b/net/socket/socks5_client_socket_unittest.cc @@ -68,7 +68,8 @@ void SOCKS5ClientSocketTest::SetUp() { PlatformTest::SetUp(); // Resolve the "localhost" AddressList used by the TCP connection to connect. - HostResolver::RequestInfo info(HostPortPair("www.socks-proxy.com", 1080)); + HostResolver::RequestInfo info(HostPortPair("www.socks-proxy.com", 1080), + DEFAULT_PRIORITY); TestCompletionCallback callback; int rv = host_resolver_->Resolve(info, &address_list_, callback.callback(), NULL, BoundNetLog()); @@ -102,7 +103,8 @@ scoped_ptr<SOCKS5ClientSocket> SOCKS5ClientSocketTest::BuildMockSocket( connection->SetSocket(scoped_ptr<StreamSocket>(tcp_sock_)); return scoped_ptr<SOCKS5ClientSocket>(new SOCKS5ClientSocket( connection.Pass(), - HostResolver::RequestInfo(HostPortPair(hostname, port)))); + HostResolver::RequestInfo(HostPortPair(hostname, port), + DEFAULT_PRIORITY))); } // Tests a complete SOCKS5 handshake and the disconnection. diff --git a/net/socket/socks_client_socket_pool.cc b/net/socket/socks_client_socket_pool.cc index e49eaba..01eda32 100644 --- a/net/socket/socks_client_socket_pool.cc +++ b/net/socket/socks_client_socket_pool.cc @@ -24,13 +24,12 @@ SOCKSSocketParams::SOCKSSocketParams( const HostPortPair& host_port_pair, RequestPriority priority) : transport_params_(proxy_server), - destination_(host_port_pair), + destination_(host_port_pair, priority), socks_v5_(socks_v5) { if (transport_params_.get()) ignore_limits_ = transport_params_->ignore_limits(); else ignore_limits_ = false; - destination_.set_priority(priority); } SOCKSSocketParams::~SOCKSSocketParams() {} diff --git a/net/socket/socks_client_socket_unittest.cc b/net/socket/socks_client_socket_unittest.cc index 8c30838..d93c350 100644 --- a/net/socket/socks_client_socket_unittest.cc +++ b/net/socket/socks_client_socket_unittest.cc @@ -83,7 +83,7 @@ scoped_ptr<SOCKSClientSocket> SOCKSClientSocketTest::BuildMockSocket( connection->SetSocket(scoped_ptr<StreamSocket>(tcp_sock_)); return scoped_ptr<SOCKSClientSocket>(new SOCKSClientSocket( connection.Pass(), - HostResolver::RequestInfo(HostPortPair(hostname, port)), + HostResolver::RequestInfo(HostPortPair(hostname, port), DEFAULT_PRIORITY), host_resolver)); } diff --git a/net/socket/ssl_client_socket_pool_unittest.cc b/net/socket/ssl_client_socket_pool_unittest.cc index 8310441..7babd8b 100644 --- a/net/socket/ssl_client_socket_pool_unittest.cc +++ b/net/socket/ssl_client_socket_pool_unittest.cc @@ -744,9 +744,13 @@ TEST_P(SSLClientSocketPoolTest, IPPooling) { // This test requires that the HostResolver cache be populated. Normal // code would have done this already, but we do it manually. - HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort)); - host_resolver_.Resolve(info, &test_hosts[i].addresses, CompletionCallback(), - NULL, BoundNetLog()); + HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort), + DEFAULT_PRIORITY); + host_resolver_.Resolve(info, + &test_hosts[i].addresses, + CompletionCallback(), + NULL, + BoundNetLog()); // Setup a SpdySessionKey test_hosts[i].key = SpdySessionKey( @@ -800,9 +804,13 @@ void SSLClientSocketPoolTest::TestIPPoolingDisabled( // This test requires that the HostResolver cache be populated. Normal // code would have done this already, but we do it manually. - HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort)); - rv = host_resolver_.Resolve(info, &test_hosts[i].addresses, - callback.callback(), NULL, BoundNetLog()); + HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort), + DEFAULT_PRIORITY); + rv = host_resolver_.Resolve(info, + &test_hosts[i].addresses, + callback.callback(), + NULL, + BoundNetLog()); EXPECT_EQ(OK, callback.GetResult(rv)); // Setup a SpdySessionKey diff --git a/net/socket/transport_client_socket_pool.cc b/net/socket/transport_client_socket_pool.cc index 6d0afac..da87ae8 100644 --- a/net/socket/transport_client_socket_pool.cc +++ b/net/socket/transport_client_socket_pool.cc @@ -52,21 +52,15 @@ TransportSocketParams::TransportSocketParams( bool disable_resolver_cache, bool ignore_limits, const OnHostResolutionCallback& host_resolution_callback) - : destination_(host_port_pair), + : destination_(host_port_pair, priority), ignore_limits_(ignore_limits), host_resolution_callback_(host_resolution_callback) { - Initialize(priority, disable_resolver_cache); -} - -TransportSocketParams::~TransportSocketParams() {} - -void TransportSocketParams::Initialize(RequestPriority priority, - bool disable_resolver_cache) { - destination_.set_priority(priority); if (disable_resolver_cache) destination_.set_allow_cached_response(false); } +TransportSocketParams::~TransportSocketParams() {} + // TransportConnectJobs will time out after this many seconds. Note this is // the total time, including both host resolution and TCP connect() times. // diff --git a/net/socket/transport_client_socket_pool.h b/net/socket/transport_client_socket_pool.h index f392664..44a849e 100644 --- a/net/socket/transport_client_socket_pool.h +++ b/net/socket/transport_client_socket_pool.h @@ -49,8 +49,6 @@ class NET_EXPORT_PRIVATE TransportSocketParams friend class base::RefCounted<TransportSocketParams>; ~TransportSocketParams(); - void Initialize(RequestPriority priority, bool disable_resolver_cache); - HostResolver::RequestInfo destination_; bool ignore_limits_; const OnHostResolutionCallback host_resolution_callback_; diff --git a/net/socket/transport_client_socket_unittest.cc b/net/socket/transport_client_socket_unittest.cc index 5c5a303..96cad30 100644 --- a/net/socket/transport_client_socket_unittest.cc +++ b/net/socket/transport_client_socket_unittest.cc @@ -123,7 +123,8 @@ void TransportClientSocketTest::SetUp() { AddressList addr; // MockHostResolver resolves everything to 127.0.0.1. scoped_ptr<HostResolver> resolver(new MockHostResolver()); - HostResolver::RequestInfo info(HostPortPair("localhost", listen_port_)); + HostResolver::RequestInfo info(HostPortPair("localhost", listen_port_), + DEFAULT_PRIORITY); TestCompletionCallback callback; int rv = resolver->Resolve(info, &addr, callback.callback(), NULL, BoundNetLog()); diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc index c549fcb..8dd4faf 100644 --- a/net/socket_stream/socket_stream.cc +++ b/net/socket_stream/socket_stream.cc @@ -675,7 +675,7 @@ int SocketStream::DoResolveHost() { host_port_pair = HostPortPair::FromURL(url_); } - HostResolver::RequestInfo resolve_info(host_port_pair); + HostResolver::RequestInfo resolve_info(host_port_pair, DEFAULT_PRIORITY); DCHECK(context_->host_resolver()); resolver_.reset(new SingleRequestHostResolver(context_->host_resolver())); @@ -960,7 +960,8 @@ int SocketStream::DoSOCKSConnect() { next_state_ = STATE_SOCKS_CONNECT_COMPLETE; - HostResolver::RequestInfo req_info(HostPortPair::FromURL(url_)); + HostResolver::RequestInfo req_info(HostPortPair::FromURL(url_), + DEFAULT_PRIORITY); DCHECK(!proxy_info_.is_empty()); scoped_ptr<StreamSocket> s; diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc index 9e47f3f..80f10ed 100644 --- a/net/spdy/spdy_session_pool.cc +++ b/net/spdy/spdy_session_pool.cc @@ -163,7 +163,8 @@ base::WeakPtr<SpdySession> SpdySessionPool::FindAvailableSession( return base::WeakPtr<SpdySession>(); // Look up the key's from the resolver's cache. - net::HostResolver::RequestInfo resolve_info(key.host_port_pair()); + net::HostResolver::RequestInfo resolve_info(key.host_port_pair(), + DEFAULT_PRIORITY); AddressList addresses; int rv = resolver_->ResolveFromCache(resolve_info, &addresses, net_log); DCHECK_NE(rv, ERR_IO_PENDING); diff --git a/net/spdy/spdy_session_pool_unittest.cc b/net/spdy/spdy_session_pool_unittest.cc index 9d0679d..9e10ed22 100644 --- a/net/spdy/spdy_session_pool_unittest.cc +++ b/net/spdy/spdy_session_pool_unittest.cc @@ -336,10 +336,13 @@ void SpdySessionPoolTest::RunIPPoolingTest( // This test requires that the HostResolver cache be populated. Normal // code would have done this already, but we do it manually. - HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort)); - session_deps_.host_resolver->Resolve( - info, &test_hosts[i].addresses, CompletionCallback(), NULL, - BoundNetLog()); + HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort), + DEFAULT_PRIORITY); + session_deps_.host_resolver->Resolve(info, + &test_hosts[i].addresses, + CompletionCallback(), + NULL, + BoundNetLog()); // Setup a SpdySessionKey test_hosts[i].key = SpdySessionKey( diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc index b8f32f8..d1addb5 100644 --- a/net/spdy/spdy_session_unittest.cc +++ b/net/spdy/spdy_session_unittest.cc @@ -2817,7 +2817,7 @@ TEST_P(SpdySessionTest, CloseOneIdleConnectionWithAlias) { // Set up an alias for the idle SPDY session, increasing its ref count to 2. SpdySessionKey key2(HostPortPair("2.com", 80), ProxyServer::Direct(), kPrivacyModeDisabled); - HostResolver::RequestInfo info(key2.host_port_pair()); + HostResolver::RequestInfo info(key2.host_port_pair(), DEFAULT_PRIORITY); AddressList addresses; // Pre-populate the DNS cache, since a synchronous resolution is required in // order to create the alias. diff --git a/net/test/spawned_test_server/base_test_server.cc b/net/test/spawned_test_server/base_test_server.cc index c13745b..7f8cb7e 100644 --- a/net/test/spawned_test_server/base_test_server.cc +++ b/net/test/spawned_test_server/base_test_server.cc @@ -169,7 +169,7 @@ bool BaseTestServer::GetAddressList(AddressList* address_list) const { DCHECK(address_list); scoped_ptr<HostResolver> resolver(HostResolver::CreateDefaultResolver(NULL)); - HostResolver::RequestInfo info(host_port_pair_); + HostResolver::RequestInfo info(host_port_pair_, DEFAULT_PRIORITY); TestCompletionCallback callback; int rv = resolver->Resolve(info, address_list, callback.callback(), NULL, BoundNetLog()); diff --git a/net/tools/gdig/gdig.cc b/net/tools/gdig/gdig.cc index 0dec8d7..a3c16e4 100644 --- a/net/tools/gdig/gdig.cc +++ b/net/tools/gdig/gdig.cc @@ -449,7 +449,8 @@ void GDig::ReplayNextEntry() { return; } - HostResolver::RequestInfo info(HostPortPair(entry.domain_name.c_str(), 80)); + HostResolver::RequestInfo info(HostPortPair(entry.domain_name.c_str(), 80), + DEFAULT_PRIORITY); AddressList* addrlist = new AddressList(); unsigned current_index = replay_log_index_; CompletionCallback callback = base::Bind(&GDig::OnResolveComplete, |