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

Unified Diff: net/base/host_cache.cc

Issue 11358125: [net] Set default HostCache size according to HostCacheSize field trial. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698