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

Unified Diff: net/reporting/reporting_endpoint_manager.cc

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_endpoint_manager.h ('k') | net/reporting/reporting_endpoint_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/reporting/reporting_endpoint_manager.cc
diff --git a/net/reporting/reporting_endpoint_manager.cc b/net/reporting/reporting_endpoint_manager.cc
index 6333a9afb7de3d50a9864e0f6e290f80c69e58a9..3d533dafbdf0f488e86e5f04e885c076d1ae680f 100644
--- a/net/reporting/reporting_endpoint_manager.cc
+++ b/net/reporting/reporting_endpoint_manager.cc
@@ -15,16 +15,14 @@
#include "net/base/backoff_entry.h"
#include "net/reporting/reporting_cache.h"
#include "net/reporting/reporting_client.h"
+#include "net/reporting/reporting_policy.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace net {
-ReportingEndpointManager::ReportingEndpointManager(
- base::TickClock* clock,
- const ReportingCache* cache,
- const BackoffEntry::Policy* backoff_policy)
- : clock_(clock), cache_(cache), backoff_policy_(backoff_policy) {}
+ReportingEndpointManager::ReportingEndpointManager(ReportingContext* context)
+ : context_(context) {}
ReportingEndpointManager::~ReportingEndpointManager() {}
@@ -33,11 +31,11 @@ bool ReportingEndpointManager::FindEndpointForOriginAndGroup(
const std::string& group,
GURL* endpoint_url_out) {
std::vector<const ReportingClient*> clients;
- cache_->GetClientsForOriginAndGroup(origin, group, &clients);
+ cache()->GetClientsForOriginAndGroup(origin, group, &clients);
// Filter out expired, pending, and backed-off endpoints.
std::vector<const ReportingClient*> available_clients;
- base::TimeTicks now = clock_->NowTicks();
+ base::TimeTicks now = tick_clock()->NowTicks();
for (const ReportingClient* client : clients) {
if (client->expires < now)
continue;
@@ -73,8 +71,8 @@ void ReportingEndpointManager::ClearEndpointPending(const GURL& endpoint) {
void ReportingEndpointManager::InformOfEndpointRequest(const GURL& endpoint,
bool succeeded) {
if (!base::ContainsKey(endpoint_backoff_, endpoint)) {
- endpoint_backoff_[endpoint] =
- base::MakeUnique<BackoffEntry>(backoff_policy_, clock_);
+ endpoint_backoff_[endpoint] = base::MakeUnique<BackoffEntry>(
+ &policy().endpoint_backoff_policy, tick_clock());
}
endpoint_backoff_[endpoint]->InformOfRequest(succeeded);
}
« no previous file with comments | « net/reporting/reporting_endpoint_manager.h ('k') | net/reporting/reporting_endpoint_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698