diff options
author | szym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-07 18:24:02 +0000 |
---|---|---|
committer | szym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-07 18:24:02 +0000 |
commit | 2144768db8c34172ab323779f3eb46d92d62880b (patch) | |
tree | 0940979b9d1f34a2b14437e58477ca2053a17e81 | |
parent | 1db1c696a5b62e795d835d4d28992b4a118681d6 (diff) | |
download | chromium_src-2144768db8c34172ab323779f3eb46d92d62880b.zip chromium_src-2144768db8c34172ab323779f3eb46d92d62880b.tar.gz chromium_src-2144768db8c34172ab323779f3eb46d92d62880b.tar.bz2 |
[net] Set default HostCache size according to HostCacheSize field trial.
BUG=114277,143454
Review URL: https://chromiumcodereview.appspot.com/11358125
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166472 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/base/host_cache.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/net/base/host_cache.cc b/net/base/host_cache.cc index 5221fca..1c14da7 100644 --- a/net/base/host_cache.cc +++ b/net/base/host_cache.cc @@ -5,6 +5,8 @@ #include "net/base/host_cache.h" #include "base/logging.h" +#include "base/metrics/field_trial.h" +#include "base/string_number_conversions.h" #include "net/base/net_errors.h" namespace net { @@ -80,15 +82,14 @@ const HostCache::EntryMap& HostCache::entries() const { // static scoped_ptr<HostCache> HostCache::CreateDefaultCache() { -#if defined(OS_CHROMEOS) - // Increase HostCache size for the duration of the async DNS field trial. - // http://crbug.com/143454 - // TODO(szym): Determine the best size. http://crbug.com/114277 - static const size_t kMaxHostCacheEntries = 1000; -#else - static const size_t kMaxHostCacheEntries = 100; -#endif - return make_scoped_ptr(new HostCache(kMaxHostCacheEntries)); + // Cache capacity is determined by the field trial. + const size_t kSaneMaxEntries = 1 << 20; + size_t max_entries = 0; + if (!base::StringToSizeT(base::FieldTrialList::FindFullName("HostCacheSize"), + &max_entries) || max_entries > kSaneMaxEntries) { + max_entries = 100; + } + return make_scoped_ptr(new HostCache(max_entries)); } } // namespace net |