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

Side by Side Diff: content/browser/service_worker/service_worker_metrics.h

Issue 1795863006: service worker: Attribute purpose to start worker attempts for UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch for landing? Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 DETACH_BY_REGISTRY, 69 DETACH_BY_REGISTRY,
70 TIMEOUT, 70 TIMEOUT,
71 // Add new types here. 71 // Add new types here.
72 NUM_TYPES 72 NUM_TYPES
73 }; 73 };
74 74
75 // Used for UMA. Append-only. 75 // Used for UMA. Append-only.
76 enum class EventType { 76 enum class EventType {
77 ACTIVATE, 77 ACTIVATE,
78 INSTALL, 78 INSTALL,
79 FETCH, 79 FETCH, // Deprecated, use a more specific FETCH_ type.
80 SYNC, 80 SYNC,
81 NOTIFICATION_CLICK, 81 NOTIFICATION_CLICK,
82 PUSH, 82 PUSH,
83 GEOFENCING, 83 GEOFENCING,
84 SERVICE_PORT_CONNECT, 84 SERVICE_PORT_CONNECT,
85 MESSAGE, 85 MESSAGE,
86 NOTIFICATION_CLOSE, 86 NOTIFICATION_CLOSE,
87 FETCH_MAIN_FRAME,
88 FETCH_SUB_FRAME,
89 FETCH_SHARED_WORKER,
90 FETCH_SUB_RESOURCE,
91 UNKNOWN, // Used when event type is not known.
87 // Add new events to record here. 92 // Add new events to record here.
88
89 NUM_TYPES 93 NUM_TYPES
90 }; 94 };
91 95
92 // Used for UMA. Append only. 96 // Used for UMA. Append only.
93 enum class Site { OTHER, NEW_TAB_PAGE, NUM_TYPES }; 97 enum class Site { OTHER, NEW_TAB_PAGE, NUM_TYPES };
94 98
95 // Converts an event type to a string. Used for tracing. 99 // Converts an event type to a string. Used for tracing.
96 static const char* EventTypeToString(EventType event_type); 100 static const char* EventTypeToString(EventType event_type);
97 101
98 // Excludes NTP scope from UMA for now as it tends to dominate the stats and 102 // Excludes NTP scope from UMA for now as it tends to dominate the stats and
(...skipping 16 matching lines...) Expand all
115 // Used for ServiceWorkerStorage. 119 // Used for ServiceWorkerStorage.
116 static void RecordPurgeResourceResult(int net_error); 120 static void RecordPurgeResourceResult(int net_error);
117 static void RecordDeleteAndStartOverResult(DeleteAndStartOverResult result); 121 static void RecordDeleteAndStartOverResult(DeleteAndStartOverResult result);
118 122
119 // Counts the number of page loads controlled by a Service Worker. 123 // Counts the number of page loads controlled by a Service Worker.
120 static void CountControlledPageLoad(const GURL& url); 124 static void CountControlledPageLoad(const GURL& url);
121 125
122 // Records the result of trying to start a worker. |is_installed| indicates 126 // Records the result of trying to start a worker. |is_installed| indicates
123 // whether the version has been installed. 127 // whether the version has been installed.
124 static void RecordStartWorkerStatus(ServiceWorkerStatusCode status, 128 static void RecordStartWorkerStatus(ServiceWorkerStatusCode status,
129 EventType purpose,
125 bool is_installed); 130 bool is_installed);
126 131
127 // Records the time taken to successfully start a worker. |is_installed| 132 // Records the time taken to successfully start a worker. |is_installed|
128 // indicates whether the version has been installed. 133 // indicates whether the version has been installed.
129 static void RecordStartWorkerTime(const base::TimeDelta& time, 134 static void RecordStartWorkerTime(const base::TimeDelta& time,
130 bool is_installed); 135 bool is_installed);
131 136
132 // Records the result of trying to stop a worker. 137 // Records the result of trying to stop a worker.
133 static void RecordWorkerStopped(StopStatus status); 138 static void RecordWorkerStopped(StopStatus status);
134 139
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // previous event ended). 180 // previous event ended).
176 static void RecordTimeBetweenEvents(const base::TimeDelta& time); 181 static void RecordTimeBetweenEvents(const base::TimeDelta& time);
177 182
178 private: 183 private:
179 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); 184 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics);
180 }; 185 };
181 186
182 } // namespace content 187 } // namespace content
183 188
184 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ 189 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698