Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(779)

Unified Diff: content/browser/service_worker/service_worker_metrics.cc

Issue 2045153003: Speculatively launch Service Workers on mouse/touch events. [4/5] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated nhiroki's comment Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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),
« no previous file with comments | « content/browser/service_worker/service_worker_metrics.h ('k') | content/browser/service_worker/service_worker_version.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698