Index: net/reporting/reporting_context.h |
diff --git a/net/reporting/reporting_context.h b/net/reporting/reporting_context.h |
index c4360ea51e06801a30563788bd69ce958010229b..75aa11918ae6aeff76c20b59a146ca6ee1a2e10d 100644 |
--- a/net/reporting/reporting_context.h |
+++ b/net/reporting/reporting_context.h |
@@ -26,6 +26,7 @@ class ReportingDeliveryAgent; |
class ReportingEndpointManager; |
class ReportingGarbageCollector; |
class ReportingObserver; |
+class ReportingPersister; |
class ReportingUploader; |
class URLRequestContext; |
@@ -40,6 +41,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(); } |
@@ -56,6 +67,8 @@ class NET_EXPORT ReportingContext { |
return garbage_collector_.get(); |
} |
+ ReportingPersister* persister() { return persister_.get(); } |
+ |
void AddObserver(ReportingObserver* observer); |
void RemoveObserver(ReportingObserver* observer); |
@@ -77,6 +90,7 @@ class NET_EXPORT ReportingContext { |
std::unique_ptr<ReportingUploader> uploader_; |
base::ObserverList<ReportingObserver, /* check_empty= */ true> observers_; |
+ bool initialized_; |
std::unique_ptr<ReportingCache> cache_; |
@@ -87,6 +101,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_; |
+ |
// |garbage_collector_| must come after |tick_clock_| and |cache_|. |
std::unique_ptr<ReportingGarbageCollector> garbage_collector_; |