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

Unified Diff: net/reporting/reporting_delivery_agent.h

Issue 2751103002: Reporting: Wrap existing classes in context. (Closed)
Patch Set: Move before BrowsingDataRemover, GarbageCollector, and Serializer CLs. Created 3 years, 9 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_delivery_agent.h
diff --git a/net/reporting/reporting_delivery_agent.h b/net/reporting/reporting_delivery_agent.h
index 5fdddb395f67526b04939f7b7811c31a09f715d9..2d627d03ecf8e9fdc06701bb4c9daacac1e45f33 100644
--- a/net/reporting/reporting_delivery_agent.h
+++ b/net/reporting/reporting_delivery_agent.h
@@ -14,7 +14,7 @@
#include "base/memory/weak_ptr.h"
#include "net/base/backoff_entry.h"
#include "net/base/net_export.h"
-#include "net/reporting/reporting_endpoint_manager.h"
+#include "net/reporting/reporting_context.h"
#include "net/reporting/reporting_uploader.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -26,6 +26,7 @@ class TickClock;
namespace net {
class ReportingCache;
+class ReportingEndpointManager;
// Takes reports from the ReportingCache, assembles reports into deliveries to
// endpoints, and sends those deliveries using ReportingUploader.
@@ -56,12 +57,8 @@ class ReportingCache;
// (Note that a single delivery can contain an infinite number of reports.)
class NET_EXPORT ReportingDeliveryAgent {
public:
- // |clock|, |cache|, |uploader|, and |endpoint_backoff_policy| must all
- // outlive the ReportingDeliveryAgent.
- ReportingDeliveryAgent(base::TickClock* clock,
- ReportingCache* cache,
- ReportingUploader* uploader,
- const BackoffEntry::Policy* endpoint_backoff_policy);
+ // |context| must outlive the ReportingDeliveryAgent.
+ ReportingDeliveryAgent(ReportingContext* context);
~ReportingDeliveryAgent();
// Tries to deliver all of the reports in the cache. Reports that are already
@@ -77,11 +74,14 @@ class NET_EXPORT ReportingDeliveryAgent {
void OnUploadComplete(const std::unique_ptr<Delivery>& delivery,
ReportingUploader::Outcome outcome);
- base::TickClock* clock_;
- ReportingCache* cache_;
- ReportingUploader* uploader_;
+ base::TickClock* tick_clock() { return context_->tick_clock(); }
+ ReportingCache* cache() { return context_->cache(); }
+ ReportingUploader* uploader() { return context_->uploader(); }
+ ReportingEndpointManager* endpoint_manager() {
+ return context_->endpoint_manager();
+ }
- ReportingEndpointManager endpoint_manager_;
+ ReportingContext* context_;
// Tracks OriginGroup tuples for which there is a pending delivery running.
// (Would be an unordered_set, but there's no hash on pair.)

Powered by Google App Engine
This is Rietveld 408576698