| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/dns/host_resolver_impl.h" | 5 #include "net/dns/host_resolver_impl.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <Winsock2.h> | 8 #include <Winsock2.h> |
| 9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
| 10 #include <netdb.h> | 10 #include <netdb.h> |
| (...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2149 return ERR_NAME_NOT_RESOLVED; | 2149 return ERR_NAME_NOT_RESOLVED; |
| 2150 } | 2150 } |
| 2151 | 2151 |
| 2152 int net_error = ERR_UNEXPECTED; | 2152 int net_error = ERR_UNEXPECTED; |
| 2153 if (ResolveAsIP(key, info, ip_address, &net_error, addresses)) { | 2153 if (ResolveAsIP(key, info, ip_address, &net_error, addresses)) { |
| 2154 MakeNotStale(stale_info); | 2154 MakeNotStale(stale_info); |
| 2155 return net_error; | 2155 return net_error; |
| 2156 } | 2156 } |
| 2157 if (ServeFromCache(key, info, &net_error, addresses, allow_stale, | 2157 if (ServeFromCache(key, info, &net_error, addresses, allow_stale, |
| 2158 stale_info)) { | 2158 stale_info)) { |
| 2159 source_net_log.AddEvent(NetLogEventType::HOST_RESOLVER_IMPL_CACHE_HIT); | 2159 source_net_log.AddEvent(NetLogEventType::HOST_RESOLVER_IMPL_CACHE_HIT, |
| 2160 addresses->CreateNetLogCallback()); |
| 2160 // |ServeFromCache()| will set |*stale_info| as needed. | 2161 // |ServeFromCache()| will set |*stale_info| as needed. |
| 2161 RunCacheHitCallbacks(key, info); | 2162 RunCacheHitCallbacks(key, info); |
| 2162 return net_error; | 2163 return net_error; |
| 2163 } | 2164 } |
| 2164 // TODO(szym): Do not do this if nsswitch.conf instructs not to. | 2165 // TODO(szym): Do not do this if nsswitch.conf instructs not to. |
| 2165 // http://crbug.com/117655 | 2166 // http://crbug.com/117655 |
| 2166 if (ServeFromHosts(key, info, addresses)) { | 2167 if (ServeFromHosts(key, info, addresses)) { |
| 2167 source_net_log.AddEvent(NetLogEventType::HOST_RESOLVER_IMPL_HOSTS_HIT); | 2168 source_net_log.AddEvent(NetLogEventType::HOST_RESOLVER_IMPL_HOSTS_HIT, |
| 2169 addresses->CreateNetLogCallback()); |
| 2168 MakeNotStale(stale_info); | 2170 MakeNotStale(stale_info); |
| 2169 return OK; | 2171 return OK; |
| 2170 } | 2172 } |
| 2171 | 2173 |
| 2172 if (ServeLocalhost(key, info, addresses)) { | 2174 if (ServeLocalhost(key, info, addresses)) { |
| 2173 MakeNotStale(stale_info); | 2175 MakeNotStale(stale_info); |
| 2174 return OK; | 2176 return OK; |
| 2175 } | 2177 } |
| 2176 | 2178 |
| 2177 return ERR_DNS_CACHE_MISS; | 2179 return ERR_DNS_CACHE_MISS; |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2716 if (job_) | 2718 if (job_) |
| 2717 job_->CancelRequest(this); | 2719 job_->CancelRequest(this); |
| 2718 } | 2720 } |
| 2719 | 2721 |
| 2720 void HostResolverImpl::RequestImpl::ChangeRequestPriority( | 2722 void HostResolverImpl::RequestImpl::ChangeRequestPriority( |
| 2721 RequestPriority priority) { | 2723 RequestPriority priority) { |
| 2722 job_->ChangeRequestPriority(this, priority); | 2724 job_->ChangeRequestPriority(this, priority); |
| 2723 } | 2725 } |
| 2724 | 2726 |
| 2725 } // namespace net | 2727 } // namespace net |
| OLD | NEW |