| OLD | NEW |
| (Empty) | |
| 1 # Reporting |
| 2 |
| 3 Reporting is a central mechanism for sending out-of-band error reports |
| 4 to origins from various other components (e.g. HTTP Public Key Pinning, |
| 5 Interventions, or Content Security Policy could potentially use it). |
| 6 |
| 7 The parts of it that are exposed to the web platform are specified in |
| 8 the [draft spec](http://wicg.github.io/reporting/). This document |
| 9 assumes that you've read that one. |
| 10 |
| 11 ## Reporting in Chromium |
| 12 |
| 13 Reporting is implemented as part of the network stack in Chromium, such |
| 14 that it can be used by other parts of the network stack (e.g. HPKP) or |
| 15 by non-browser embedders as well as by Chromium. |
| 16 |
| 17 Almost all of Reporting lives in `//net/reporting`; there is a small |
| 18 amount of code in `//chrome/browser/net` to set up Reporting in |
| 19 profiles and provide a persistent store for reports and endpoints |
| 20 across browser restarts. |
| 21 |
| 22 ### Inside `//net` |
| 23 |
| 24 * The top-level class is the *`ReportingService`*. This lives in the |
| 25 `URLRequestContext`, and provides the high-level operations used by |
| 26 other parts of `//net` and other components: queueing reports, |
| 27 handling configuration headers, clearing browsing data, and so on. |
| 28 |
| 29 * Within `ReportingService` lives *`ReportingContext`*, which in turn |
| 30 contains the inner workings of Reporting, spread across several |
| 31 classes: |
| 32 |
| 33 * The *`ReportingCache`* stores undelivered reports and unexpired |
| 34 endpoint configurations. |
| 35 |
| 36 * The *`ReportingHeaderParser`* parses `Report-To:` headers and |
| 37 updates the `Cache` accordingly. |
| 38 |
| 39 * The *`ReportingDeliveryAgent`* reads reports from the `Cache`, |
| 40 decides which endpoints to deliver them to, and attempts to |
| 41 do so. It uses a couple of helper classes: |
| 42 |
| 43 * The *`ReportingUploader`* does the low-level work of delivering |
| 44 reports: accepts a URL and JSON from the `DeliveryAgent`, |
| 45 creates a `URLRequest`, and parses the result. |
| 46 |
| 47 * The *`ReportingEndpointManager`* keeps track of which endpoints |
| 48 are in use, and manages exponential backoff (using |
| 49 `BackoffEntry`) for failing endpoints. |
| 50 |
| 51 * The *`ReportingGarbageCollector`* periodically examines the |
| 52 `Cache` and removes reports that have remained undelivered for too |
| 53 long, or that have failed delivery too many times. |
| 54 |
| 55 * The *`ReportingSerializer`* reads the `Cache` and serializes it |
| 56 into a `base::Value` for persistent storage (in Chromium, as a |
| 57 pref); it can also deserialize a serialized `Value` back into the |
| 58 `Cache`. |
| 59 |
| 60 * The *`ReportingBrowsingDataRemover`* examines the `Cache` upon |
| 61 request and removes browsing data (reports and endpoints) of |
| 62 selected types and origins. |
| 63 |
| 64 ### Outside `//net` |
| 65 |
| 66 * In `*ProfileImplIOData*::InitializeInternal`, the `ReportingService` |
| 67 is created and set in the `URLRequestContext`, where the net stack |
| 68 can use it. |
| 69 |
| 70 (There is currently no interface to Reporting besides "hop over to |
| 71 the IO thread and poke the `ReportingService` in your favorite |
| 72 `URLRequestContext`", but that should change as various components |
| 73 need to queue reports.) |
| 74 |
| 75 * *`ChromeReportingDelegate`* implements `ReportingDelegate` and plumbs |
| 76 the persistent data interface into prefs. It lives in |
| 77 `//chrome/browser/net`. |
| OLD | NEW |