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

Unified Diff: net/base/cookie_monster.cc

Issue 40157: Increase cookie limit & Re-work expire garbage collection. 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 10971)
+++ net/base/cookie_monster.cc (working copy)
@@ -75,8 +75,8 @@
// 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;
+static const size_t kNumCookiesTotal = 50500; // ~50000 cookies
+static const size_t kNumCookiesTotalPurge = 500;
// Default minimum delay after updating a cookie's LastAccessDate before we
// will update it again.
@@ -105,6 +105,9 @@
}
CookieMonster::~CookieMonster() {
+ GarbageCollectExpired(Time::Now(),
+ CookieMapItPair(cookies_.begin(), cookies_.end()),
+ NULL);
DeleteAll(false);
}
@@ -115,14 +118,15 @@
// 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
« 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