Index: net/base/host_cache.cc |
diff --git a/net/base/host_cache.cc b/net/base/host_cache.cc |
index 5221fca9caeae744ad36b4b477f24afd0592dee4..be674888e278897b62e47490ac3dfd315ad7a307 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 { |
@@ -84,11 +86,16 @@ scoped_ptr<HostCache> HostCache::CreateDefaultCache() { |
// 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; |
+ size_t max_entries = 1000; |
#else |
- static const size_t kMaxHostCacheEntries = 100; |
+ const size_t kSaneMaxEntries = 1 << 20; |
+ size_t max_entries = 0; |
+ if (!base::StringToSizeT(base::FieldTrialList::FindFullName("HostCacheSize"), |
+ &max_entries) || max_entries > kSaneMaxEntries) { |
mmenke
2012/11/07 16:11:00
How are we going to handle recording histograms on
szym
2012/11/07 16:22:42
My bad, I forgot to remove the #ifdef. There's no
|
+ max_entries = 100; |
+ } |
#endif |
- return make_scoped_ptr(new HostCache(kMaxHostCacheEntries)); |
+ return make_scoped_ptr(new HostCache(max_entries)); |
} |
} // namespace net |