.. | ||
OWNERS | ||
README.md | ||
reporting_browsing_data_remover.cc | ||
reporting_browsing_data_remover.h | ||
reporting_cache.cc | ||
reporting_cache.h | ||
reporting_client.cc | ||
reporting_client.h | ||
reporting_context.cc | ||
reporting_context.h | ||
reporting_delegate.cc | ||
reporting_delegate.h | ||
reporting_delivery_agent.cc | ||
reporting_delivery_agent.h | ||
reporting_endpoint_manager.cc | ||
reporting_endpoint_manager.h | ||
reporting_feature.cc | ||
reporting_feature.h | ||
reporting_garbage_collector.cc | ||
reporting_garbage_collector.h | ||
reporting_header_parser.cc | ||
reporting_header_parser.h | ||
reporting_network_change_observer.cc | ||
reporting_network_change_observer.h | ||
reporting_observer.cc | ||
reporting_observer.h | ||
reporting_persister.cc | ||
reporting_persister.h | ||
reporting_policy.cc | ||
reporting_policy.h | ||
reporting_policy.proto | ||
reporting_report.cc | ||
reporting_report.h | ||
reporting_service.cc | ||
reporting_service.h | ||
reporting_test_util.cc | ||
reporting_test_util.h | ||
reporting_uploader.cc | ||
reporting_uploader.h |
Reporting
Reporting is a central mechanism for sending out-of-band error reports to origins from various other components (e.g. HTTP Public Key Pinning, Interventions, or Content Security Policy could potentially use it).
The parts of it that are exposed to the web platform are specified in the draft spec. This document assumes that you've read that one.
Reporting in Chromium
Reporting is implemented as part of the network stack in Chromium, such that it can be used by other parts of the network stack (e.g. HPKP) or by non-browser embedders as well as by Chromium.
Almost all of Reporting lives in //net/reporting
; there is a small
amount of code in //chrome/browser/net
to set up Reporting in
profiles and provide a persistent store for reports and endpoints
across browser restarts.
Inside //net
-
The top-level class is the
ReportingService
. This lives in theURLRequestContext
, and provides the high-level operations used by other parts of//net
and other components: queueing reports, handling configuration headers, clearing browsing data, and so on.-
Within
ReportingService
livesReportingContext
, which in turn contains the inner workings of Reporting, spread across several classes:-
The
ReportingCache
stores undelivered reports and unexpired endpoint configurations. -
The
ReportingHeaderParser
parsesReport-To:
headers and updates theCache
accordingly. -
The
ReportingDeliveryAgent
reads reports from theCache
, decides which endpoints to deliver them to, and attempts to do so. It uses a couple of helper classes:-
The
ReportingUploader
does the low-level work of delivering reports: accepts a URL and JSON from theDeliveryAgent
, creates aURLRequest
, and parses the result. -
The
ReportingEndpointManager
keeps track of which endpoints are in use, and manages exponential backoff (usingBackoffEntry
) for failing endpoints.
-
-
The
ReportingGarbageCollector
periodically examines theCache
and removes reports that have remained undelivered for too long, or that have failed delivery too many times. -
The
ReportingSerializer
reads theCache
and serializes it into abase::Value
for persistent storage (in Chromium, as a pref); it can also deserialize a serializedValue
back into theCache
. -
The
ReportingBrowsingDataRemover
examines theCache
upon request and removes browsing data (reports and endpoints) of selected types and origins.
-
-
Outside //net
-
In
*ProfileImplIOData*::InitializeInternal
, theReportingService
is created and set in theURLRequestContext
, where the net stack can use it.(There is currently no interface to Reporting besides "hop over to the IO thread and poke the
ReportingService
in your favoriteURLRequestContext
", but that should change as various components need to queue reports.) -
ChromeReportingDelegate
implementsReportingDelegate
and plumbs the persistent data interface into prefs. It lives in//chrome/browser/net
.