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

Unified Diff: net/reporting/reporting_endpoint_manager.h

Issue 2751103002: Reporting: Wrap existing classes in context. (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_delivery_agent_unittest.cc ('k') | net/reporting/reporting_endpoint_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/reporting/reporting_endpoint_manager.h
diff --git a/net/reporting/reporting_endpoint_manager.h b/net/reporting/reporting_endpoint_manager.h
index c550d5e80e8efa5109ce6616c7058a9a38ffb09a..e3cc8277fa776fe30d1faa7c97069c95db598caa 100644
--- a/net/reporting/reporting_endpoint_manager.h
+++ b/net/reporting/reporting_endpoint_manager.h
@@ -11,8 +11,10 @@
#include <string>
#include "base/macros.h"
+#include "base/time/tick_clock.h"
#include "net/base/backoff_entry.h"
#include "net/base/net_export.h"
+#include "net/reporting/reporting_context.h"
class GURL;
@@ -27,16 +29,15 @@ class Origin;
namespace net {
class ReportingCache;
+struct ReportingPolicy;
// Keeps track of which endpoints are pending (have active delivery attempts to
// them) or in exponential backoff after one or more failures, and chooses an
// endpoint from an endpoint group to receive reports for an origin.
class NET_EXPORT ReportingEndpointManager {
public:
- // Note: All three parameters must outlive the endpoint manager.
- ReportingEndpointManager(base::TickClock* clock,
- const ReportingCache* cache,
- const BackoffEntry::Policy* backoff_policy);
+ // |context| must outlive the ReportingEndpointManager.
+ ReportingEndpointManager(ReportingContext* context);
~ReportingEndpointManager();
// Finds an endpoint configured by |origin| in group |group| that is not
@@ -64,9 +65,11 @@ class NET_EXPORT ReportingEndpointManager {
void InformOfEndpointRequest(const GURL& endpoint, bool succeeded);
private:
- base::TickClock* clock_;
- const ReportingCache* cache_;
- const BackoffEntry::Policy* backoff_policy_;
+ const ReportingPolicy& policy() { return context_->policy(); }
+ base::TickClock* tick_clock() { return context_->tick_clock(); }
+ ReportingCache* cache() { return context_->cache(); }
+
+ ReportingContext* context_;
std::set<GURL> pending_endpoints_;
std::map<GURL, std::unique_ptr<net::BackoffEntry>> endpoint_backoff_;
« no previous file with comments | « net/reporting/reporting_delivery_agent_unittest.cc ('k') | net/reporting/reporting_endpoint_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698