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

Side by Side Diff: net/proxy/proxy_resolver_js_bindings.cc

Issue 11065052: [net] Add AsyncDNS.TTL histogram. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add NET_EXPORT to HostCache::Entry Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/mock_host_resolver.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/base/mock_host_resolver.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698