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

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

Issue 2250623003: Keep ServiceWorkerMetrics::Site in ServiceWorkerVersion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 FOREIGN_FETCH_WAITUNTIL = 17, 108 FOREIGN_FETCH_WAITUNTIL = 17,
109 NAVIGATION_HINT_LINK_MOUSE_DOWN = 18, 109 NAVIGATION_HINT_LINK_MOUSE_DOWN = 18,
110 NAVIGATION_HINT_LINK_TAP_UNCONFIRMED = 19, 110 NAVIGATION_HINT_LINK_TAP_UNCONFIRMED = 19,
111 NAVIGATION_HINT_LINK_TAP_DOWN = 20, 111 NAVIGATION_HINT_LINK_TAP_DOWN = 20,
112 // Add new events to record here. 112 // Add new events to record here.
113 NUM_TYPES 113 NUM_TYPES
114 }; 114 };
115 115
116 // Used for UMA. Append only. 116 // Used for UMA. Append only.
117 enum class Site { 117 enum class Site {
118 OTHER, // Obsolete 118 OTHER, // Obsolete for UMA. Use WITH_FETCH_HANDLER or
119 // WITHOUT_FETCH_HANDLER.
119 NEW_TAB_PAGE, 120 NEW_TAB_PAGE,
120 WITH_FETCH_HANDLER, 121 WITH_FETCH_HANDLER,
121 WITHOUT_FETCH_HANDLER, 122 WITHOUT_FETCH_HANDLER,
122 NUM_TYPES 123 NUM_TYPES
123 }; 124 };
124 125
125 // Not used for UMA. 126 // Not used for UMA.
126 enum class StartSituation { 127 enum class StartSituation {
127 UNKNOWN, 128 UNKNOWN,
128 DURING_STARTUP, 129 DURING_STARTUP,
129 EXISTING_PROCESS, 130 EXISTING_PROCESS,
130 NEW_PROCESS 131 NEW_PROCESS
131 }; 132 };
132 133
133 // Not used for UMA. 134 // Not used for UMA.
134 enum class LoadSource { NETWORK, HTTP_CACHE, SERVICE_WORKER_STORAGE }; 135 enum class LoadSource { NETWORK, HTTP_CACHE, SERVICE_WORKER_STORAGE };
135 136
136 // Converts an event type to a string. Used for tracing. 137 // Converts an event type to a string. Used for tracing.
137 static const char* EventTypeToString(EventType event_type); 138 static const char* EventTypeToString(EventType event_type);
138 139
140 // If the |url| is not a special site, returns Site::OTHER.
141 static Site SiteFromURL(const GURL& url);
142
139 // Returns true when the event is for a navigation hint. 143 // Returns true when the event is for a navigation hint.
140 static bool IsNavigationHintEvent(EventType event_type); 144 static bool IsNavigationHintEvent(EventType event_type);
141 145
142 // Excludes NTP scope from UMA for now as it tends to dominate the stats and 146 // Excludes NTP scope from UMA for now as it tends to dominate the stats and
143 // makes the results largely skewed. Some metrics don't follow this policy 147 // makes the results largely skewed. Some metrics don't follow this policy
144 // and hence don't call this function. 148 // and hence don't call this function.
145 static bool ShouldExcludeSiteFromHistogram(Site site); 149 static bool ShouldExcludeSiteFromHistogram(Site site);
146 static bool ShouldExcludeURLFromHistogram(const GURL& url);
147 150
148 // Used for ServiceWorkerDiskCache. 151 // Used for ServiceWorkerDiskCache.
149 static void CountInitDiskCacheResult(bool result); 152 static void CountInitDiskCacheResult(bool result);
150 static void CountReadResponseResult(ReadResponseResult result); 153 static void CountReadResponseResult(ReadResponseResult result);
151 static void CountWriteResponseResult(WriteResponseResult result); 154 static void CountWriteResponseResult(WriteResponseResult result);
152 155
153 // Used for ServiceWorkerDatabase. 156 // Used for ServiceWorkerDatabase.
154 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status); 157 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status);
155 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status); 158 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status);
156 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status); 159 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status);
157 static void RecordDestroyDatabaseResult(ServiceWorkerDatabase::Status status); 160 static void RecordDestroyDatabaseResult(ServiceWorkerDatabase::Status status);
158 161
159 // Used for ServiceWorkerStorage. 162 // Used for ServiceWorkerStorage.
160 static void RecordPurgeResourceResult(int net_error); 163 static void RecordPurgeResourceResult(int net_error);
161 static void RecordDeleteAndStartOverResult(DeleteAndStartOverResult result); 164 static void RecordDeleteAndStartOverResult(DeleteAndStartOverResult result);
162 165
163 // Counts the number of page loads controlled by a Service Worker. 166 // Counts the number of page loads controlled by a Service Worker.
164 static void CountControlledPageLoad(const GURL& url, 167 static void CountControlledPageLoad(Site site,
165 bool has_fetch_handler, 168 const GURL& url,
166 bool is_main_frame_load); 169 bool is_main_frame_load);
167 170
168 // Records the result of trying to start a worker. |is_installed| indicates 171 // Records the result of trying to start a worker. |is_installed| indicates
169 // whether the version has been installed. 172 // whether the version has been installed.
170 static void RecordStartWorkerStatus(ServiceWorkerStatusCode status, 173 static void RecordStartWorkerStatus(ServiceWorkerStatusCode status,
171 EventType purpose, 174 EventType purpose,
172 bool is_installed); 175 bool is_installed);
173 176
174 // Records the time taken to successfully start a worker. |is_installed| 177 // Records the time taken to successfully start a worker. |is_installed|
175 // indicates whether the version has been installed. 178 // indicates whether the version has been installed.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 static void RecordStartStatusAfterFailure(int failure_count, 268 static void RecordStartStatusAfterFailure(int failure_count,
266 ServiceWorkerStatusCode status); 269 ServiceWorkerStatusCode status);
267 270
268 private: 271 private:
269 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); 272 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics);
270 }; 273 };
271 274
272 } // namespace content 275 } // namespace content
273 276
274 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ 277 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698