OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/network_hints/browser/network_hints_message_filter.h" | 5 #include "components/network_hints/browser/network_hints_message_filter.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "components/network_hints/common/network_hints_common.h" | 9 #include "components/network_hints/common/network_hints_common.h" |
10 #include "components/network_hints/common/network_hints_messages.h" | 10 #include "components/network_hints/common/network_hints_messages.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 net::HostResolver::RequestInfo resolve_info( | 36 net::HostResolver::RequestInfo resolve_info( |
37 net::HostPortPair(hostname_, kDefaultPort)); | 37 net::HostPortPair(hostname_, kDefaultPort)); |
38 | 38 |
39 // Make a note that this is a speculative resolve request. This allows | 39 // Make a note that this is a speculative resolve request. This allows |
40 // separating it from real navigations in the observer's callback, and | 40 // separating it from real navigations in the observer's callback, and |
41 // lets the HostResolver know it can be de-prioritized. | 41 // lets the HostResolver know it can be de-prioritized. |
42 resolve_info.set_is_speculative(true); | 42 resolve_info.set_is_speculative(true); |
43 return resolver_->Resolve( | 43 return resolver_->Resolve( |
44 resolve_info, net::DEFAULT_PRIORITY, &addresses_, | 44 resolve_info, net::DEFAULT_PRIORITY, &addresses_, |
45 base::Bind(&DnsLookupRequest::OnLookupFinished, base::Owned(this)), | 45 base::Bind(&DnsLookupRequest::OnLookupFinished, base::Owned(this)), |
46 &request_, net::BoundNetLog()); | 46 &request_, net::NetLogWithSource()); |
47 } | 47 } |
48 | 48 |
49 private: | 49 private: |
50 void OnLookupFinished(int result) { | 50 void OnLookupFinished(int result) { |
51 VLOG(2) << __FUNCTION__ << ": " << hostname_ << ", result=" << result; | 51 VLOG(2) << __FUNCTION__ << ": " << hostname_ << ", result=" << result; |
52 } | 52 } |
53 | 53 |
54 const std::string hostname_; | 54 const std::string hostname_; |
55 net::HostResolver* resolver_; | 55 net::HostResolver* resolver_; |
56 std::unique_ptr<net::HostResolver::Request> request_; | 56 std::unique_ptr<net::HostResolver::Request> request_; |
(...skipping 28 matching lines...) Expand all Loading... |
85 DCHECK(host_resolver_); | 85 DCHECK(host_resolver_); |
86 for (const std::string& hostname : lookup_request.hostname_list) { | 86 for (const std::string& hostname : lookup_request.hostname_list) { |
87 DnsLookupRequest* request = new DnsLookupRequest(host_resolver_, hostname); | 87 DnsLookupRequest* request = new DnsLookupRequest(host_resolver_, hostname); |
88 // Note: DnsLookupRequest will be freed by the base::Owned call when | 88 // Note: DnsLookupRequest will be freed by the base::Owned call when |
89 // resolving has completed. | 89 // resolving has completed. |
90 request->Start(); | 90 request->Start(); |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 } // namespace network_hints | 94 } // namespace network_hints |
OLD | NEW |