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

Unified Diff: net/reporting/reporting_context.cc

Issue 2785293003: Reporting: Make DeliveryAgent self-scheduling. (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 | « no previous file | net/reporting/reporting_delivery_agent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/reporting/reporting_context.cc
diff --git a/net/reporting/reporting_context.cc b/net/reporting/reporting_context.cc
index 1dd255bcb1b8759b97bfc6a9be75fc2ebcd1d3ce..5a976b34461db0eba5e4047a61e3614418c5dcc5 100644
--- a/net/reporting/reporting_context.cc
+++ b/net/reporting/reporting_context.cc
@@ -13,7 +13,6 @@
#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"
@@ -23,6 +22,7 @@
#include "net/reporting/reporting_observer.h"
#include "net/reporting/reporting_persister.h"
#include "net/reporting/reporting_policy.h"
+#include "net/reporting/reporting_uploader.h"
namespace net {
@@ -58,8 +58,14 @@ ReportingContext::~ReportingContext() {}
void ReportingContext::Initialize() {
DCHECK(!initialized_);
+ // This order isn't *critical*, but things will work better with it in this
+ // order: with the DeliveryAgent after the Persister, it can schedule delivery
+ // of persisted reports instead of waiting for a new one to be generated, and
+ // with the GarbageCollector in between, it won't bother scheduling delivery
+ // of reports that should be discarded instead.
persister_->Initialize();
garbage_collector_->Initialize();
+ delivery_agent_->Initialize();
initialized_ = true;
}
@@ -95,7 +101,7 @@ ReportingContext::ReportingContext(const ReportingPolicy& policy,
initialized_(false),
cache_(base::MakeUnique<ReportingCache>(this)),
endpoint_manager_(base::MakeUnique<ReportingEndpointManager>(this)),
- delivery_agent_(base::MakeUnique<ReportingDeliveryAgent>(this)),
+ delivery_agent_(ReportingDeliveryAgent::Create(this)),
persister_(ReportingPersister::Create(this)),
garbage_collector_(ReportingGarbageCollector::Create(this)) {}
« no previous file with comments | « no previous file | net/reporting/reporting_delivery_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698