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

Unified Diff: net/reporting/reporting_garbage_collector.cc

Issue 2900553004: Reporting: Add histograms. (Closed)
Patch Set: rebase Created 3 years, 5 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_header_parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/reporting/reporting_garbage_collector.cc
diff --git a/net/reporting/reporting_garbage_collector.cc b/net/reporting/reporting_garbage_collector.cc
index 50e6d562057c507d7491b37361b9fdbacbe71548..188cda1e46c1569f8f9f54d7e542c4947bb131fc 100644
--- a/net/reporting/reporting_garbage_collector.cc
+++ b/net/reporting/reporting_garbage_collector.cc
@@ -57,17 +57,21 @@ class ReportingGarbageCollectorImpl : public ReportingGarbageCollector,
std::vector<const ReportingReport*> all_reports;
context_->cache()->GetReports(&all_reports);
- std::vector<const ReportingReport*> reports_to_remove;
+ std::vector<const ReportingReport*> failed_reports;
+ std::vector<const ReportingReport*> expired_reports;
for (const ReportingReport* report : all_reports) {
- if (now - report->queued >= policy.max_report_age ||
- report->attempts >= policy.max_report_attempts) {
- reports_to_remove.push_back(report);
- }
+ if (report->attempts >= policy.max_report_attempts)
+ failed_reports.push_back(report);
+ else if (now - report->queued >= policy.max_report_age)
+ expired_reports.push_back(report);
}
// Don't restart the timer on the garbage collector's own updates.
context_->RemoveObserver(this);
- context_->cache()->RemoveReports(reports_to_remove);
+ context_->cache()->RemoveReports(failed_reports,
+ ReportingReport::Outcome::ERASED_FAILED);
+ context_->cache()->RemoveReports(expired_reports,
+ ReportingReport::Outcome::ERASED_EXPIRED);
context_->AddObserver(this);
}
« no previous file with comments | « net/reporting/reporting_delivery_agent_unittest.cc ('k') | net/reporting/reporting_header_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698