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

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
« no previous file with comments | « net/reporting/reporting_observer.h ('k') | net/reporting/reporting_persister.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..27463a516bf7d781be38ffc15fc79def83b7e2d9
--- /dev/null
+++ b/net/reporting/reporting_persister.h
@@ -0,0 +1,40 @@
+// 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();
+
+ // Initializes the Persister, which deserializes any previously-persisted data
+ // that is available through the Context's Delegate.
+ virtual void Initialize() = 0;
+
+ // 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_
« no previous file with comments | « net/reporting/reporting_observer.h ('k') | net/reporting/reporting_persister.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698