OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_REPORTING_REPORTING_CACHE_H_ | 5 #ifndef NET_REPORTING_REPORTING_CACHE_H_ |
6 #define NET_REPORTING_REPORTING_CACHE_H_ | 6 #define NET_REPORTING_REPORTING_CACHE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
16 #include "net/reporting/reporting_client.h" | 16 #include "net/reporting/reporting_client.h" |
| 17 #include "net/reporting/reporting_report.h" |
17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
18 #include "url/origin.h" | 19 #include "url/origin.h" |
19 | 20 |
20 namespace net { | 21 namespace net { |
21 | 22 |
22 class ReportingContext; | 23 class ReportingContext; |
23 struct ReportingReport; | |
24 | 24 |
25 // The cache holds undelivered reports and clients (per-origin endpoint | 25 // The cache holds undelivered reports and clients (per-origin endpoint |
26 // configurations) in memory. (It is not responsible for persisting them.) | 26 // configurations) in memory. (It is not responsible for persisting them.) |
27 // | 27 // |
28 // This corresponds roughly to the "Reporting cache" in the spec, except that | 28 // This corresponds roughly to the "Reporting cache" in the spec, except that |
29 // endpoints and clients are stored in a more structurally-convenient way, and | 29 // endpoints and clients are stored in a more structurally-convenient way, and |
30 // endpoint failures/retry-after are tracked in ReportingEndpointManager. | 30 // endpoint failures/retry-after are tracked in ReportingEndpointManager. |
31 // | 31 // |
32 // The cache implementation has the notion of "pending" reports. These are | 32 // The cache implementation has the notion of "pending" reports. These are |
33 // reports that are part of an active delivery attempt, so they won't be | 33 // reports that are part of an active delivery attempt, so they won't be |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 virtual void ClearReportsPending( | 69 virtual void ClearReportsPending( |
70 const std::vector<const ReportingReport*>& reports) = 0; | 70 const std::vector<const ReportingReport*>& reports) = 0; |
71 | 71 |
72 // Increments |attempts| on a set of reports. | 72 // Increments |attempts| on a set of reports. |
73 virtual void IncrementReportsAttempts( | 73 virtual void IncrementReportsAttempts( |
74 const std::vector<const ReportingReport*>& reports) = 0; | 74 const std::vector<const ReportingReport*>& reports) = 0; |
75 | 75 |
76 // Removes a set of reports. Any reports that are pending will not be removed | 76 // Removes a set of reports. Any reports that are pending will not be removed |
77 // immediately, but rather marked doomed and removed once they are no longer | 77 // immediately, but rather marked doomed and removed once they are no longer |
78 // pending. | 78 // pending. |
79 virtual void RemoveReports( | 79 virtual void RemoveReports(const std::vector<const ReportingReport*>& reports, |
80 const std::vector<const ReportingReport*>& reports) = 0; | 80 ReportingReport::Outcome outcome) = 0; |
81 | 81 |
82 // Removes all reports. Like |RemoveReports()|, pending reports are doomed | 82 // Removes all reports. Like |RemoveReports()|, pending reports are doomed |
83 // until no longer pending. | 83 // until no longer pending. |
84 virtual void RemoveAllReports() = 0; | 84 virtual void RemoveAllReports(ReportingReport::Outcome outcome) = 0; |
85 | 85 |
86 // Creates or updates a client for a particular origin and a particular | 86 // Creates or updates a client for a particular origin and a particular |
87 // endpoint. | 87 // endpoint. |
88 // | 88 // |
89 // All parameters correspond to the desired values for the fields in | 89 // All parameters correspond to the desired values for the fields in |
90 // |Client|. | 90 // |Client|. |
91 // | 91 // |
92 // |endpoint| must use a cryptographic scheme. | 92 // |endpoint| must use a cryptographic scheme. |
93 virtual void SetClient(const url::Origin& origin, | 93 virtual void SetClient(const url::Origin& origin, |
94 const GURL& endpoint, | 94 const GURL& endpoint, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 virtual bool IsReportPendingForTesting( | 156 virtual bool IsReportPendingForTesting( |
157 const ReportingReport* report) const = 0; | 157 const ReportingReport* report) const = 0; |
158 | 158 |
159 virtual bool IsReportDoomedForTesting( | 159 virtual bool IsReportDoomedForTesting( |
160 const ReportingReport* report) const = 0; | 160 const ReportingReport* report) const = 0; |
161 }; | 161 }; |
162 | 162 |
163 } // namespace net | 163 } // namespace net |
164 | 164 |
165 #endif // NET_REPORTING_REPORTING_CACHE_H_ | 165 #endif // NET_REPORTING_REPORTING_CACHE_H_ |
OLD | NEW |