| 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/proxy/proxy_resolver_js_bindings.h" | 5 #include "net/proxy/proxy_resolver_js_bindings.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 223 } |
| 224 | 224 |
| 225 // Otherwise ask the host resolver. | 225 // Otherwise ask the host resolver. |
| 226 const BoundNetLog* net_log = GetNetLogForCurrentRequest(); | 226 const BoundNetLog* net_log = GetNetLogForCurrentRequest(); |
| 227 int result = host_resolver_->Resolve(info, | 227 int result = host_resolver_->Resolve(info, |
| 228 address_list, | 228 address_list, |
| 229 net_log ? *net_log : BoundNetLog()); | 229 net_log ? *net_log : BoundNetLog()); |
| 230 | 230 |
| 231 // Save the result back to the per-request DNS cache. | 231 // Save the result back to the per-request DNS cache. |
| 232 if (host_cache) { | 232 if (host_cache) { |
| 233 host_cache->Set(cache_key, result, *address_list, | 233 host_cache->Set(cache_key, HostCache::Entry(result, *address_list), |
| 234 base::TimeTicks::Now(), | 234 base::TimeTicks::Now(), |
| 235 base::TimeDelta::FromSeconds(kCacheEntryTTLSeconds)); | 235 base::TimeDelta::FromSeconds(kCacheEntryTTLSeconds)); |
| 236 } | 236 } |
| 237 | 237 |
| 238 return result; | 238 return result; |
| 239 } | 239 } |
| 240 | 240 |
| 241 // May return NULL. | 241 // May return NULL. |
| 242 const BoundNetLog* GetNetLogForCurrentRequest() { | 242 const BoundNetLog* GetNetLogForCurrentRequest() { |
| 243 if (!current_request_context()) | 243 if (!current_request_context()) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 282 |
| 283 // static | 283 // static |
| 284 ProxyResolverJSBindings* ProxyResolverJSBindings::CreateDefault( | 284 ProxyResolverJSBindings* ProxyResolverJSBindings::CreateDefault( |
| 285 SyncHostResolver* host_resolver, | 285 SyncHostResolver* host_resolver, |
| 286 NetLog* net_log, | 286 NetLog* net_log, |
| 287 ProxyResolverErrorObserver* error_observer) { | 287 ProxyResolverErrorObserver* error_observer) { |
| 288 return new DefaultJSBindings(host_resolver, net_log, error_observer); | 288 return new DefaultJSBindings(host_resolver, net_log, error_observer); |
| 289 } | 289 } |
| 290 | 290 |
| 291 } // namespace net | 291 } // namespace net |
| OLD | NEW |