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

Unified Diff: net/base/host_cache.cc

Issue 464084: Cache failed DNS resolutions for 1 second.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Merge changes (to include API change in another file) Created 11 years 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_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_cache.cc
===================================================================
--- net/base/host_cache.cc (revision 34231)
+++ net/base/host_cache.cc (working copy)
@@ -22,8 +22,12 @@
//-----------------------------------------------------------------------------
-HostCache::HostCache(size_t max_entries, size_t cache_duration_ms)
- : max_entries_(max_entries), cache_duration_ms_(cache_duration_ms) {
+HostCache::HostCache(size_t max_entries,
+ base::TimeDelta success_entry_ttl,
+ base::TimeDelta failure_entry_ttl)
+ : max_entries_(max_entries),
+ success_entry_ttl_(success_entry_ttl),
+ failure_entry_ttl_(failure_entry_ttl) {
}
HostCache::~HostCache() {
@@ -53,7 +57,7 @@
return NULL;
base::TimeTicks expiration = now +
- base::TimeDelta::FromMilliseconds(cache_duration_ms_);
+ (error == OK ? success_entry_ttl_ : failure_entry_ttl_);
scoped_refptr<Entry>& entry = entries_[key];
if (!entry) {
@@ -77,7 +81,7 @@
// static
bool HostCache::CanUseEntry(const Entry* entry, const base::TimeTicks now) {
- return entry->error == OK && entry->expiration > now;
+ return entry->expiration > now;
}
void HostCache::Compact(base::TimeTicks now, const Entry* pinned_entry) {
« no previous file with comments | « net/base/host_cache.h ('k') | net/base/host_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698