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); |
}; |