diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-20 21:52:22 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-20 21:52:22 +0000 |
commit | 064b9a4dc94e9a5f911d1e474aa23dcd81a929c8 (patch) | |
tree | 8493d9f730596a9c773db65d738f2cbf0e7dff08 /net/proxy | |
parent | 96b939a7b319b4e925ed847cb5cbbcc921872f41 (diff) | |
download | chromium_src-064b9a4dc94e9a5f911d1e474aa23dcd81a929c8.zip chromium_src-064b9a4dc94e9a5f911d1e474aa23dcd81a929c8.tar.gz chromium_src-064b9a4dc94e9a5f911d1e474aa23dcd81a929c8.tar.bz2 |
Revert 118489 since it seems to regress linux-sizes.
"""
Adds custom ttl argument to HostCache::Set.
BUG=25472,107880
TEST=net_unittests
Review URL: http://codereview.chromium.org/9197009
TBR=szym@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9138039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118512 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy')
-rw-r--r-- | net/proxy/proxy_resolver_js_bindings.cc | 9 | ||||
-rw-r--r-- | net/proxy/proxy_resolver_js_bindings_unittest.cc | 7 | ||||
-rw-r--r-- | net/proxy/proxy_resolver_v8.cc | 12 |
3 files changed, 13 insertions, 15 deletions
diff --git a/net/proxy/proxy_resolver_js_bindings.cc b/net/proxy/proxy_resolver_js_bindings.cc index 399eee41..f3f6c15 100644 --- a/net/proxy/proxy_resolver_js_bindings.cc +++ b/net/proxy/proxy_resolver_js_bindings.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -23,10 +23,6 @@ namespace net { namespace { -// TTL for the per-request DNS cache. Applies to both successful and failed -// DNS resolutions. -const base::TimeDelta kCacheEntryTTL = base::TimeDelta::FromMinutes(5); - // Event parameters for a PAC error message (line number + message). class ErrorNetlogParams : public NetLog::EventParameters { public: @@ -267,8 +263,7 @@ class DefaultJSBindings : public ProxyResolverJSBindings { // Save the result back to the per-request DNS cache. if (host_cache) { host_cache->Set(cache_key, result, *address_list, - base::TimeTicks::Now(), - kCacheEntryTTL); + base::TimeTicks::Now()); } return result; diff --git a/net/proxy/proxy_resolver_js_bindings_unittest.cc b/net/proxy/proxy_resolver_js_bindings_unittest.cc index dc346e0..6ead6ef 100644 --- a/net/proxy/proxy_resolver_js_bindings_unittest.cc +++ b/net/proxy/proxy_resolver_js_bindings_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -235,8 +235,9 @@ TEST(ProxyResolverJSBindingsTest, PerRequestDNSCache) { // Now setup a per-request context, and try the same experiment -- we // expect the underlying host resolver to receive only 1 request this time, // since it will service the others from the per-request DNS cache. - const unsigned kMaxCacheEntries = 50; - HostCache cache(kMaxCacheEntries); + HostCache cache(50, + base::TimeDelta::FromMinutes(10), + base::TimeDelta::FromMinutes(10)); ProxyResolverRequestContext context(NULL, &cache); bindings->set_current_request_context(&context); diff --git a/net/proxy/proxy_resolver_v8.cc b/net/proxy/proxy_resolver_v8.cc index 114bf0f..92beb80 100644 --- a/net/proxy/proxy_resolver_v8.cc +++ b/net/proxy/proxy_resolver_v8.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -742,10 +742,12 @@ int ProxyResolverV8::GetProxyForURL( // available to any of the javascript "bindings" that are subsequently invoked // from the javascript. // - // In particular, we create a HostCache to aggressively cache failed DNS - // resolves. - const unsigned kMaxCacheEntries = 50; - HostCache host_cache(kMaxCacheEntries); + // In particular, we create a HostCache that is aggressive about caching + // failed DNS resolves. + HostCache host_cache( + 50, + base::TimeDelta::FromMinutes(5), + base::TimeDelta::FromMinutes(5)); ProxyResolverRequestContext request_context(&net_log, &host_cache); |