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

Unified Diff: net/base/cookie_monster.h

Issue 2718011: Initial commit of CookieMonster statistics. (Closed)
Patch Set: Fix perf degradation, add requested comment. Created 10 years, 6 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/browser/net/sqlite_persistent_cookie_store.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
diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h
index ee869e94c0a50f164adf04046a92121619245ffe..df7f680187cbf8c513b6b5900893a53b2d17583e 100644
--- a/net/base/cookie_monster.h
+++ b/net/base/cookie_monster.h
@@ -13,6 +13,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/histogram.h"
#include "base/lock.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
@@ -69,7 +70,8 @@ class CookieMonster : public CookieStore {
store_(store),
last_access_threshold_(base::TimeDelta::FromMilliseconds(
last_access_threshold_milliseconds)),
- delegate_(delegate) {
+ delegate_(delegate),
+ last_statistic_record_time_(base::Time::Now()) {
SetDefaultCookieableSchemes();
}
#endif
@@ -230,7 +232,17 @@ class CookieMonster : public CookieStore {
void InternalUpdateCookieAccessTime(CanonicalCookie* cc);
- void InternalDeleteCookie(CookieMap::iterator it, bool sync_to_store);
+ enum DeletionCause { kDeleteCookieExplicit,
darin (slow to review) 2010/07/02 16:35:00 "Though the style guide says to use kConstantNamin
+ kDeleteCookieOverwrite,
+ kDeleteCookieExpired,
+ kDeleteCookieEvicted,
+ kDeleteCookieDuplicateInBackingStore,
+ kDeleteCookieDontRecord,
+ kDeleteCookieLastEntry = kDeleteCookieDontRecord };
+
+ // |deletion_cause| argument is for collecting statistics.
+ void InternalDeleteCookie(CookieMap::iterator it, bool sync_to_store,
+ DeletionCause deletion_cause);
// If the number of cookies for host |key|, or globally, are over preset
// maximums, garbage collects, first for the host and then globally, as
@@ -262,6 +274,14 @@ class CookieMonster : public CookieStore {
bool HasCookieableScheme(const GURL& url);
+ // Statistics support
+ // Record statistics every kRecordStatisticsIntervalSeconds of uptime.
+ static const int kRecordStatisticsIntervalSeconds = 10 * 60;
+
+ // This function should be called repeatedly, and will record
+ // statistics if a sufficient time period has passed.
+ void RecordPeriodicStats(const base::Time &current_time);
eroman 2010/06/21 18:22:43 style nit: |const base::Time& current_time|
+
CookieMap cookies_;
// Indicates whether the cookie store has been initialized. This happens
@@ -286,6 +306,8 @@ class CookieMonster : public CookieStore {
// Lock for thread-safety
Lock lock_;
+ base::Time last_statistic_record_time_;
+
DISALLOW_COPY_AND_ASSIGN(CookieMonster);
};
« no previous file with comments | « chrome/browser/net/sqlite_persistent_cookie_store.cc ('k') | net/base/cookie_monster.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698