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

Unified Diff: net/base/host_cache.cc

Issue 7466031: AsyncHostResolver: integrated HostCache, temporarily, until we have RR cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed copyright year. Created 9 years, 5 months 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 | « net/base/host_cache.h ('k') | net/base/host_resolver_impl.cc » ('j') | 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 28173d273f164c58e71de244011ea4e1a0887bb8..03eb23a01c1c97e65a3da0916041073d082eec19 100644
--- a/net/base/host_cache.cc
+++ b/net/base/host_cache.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -117,6 +117,18 @@ bool HostCache::CanUseEntry(const Entry* entry, const base::TimeTicks now) {
return entry->expiration > now;
}
+// static
+HostCache* HostCache::CreateDefaultCache() {
+ static const size_t kMaxHostCacheEntries = 100;
+
+ HostCache* cache = new HostCache(
+ kMaxHostCacheEntries,
+ base::TimeDelta::FromMinutes(1),
+ base::TimeDelta::FromSeconds(0)); // Disable caching of failed DNS.
+
+ return cache;
+}
+
void HostCache::Compact(base::TimeTicks now, const Entry* pinned_entry) {
// Clear out expired entries.
for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); ) {
« no previous file with comments | « net/base/host_cache.h ('k') | net/base/host_resolver_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698