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

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

Issue 2000063005: [WIP] Speculatively launch Service Workers on mouse/touch events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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.h
diff --git a/content/browser/service_worker/service_worker_metrics.h b/content/browser/service_worker/service_worker_metrics.h
index aca36c9e351e3bebeceacdef260a0b22e1c7df25..b8b4db4837f3bf2927ea314a271b463b59c2ba16 100644
--- a/content/browser/service_worker/service_worker_metrics.h
+++ b/content/browser/service_worker/service_worker_metrics.h
@@ -95,6 +95,9 @@ class ServiceWorkerMetrics {
FETCH_SUB_RESOURCE = 13,
UNKNOWN = 14, // Used when event type is not known.
FOREIGN_FETCH = 15,
+ NAVIGATION_HINT_LINK_MOUSE_DOWN = 16,
+ NAVIGATION_HINT_LINK_TAP_UNCONFIRMED = 17,
+ NAVIGATION_HINT_LINK_TAP_DOWN = 18,
// Add new events to record here.
NUM_TYPES
};
@@ -122,6 +125,9 @@ class ServiceWorkerMetrics {
// Converts an event type to a string. Used for tracing.
static const char* EventTypeToString(EventType event_type);
+ // Returns true when the event is for a navigation hint.
+ static bool IsNavigationHintEvent(EventType event_type);
+
// Excludes NTP scope from UMA for now as it tends to dominate the stats and
// makes the results largely skewed. Some metrics don't follow this policy
// and hence don't call this function.
@@ -177,6 +183,13 @@ class ServiceWorkerMetrics {
size_t handled_events,
size_t fired_events);
+ // Records the precision of the speculative launch of Service Workers for
+ // each navigation hint type when the worker is stopped. If there was no
+ // event fetched to the worker, |event_fired| is false. This means that the
+ // speculative launch was meaningless.
+ static void RecordNavigationHintPrecision(EventType start_worker_purpose,
+ bool event_fired);
+
// Records how often a dispatched event times out.
static void RecordEventTimeout(EventType event);

Powered by Google App Engine
This is Rietveld 408576698