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

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: remove #ifdef CrOS 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..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
« 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