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

Unified Diff: net/base/cookie_monster.h

Issue 99100: Update cookie expiry policy to attempt to avoid deleting "in-use" cookies. S... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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 | « chrome/common/net/cookie_monster_sqlite.cc ('k') | net/base/cookie_monster.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/cookie_monster.h
===================================================================
--- net/base/cookie_monster.h (revision 23545)
+++ net/base/cookie_monster.h (working copy)
@@ -185,16 +185,16 @@
// Returns the number of cookies deleted (useful for debugging).
int GarbageCollect(const base::Time& current, const std::string& key);
- // Deletes all expired cookies in |itpair|;
- // then, if the number of remaining cookies is greater than |num_max|,
- // collects the least recently accessed cookies until
- // (|num_max| - |num_purge|) cookies remain.
+ // Deletes all expired cookies in |itpair|; then, if the number of remaining
+ // cookies is greater than |max_cookies|, collects the least recently accessed
+ // cookies until that many cookies remain. If |purge_age| is non-zero, only
+ // cookies accessed longer ago than |purge_age| are collected.
//
// Returns the number of cookies deleted.
int GarbageCollectRange(const base::Time& current,
const CookieMapItPair& itpair,
- size_t num_max,
- size_t num_purge);
+ size_t max_cookies,
+ const base::TimeDelta& purge_age);
// Helper for GarbageCollectRange(); can be called directly as well. Deletes
// all expired cookies in |itpair|. If |cookie_its| is non-NULL, it is
@@ -209,6 +209,9 @@
CookieMap cookies_;
+ // The last-accessed time of the oldest (LRU) cookie in the DB.
+ base::Time least_recent_access_;
+
// Indicates whether the cookie store has been initialized. This happens
// lazily in InitStoreIfNecessary().
bool initialized_;
@@ -373,7 +376,9 @@
// Initializes the store and retrieves the existing cookies. This will be
// called only once at startup.
- virtual bool Load(std::vector<CookieMonster::KeyedCanonicalCookie>*) = 0;
+ // The second argument will be set to the oldest last-accessed date seen.
+ virtual bool Load(std::vector<CookieMonster::KeyedCanonicalCookie>*,
+ base::Time*) = 0;
virtual void AddCookie(const std::string&, const CanonicalCookie&) = 0;
virtual void UpdateCookieAccessTime(const CanonicalCookie&) = 0;
« no previous file with comments | « chrome/common/net/cookie_monster_sqlite.cc ('k') | net/base/cookie_monster.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698