Index: net/reporting/reporting_garbage_collector.h |
diff --git a/net/reporting/reporting_garbage_collector.h b/net/reporting/reporting_garbage_collector.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..47d2a63f6084888f9b18130659b68874ed0bca72 |
--- /dev/null |
+++ b/net/reporting/reporting_garbage_collector.h |
@@ -0,0 +1,44 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef NET_REPORTING_REPORTING_GARBAGE_COLLECTOR_H_ |
+#define NET_REPORTING_REPORTING_GARBAGE_COLLECTOR_H_ |
+ |
+#include "base/macros.h" |
+#include "base/time/time.h" |
+#include "net/base/net_export.h" |
+ |
+namespace net { |
+ |
+class ReportingCache; |
+ |
+// Removes reports that have remained undelivered for too long or that have been |
+// included in too many failed delivery attempts. Also, removes reports on |
+// network changes, if so configured. |
+class NET_EXPORT ReportingGarbageCollector { |
+ public: |
+ struct Policy { |
+ // How long a report can remain undelivered before being GCed. |
+ base::TimeDelta report_max_age; |
+ |
+ // How many times delivery of a report can fail before the report will be |
+ // GCed. |
+ int report_max_attempts; |
+ |
+ // Whether reports are allowed to persist across network changes. |
+ bool report_persist_across_network_changes; |
+ }; |
+ |
+ static void CollectGarbage(ReportingCache* cache, |
+ const Policy& policy, |
+ base::TimeTicks now, |
+ bool network_changed); |
+ |
+ private: |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ReportingGarbageCollector); |
+}; |
+ |
+} // namespace net |
+ |
+#endif // NET_REPORTING_REPORTING_GARBAGE_COLLECTOR_H_ |