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

Unified Diff: net/base/cookie_monster.cc

Issue 39249: No upper cookie limit. Only per host enforced. Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 11 years, 10 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/cookie_monster.cc
===================================================================
--- net/base/cookie_monster.cc (revision 11100)
+++ net/base/cookie_monster.cc (working copy)
@@ -75,8 +75,6 @@
// going through the garbage collection process less often.
static const size_t kNumCookiesPerHost = 70; // ~50 cookies
static const size_t kNumCookiesPerHostPurge = 20;
-static const size_t kNumCookiesTotal = 1100; // ~1000 cookies
-static const size_t kNumCookiesTotalPurge = 100;
// Default minimum delay after updating a cookie's LastAccessDate before we
// will update it again.
@@ -105,6 +103,9 @@
}
CookieMonster::~CookieMonster() {
+ GarbageCollectExpired(Time::Now(),
+ CookieMapItPair(cookies_.begin(), cookies_.end()),
+ NULL);
DeleteAll(false);
}
@@ -115,14 +116,14 @@
// care if it's expired, insert it so it can be garbage collected, removed,
// and sync'd.
std::vector<KeyedCanonicalCookie> cookies;
- // Reserve space for the maximum amount of cookies a database should have.
- // This prevents multiple vector growth / copies as we append cookies.
- cookies.reserve(kNumCookiesTotal);
store_->Load(&cookies);
for (std::vector<KeyedCanonicalCookie>::const_iterator it = cookies.begin();
it != cookies.end(); ++it) {
InternalInsertCookie(it->first, it->second, false);
}
+ GarbageCollectExpired(Time::Now(),
+ CookieMapItPair(cookies_.begin(), cookies_.end()),
+ NULL);
}
// The system resolution is not high enough, so we can have multiple
@@ -572,14 +573,6 @@
kNumCookiesPerHost, kNumCookiesPerHostPurge);
}
- // Collect garbage for everything.
- if (cookies_.size() > kNumCookiesTotal) {
- COOKIE_DLOG(INFO) << "GarbageCollect() everything";
- num_deleted += GarbageCollectRange(current,
- CookieMapItPair(cookies_.begin(), cookies_.end()), kNumCookiesTotal,
- kNumCookiesTotalPurge);
- }
-
return num_deleted;
}
« no previous file with comments | « chrome/common/net/cookie_monster_sqlite.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698