Index: net/http/http_auth_cache.cc |
diff --git a/net/http/http_auth_cache.cc b/net/http/http_auth_cache.cc |
index 7a3a4e0f6714cb9b927af8d6c17fad4d0e8c12ae..0ff5e47cd4dc23ecb8fa6118d24d9ed065aef9c9 100644 |
--- a/net/http/http_auth_cache.cc |
+++ b/net/http/http_auth_cache.cc |
@@ -252,8 +252,24 @@ bool HttpAuthCache::Remove(const GURL& origin, |
return false; |
} |
-void HttpAuthCache::Clear() { |
- entries_.clear(); |
+void HttpAuthCache::Clear(base::Time delete_begin, base::Time delete_end) { |
+ int64_t begin_millis = |
+ delete_begin.is_null() |
+ ? 0 |
+ : (delete_begin - base::Time::UnixEpoch()).InMilliseconds(); |
+ int64_t end_millis = |
+ delete_end.is_null() |
+ ? std::numeric_limits<int64_t>::max() |
+ : (delete_end - base::Time::UnixEpoch()).InMilliseconds(); |
+ |
+ base::TimeTicks unix_epoch = base::TimeTicks::UnixEpoch(); |
+ |
+ entries_.remove_if( |
+ [begin_millis, end_millis, unix_epoch](const Entry& entry) { |
+ int64_t creation_millis = |
+ (entry.creation_time_ - unix_epoch).InMilliseconds(); |
+ return creation_millis >= begin_millis && creation_millis < end_millis; |
+ }); |
} |
bool HttpAuthCache::UpdateStaleChallenge(const GURL& origin, |