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); |
} |