Index: content/browser/service_worker/service_worker_metrics.cc |
diff --git a/content/browser/service_worker/service_worker_metrics.cc b/content/browser/service_worker/service_worker_metrics.cc |
index 0c1cfca0951b5642261ca5dac6621c4b368e8a3d..98d494384abb69ed02d37c48be498d951b932600 100644 |
--- a/content/browser/service_worker/service_worker_metrics.cc |
+++ b/content/browser/service_worker/service_worker_metrics.cc |
@@ -213,6 +213,12 @@ const char* ServiceWorkerMetrics::EventTypeToString(EventType event_type) { |
return "error"; |
} |
+bool ServiceWorkerMetrics::IsNavigationHintEvent(EventType event_type) { |
+ return event_type == EventType::NAVIGATION_HINT_LINK_MOUSE_DOWN || |
+ event_type == EventType::NAVIGATION_HINT_LINK_TAP_UNCONFIRMED || |
+ event_type == EventType::NAVIGATION_HINT_LINK_TAP_DOWN; |
+} |
+ |
bool ServiceWorkerMetrics::ShouldExcludeSiteFromHistogram(Site site) { |
return site == ServiceWorkerMetrics::Site::NEW_TAB_PAGE; |
} |
@@ -409,6 +415,34 @@ void ServiceWorkerMetrics::RecordEventHandledRatio(EventType event, |
} |
} |
+void ServiceWorkerMetrics::RecordNavigationHintPrecision( |
+ EventType start_worker_purpose, |
+ bool frame_fetch_event_fired) { |
+ DCHECK(IsNavigationHintEvent(start_worker_purpose)); |
+ UMA_HISTOGRAM_BOOLEAN("ServiceWorker.NavigationHintPrecision", |
+ frame_fetch_event_fired); |
+ switch (start_worker_purpose) { |
+ case EventType::NAVIGATION_HINT_LINK_MOUSE_DOWN: |
+ UMA_HISTOGRAM_BOOLEAN( |
+ "ServiceWorker.NavigationHintPrecision.LINK_MOUSE_DOWN", |
+ frame_fetch_event_fired); |
+ break; |
+ case EventType::NAVIGATION_HINT_LINK_TAP_UNCONFIRMED: |
+ UMA_HISTOGRAM_BOOLEAN( |
+ "ServiceWorker.NavigationHintPrecision.LINK_TAP_UNCONFIRMED", |
+ frame_fetch_event_fired); |
+ break; |
+ case EventType::NAVIGATION_HINT_LINK_TAP_DOWN: |
+ UMA_HISTOGRAM_BOOLEAN( |
+ "ServiceWorker.NavigationHintPrecision.LINK_TAP_DOWN", |
+ frame_fetch_event_fired); |
+ break; |
+ default: |
+ NOTREACHED(); |
+ break; |
+ } |
+} |
+ |
void ServiceWorkerMetrics::RecordEventTimeout(EventType event) { |
UMA_HISTOGRAM_ENUMERATION("ServiceWorker.RequestTimeouts.Count", |
static_cast<int>(event), |