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

Unified Diff: chromecast/crash/linux/synchronized_minidump_manager.h

Issue 1310313004: [Chromecast] Move SynchronizedMinidumpManager ratelimit logic to child classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Clarify comment on test functions. Created 5 years, 3 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
Index: chromecast/crash/linux/synchronized_minidump_manager.h
diff --git a/chromecast/crash/linux/synchronized_minidump_manager.h b/chromecast/crash/linux/synchronized_minidump_manager.h
index f4041812d80e694531d688ce0ea6b739d2d12c34..95e0607ba882340100d1da45628e37ed78851b19 100644
--- a/chromecast/crash/linux/synchronized_minidump_manager.h
+++ b/chromecast/crash/linux/synchronized_minidump_manager.h
@@ -46,9 +46,6 @@ namespace chromecast {
//
class SynchronizedMinidumpManager {
public:
- // Max number of dumps allowed in lockfile.
- static const int kMaxLockfileDumps;
-
// Length of a ratelimit period in seconds.
static const int kRatelimitPeriodSeconds;
@@ -100,6 +97,15 @@ class SynchronizedMinidumpManager {
// clean lingering dump files.
int GetNumDumps(bool delete_all_dumps);
+ // Increment the number of dumps in the current ratelimit period.
+ // Returns 0 on success, < 0 on error.
+ int IncrementNumDumpsInCurrentPeriod();
+
+ // Returns true when dumps uploaded in current rate limit period is less than
+ // |kRatelimitPeriodMaxDumps|. Resets rate limit period if period time has
+ // elapsed.
+ bool CanUploadDump();
+
// If true, the flock on the lockfile will be nonblocking.
bool non_blocking_;
@@ -127,13 +133,6 @@ class SynchronizedMinidumpManager {
// Release the lock file with the associated *fd*.
void ReleaseLockFile();
- // Returns true if |num_dumps| can be written to the lockfile. We can write
- // the dumps if the number of dumps in the lockfile after |num_dumps| is added
- // is less than or equal to |kMaxLockfileDumps| and the number of dumps in the
- // current ratelimit period after |num_dumps| is added is less than or equal
- // to |kRatelimitPeriodMaxDumps|.
- bool CanWriteDumps(int num_dumps);
-
const std::string lockfile_path_;
const std::string metadata_path_;
int lockfile_fd_;
« no previous file with comments | « chromecast/crash/linux/minidump_writer_unittest.cc ('k') | chromecast/crash/linux/synchronized_minidump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698