Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Unified Diff: net/proxy/proxy_resolver_v8_tracing.cc

Issue 238433003: Provide Shill IP Address to myIpAddress() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« net/dns/host_resolver.h ('K') | « net/dns/host_resolver.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_resolver_v8_tracing.cc
diff --git a/net/proxy/proxy_resolver_v8_tracing.cc b/net/proxy/proxy_resolver_v8_tracing.cc
index f772dc1271f943e4d28624b212c11aa64ea92917..2fe2c6a1bf9ad5f5ffd1ef55127189a00f9ca139 100644
--- a/net/proxy/proxy_resolver_v8_tracing.cc
+++ b/net/proxy/proxy_resolver_v8_tracing.cc
@@ -847,23 +847,36 @@ void ProxyResolverV8Tracing::Job::DoDnsOperation() {
return;
HostResolver::RequestHandle dns_request = NULL;
- int result = host_resolver()->Resolve(
- MakeDnsRequestInfo(pending_dns_host_, pending_dns_op_),
- DEFAULT_PRIORITY,
- &pending_dns_addresses_,
- base::Bind(&Job::OnDnsOperationComplete, this),
- &dns_request,
- bound_net_log_);
-
- pending_dns_completed_synchronously_ = result != ERR_IO_PENDING;
-
- // Check if the request was cancelled as a side-effect of calling into the
- // HostResolver. This isn't the ordinary execution flow, however it is
- // exercised by unit-tests.
- if (cancelled_.IsSet()) {
- if (!pending_dns_completed_synchronously_)
- host_resolver()->CancelRequest(dns_request);
- return;
+ int result = OK;
+ pending_dns_completed_synchronously_ = false;
+
+ // If a system (e.g. Chrome OS) has specified an IP address, use it.
+ if (pending_dns_op_ == MY_IP_ADDRESS || pending_dns_op_ == MY_IP_ADDRESS_EX) {
+ bool include_ipv6 = pending_dns_op_ == MY_IP_ADDRESS_EX;
+ if (host_resolver()->ResolveFromMyIpAddress(include_ipv6,
+ &pending_dns_addresses_)) {
+ pending_dns_completed_synchronously_ = true;
+ }
+ }
+
+ if (!pending_dns_completed_synchronously_) {
+ result = host_resolver()->Resolve(
+ MakeDnsRequestInfo(pending_dns_host_, pending_dns_op_),
+ DEFAULT_PRIORITY,
+ &pending_dns_addresses_,
+ base::Bind(&Job::OnDnsOperationComplete, this),
+ &dns_request,
+ bound_net_log_);
+ pending_dns_completed_synchronously_ = result != ERR_IO_PENDING;
+
+ // Check if the request was cancelled as a side-effect of calling into the
+ // HostResolver. This isn't the ordinary execution flow, however it is
+ // exercised by unit-tests.
+ if (cancelled_.IsSet()) {
+ if (!pending_dns_completed_synchronously_)
+ host_resolver()->CancelRequest(dns_request);
+ return;
+ }
}
if (pending_dns_completed_synchronously_) {
« net/dns/host_resolver.h ('K') | « net/dns/host_resolver.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698