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

Unified Diff: net/reporting/reporting_context.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_context.h
diff --git a/net/reporting/reporting_context.h b/net/reporting/reporting_context.h
index 02425615039dd282419b9ebebc718df6c4592111..d19675a9cf5b8605b2a1997f6bd696dab2a4b03a 100644
--- a/net/reporting/reporting_context.h
+++ b/net/reporting/reporting_context.h
@@ -25,6 +25,7 @@ class ReportingDelegate;
class ReportingDeliveryAgent;
class ReportingEndpointManager;
class ReportingObserver;
+class ReportingPersister;
class ReportingUploader;
class URLRequestContext;
@@ -39,6 +40,16 @@ class NET_EXPORT ReportingContext {
~ReportingContext();
+ // Initializes the ReportingContext. This may take a while (e.g. it may
+ // involve reloading state persisted to disk). Should be called only once.
+ //
+ // Components of the ReportingContext won't reference their dependencies (e.g.
+ // the Clock/TickClock or Timers inside the individual components) until
+ // during/after the call to Init.
+ void Initialize();
+
+ bool initialized() const { return initialized_; }
+
const ReportingPolicy& policy() { return policy_; }
ReportingDelegate* delegate() { return delegate_.get(); }
@@ -52,6 +63,8 @@ class NET_EXPORT ReportingContext {
}
ReportingDeliveryAgent* delivery_agent() { return delivery_agent_.get(); }
+ ReportingPersister* persister() { return persister_.get(); }
+
void AddObserver(ReportingObserver* observer);
void RemoveObserver(ReportingObserver* observer);
@@ -73,6 +86,7 @@ class NET_EXPORT ReportingContext {
std::unique_ptr<ReportingUploader> uploader_;
base::ObserverList<ReportingObserver, /* check_empty= */ true> observers_;
+ bool initialized_;
std::unique_ptr<ReportingCache> cache_;
@@ -83,6 +97,10 @@ class NET_EXPORT ReportingContext {
// and |endpoint_manager_|.
std::unique_ptr<ReportingDeliveryAgent> delivery_agent_;
+ // |persister_| must come after |delegate_|, |clock_|, |tick_clock_|, and
+ // |cache_|.
+ std::unique_ptr<ReportingPersister> persister_;
+
DISALLOW_COPY_AND_ASSIGN(ReportingContext);
};

Powered by Google App Engine
This is Rietveld 408576698