| Index: chrome/browser/safe_browsing/certificate_reporting_service.cc
|
| diff --git a/chrome/browser/safe_browsing/certificate_reporting_service.cc b/chrome/browser/safe_browsing/certificate_reporting_service.cc
|
| index f75d1cebd9b51f2e8990da6abae80659abec581b..395cc92290319a4dff18b1aec2b2508bce31c96f 100644
|
| --- a/chrome/browser/safe_browsing/certificate_reporting_service.cc
|
| +++ b/chrome/browser/safe_browsing/certificate_reporting_service.cc
|
| @@ -37,6 +37,12 @@ void RecordUMAOnFailure(int net_error) {
|
| UMA_HISTOGRAM_SPARSE_SLOWLY("SSL.CertificateErrorReportFailure", -net_error);
|
| }
|
|
|
| +void RecordUMAEvent(CertificateReportingService::UMAEvent event) {
|
| + UMA_HISTOGRAM_ENUMERATION(CertificateReportingService::kReportEventHistogram,
|
| + event,
|
| + CertificateReportingService::REPORT_EVENT_COUNT);
|
| +}
|
| +
|
| void CleanupOnIOThread(
|
| std::unique_ptr<CertificateReportingService::Reporter> reporter) {
|
| reporter.reset();
|
| @@ -44,6 +50,9 @@ void CleanupOnIOThread(
|
|
|
| } // namespace
|
|
|
| +const char CertificateReportingService::kReportEventHistogram[] =
|
| + "SSL.CertificateErrorReportEvent";
|
| +
|
| CertificateReportingService::BoundedReportList::BoundedReportList(
|
| size_t max_size)
|
| : max_size_(max_size) {
|
| @@ -61,10 +70,12 @@ void CertificateReportingService::BoundedReportList::Add(const Report& item) {
|
| const Report& last = items_.back();
|
| if (item.creation_time <= last.creation_time) {
|
| // Report older than the oldest item in the queue, ignore.
|
| + RecordUMAEvent(REPORT_DROPPED_OR_IGNORED);
|
| return;
|
| }
|
| // Reached the maximum item count, remove the oldest item.
|
| items_.pop_back();
|
| + RecordUMAEvent(REPORT_DROPPED_OR_IGNORED);
|
| }
|
| items_.push_back(item);
|
| std::sort(items_.begin(), items_.end(), ReportCompareFunc);
|
| @@ -114,6 +125,7 @@ void CertificateReportingService::Reporter::SendPending() {
|
| for (Report& report : items) {
|
| if (report.creation_time < now - report_ttl_) {
|
| // Report too old, ignore.
|
| + RecordUMAEvent(REPORT_DROPPED_OR_IGNORED);
|
| continue;
|
| }
|
| if (!report.is_retried) {
|
| @@ -144,6 +156,7 @@ void CertificateReportingService::Reporter::SendInternal(
|
| const CertificateReportingService::Report& report) {
|
| DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| inflight_reports_.insert(std::make_pair(report.report_id, report));
|
| + RecordUMAEvent(REPORT_SUBMITTED);
|
| error_reporter_->SendExtendedReportingReport(
|
| report.serialized_report,
|
| base::Bind(&CertificateReportingService::Reporter::SuccessCallback,
|
| @@ -159,6 +172,7 @@ void CertificateReportingService::Reporter::ErrorCallback(
|
| int http_response_code) {
|
| DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| RecordUMAOnFailure(net_error);
|
| + RecordUMAEvent(REPORT_FAILED);
|
| if (retries_enabled_) {
|
| auto it = inflight_reports_.find(report_id);
|
| DCHECK(it != inflight_reports_.end());
|
| @@ -169,6 +183,7 @@ void CertificateReportingService::Reporter::ErrorCallback(
|
|
|
| void CertificateReportingService::Reporter::SuccessCallback(int report_id) {
|
| DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| + RecordUMAEvent(REPORT_SUCCESSFUL);
|
| CHECK_GT(inflight_reports_.erase(report_id), 0u);
|
| }
|
|
|
|
|