Reporting: Prevent report deleting while checking permissions
We now mark the reports as pending before checking whether we're allowed
to deliver them to the report collectors. Since the permission check
might happen on a different thread, we need to ensure that the garbage
collector doesn't delete the reports on us while we're performing the
permissions check.
Bug: 818273, 818582
Change-Id: Iba92a58468f439589b56f1b2169c289e3473c71c
Reviewed-on: https://chromium-review.googlesource.com/948983
Reviewed-by: Julia Tuttle <[email protected]>
Commit-Queue: Douglas Creager <[email protected]>
Cr-Commit-Position: refs/heads/master@{#540960}
diff --git a/net/reporting/reporting_cache.h b/net/reporting/reporting_cache.h
index f6bca08..e948748 100644
--- a/net/reporting/reporting_cache.h
+++ b/net/reporting/reporting_cache.h
@@ -59,6 +59,14 @@
virtual void GetReports(
std::vector<const ReportingReport*>* reports_out) const = 0;
+ // Gets all reports in the cache that aren't pending. The returned pointers
+ // are valid as long as either no calls to |RemoveReports| have happened or
+ // the reports' |pending| flag has been set to true using |SetReportsPending|.
+ //
+ // (Clears any existing data in |*reports_out|.)
+ virtual void GetNonpendingReports(
+ std::vector<const ReportingReport*>* reports_out) const = 0;
+
// Marks a set of reports as pending. |reports| must not already be marked as
// pending.
virtual void SetReportsPending(