Index: net/base/host_cache.cc |
diff --git a/net/base/host_cache.cc b/net/base/host_cache.cc |
index 5221fca9caeae744ad36b4b477f24afd0592dee4..1c14da7e2751f704fa340f0c7c591679f9c9f7b3 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 |