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

Unified Diff: net/reporting/reporting_context.cc

Issue 2740833004: Reporting: Implement garbage collector. (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
Index: net/reporting/reporting_context.cc
diff --git a/net/reporting/reporting_context.cc b/net/reporting/reporting_context.cc
index 1252cd833ca78772732816cc635f9bdf4cff552c..c128497ac0080e0ee3b6d93aa7800c041add5866 100644
--- a/net/reporting/reporting_context.cc
+++ b/net/reporting/reporting_context.cc
@@ -13,11 +13,13 @@
#include "base/time/default_tick_clock.h"
#include "base/time/tick_clock.h"
#include "base/time/time.h"
+#include "base/timer/timer.h"
#include "net/base/backoff_entry.h"
#include "net/reporting/reporting_cache.h"
#include "net/reporting/reporting_delegate.h"
#include "net/reporting/reporting_delivery_agent.h"
#include "net/reporting/reporting_endpoint_manager.h"
+#include "net/reporting/reporting_garbage_collector.h"
#include "net/reporting/reporting_observer.h"
#include "net/reporting/reporting_policy.h"
@@ -35,6 +37,7 @@ class ReportingContextImpl : public ReportingContext {
: ReportingContext(policy) {
Init(std::move(delegate), base::MakeUnique<base::DefaultClock>(),
base::MakeUnique<base::DefaultTickClock>(),
+ base::MakeUnique<base::OneShotTimer>(),
ReportingUploader::Create(request_context));
}
};
@@ -71,15 +74,19 @@ ReportingContext::ReportingContext(const ReportingPolicy& policy)
: policy_(policy),
cache_(base::MakeUnique<ReportingCache>(this)),
endpoint_manager_(base::MakeUnique<ReportingEndpointManager>(this)),
- delivery_agent_(base::MakeUnique<ReportingDeliveryAgent>(this)) {}
+ delivery_agent_(base::MakeUnique<ReportingDeliveryAgent>(this)),
+ garbage_collector_(ReportingGarbageCollector::Create(this)) {}
-void ReportingContext::Init(std::unique_ptr<ReportingDelegate> delegate,
- std::unique_ptr<base::Clock> clock,
- std::unique_ptr<base::TickClock> tick_clock,
- std::unique_ptr<ReportingUploader> uploader) {
+void ReportingContext::Init(
+ std::unique_ptr<ReportingDelegate> delegate,
+ std::unique_ptr<base::Clock> clock,
+ std::unique_ptr<base::TickClock> tick_clock,
+ std::unique_ptr<base::Timer> garbage_collection_timer,
+ std::unique_ptr<ReportingUploader> uploader) {
delegate_ = std::move(delegate);
clock_ = std::move(clock);
tick_clock_ = std::move(tick_clock);
+ garbage_collection_timer_ = std::move(garbage_collection_timer);
uploader_ = std::move(uploader);
}

Powered by Google App Engine
This is Rietveld 408576698