| 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 <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 namespace net { | 24 namespace net { |
| 25 | 25 |
| 26 struct ReportingReport; | 26 struct ReportingReport; |
| 27 | 27 |
| 28 // The cache holds undelivered reports and clients (per-origin endpoint | 28 // The cache holds undelivered reports and clients (per-origin endpoint |
| 29 // configurations) in memory. (It is not responsible for persisting them.) | 29 // configurations) in memory. (It is not responsible for persisting them.) |
| 30 // | 30 // |
| 31 // This corresponds roughly to the "Reporting cache" in the spec, except that | 31 // This corresponds roughly to the "Reporting cache" in the spec, except that |
| 32 // endpoints and clients are stored in a more structurally-convenient way, and | 32 // endpoints and clients are stored in a more structurally-convenient way, and |
| 33 // endpoint failures/retry-after are tracked in ReportingEndpointManager. | 33 // endpoint failures/retry-after are tracked in ReportingEndpointManager. |
| 34 // |
| 35 // The cache implementation has the notion of "pending" reports. These are |
| 36 // reports that are part of an active delivery attempt, so they won't be |
| 37 // actually deallocated. Any attempt to remove a pending report wil mark it |
| 38 // "doomed", which will cause it to be deallocated once it is no longer pending. |
| 34 class NET_EXPORT ReportingCache { | 39 class NET_EXPORT ReportingCache { |
| 35 public: | 40 public: |
| 36 ReportingCache(); | 41 ReportingCache(); |
| 37 | 42 |
| 38 ~ReportingCache(); | 43 ~ReportingCache(); |
| 39 | 44 |
| 40 // Adds a report to the cache. | 45 // Adds a report to the cache. |
| 41 // | 46 // |
| 42 // All parameters correspond to the desired values for the relevant fields in | 47 // All parameters correspond to the desired values for the relevant fields in |
| 43 // ReportingReport. | 48 // ReportingReport. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // Reports that have been marked "doomed" (would have been deleted, but were | 162 // Reports that have been marked "doomed" (would have been deleted, but were |
| 158 // pending when the deletion was requested). | 163 // pending when the deletion was requested). |
| 159 std::unordered_set<const ReportingReport*> doomed_reports_; | 164 std::unordered_set<const ReportingReport*> doomed_reports_; |
| 160 | 165 |
| 161 DISALLOW_COPY_AND_ASSIGN(ReportingCache); | 166 DISALLOW_COPY_AND_ASSIGN(ReportingCache); |
| 162 }; | 167 }; |
| 163 | 168 |
| 164 } // namespace net | 169 } // namespace net |
| 165 | 170 |
| 166 #endif // NET_REPORTING_REPORTING_CACHE_H_ | 171 #endif // NET_REPORTING_REPORTING_CACHE_H_ |
| OLD | NEW |