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

Unified Diff: net/reporting/reporting_persister.h

Issue 2751883003: Reporting: Implement serializer. (Closed)
Patch Set: rebase Created 3 years, 8 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: net/reporting/reporting_persister.h
diff --git a/net/reporting/reporting_persister.h b/net/reporting/reporting_persister.h
new file mode 100644
index 0000000000000000000000000000000000000000..6b37a11edc5411418da673f2f74c7f03574d6389
--- /dev/null
+++ b/net/reporting/reporting_persister.h
@@ -0,0 +1,36 @@
+// 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_PERSISTER_H_
+#define NET_REPORTING_REPORTING_PERSISTER_H_
+
+#include <memory>
+
+#include "net/base/net_export.h"
+
+namespace base {
+class Timer;
+} // namespace base
+
+namespace net {
+
+class ReportingContext;
+
+// Periodically persists the state of the Reporting system to (reasonably)
+// stable storage using the methods provided by the ReportingDelegate.
+class NET_EXPORT ReportingPersister {
+ public:
+ // Creates a ReportingPersister. |context| must outlive the persister.
+ static std::unique_ptr<ReportingPersister> Create(ReportingContext* context);
+
+ virtual ~ReportingPersister();
+
+ // Replaces the internal Timer used for scheduling writes to stable storage
+ // with a caller-specified one so that unittests can provide a MockTimer.
+ virtual void SetTimerForTesting(std::unique_ptr<base::Timer> timer) = 0;
+};
+
+} // namespace net
+
+#endif // NET_REPORTING_REPORTING_PERSISTER_H_

Powered by Google App Engine
This is Rietveld 408576698