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

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: diff from https://codereview.chromium.org/2251633002/#ps40001 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"
11 #include "base/optional.h"
11 #include "content/browser/service_worker/service_worker_database.h" 12 #include "content/browser/service_worker/service_worker_database.h"
12 #include "content/common/service_worker/service_worker_types.h" 13 #include "content/common/service_worker/service_worker_types.h"
13 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerResponseError.h" 14 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerResponseError.h"
14 15
15 class GURL; 16 class GURL;
16 17
17 namespace content { 18 namespace content {
18 19
19 enum class EmbeddedWorkerStatus; 20 enum class EmbeddedWorkerStatus;
20 21
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Returns Site for the |url|. When the |url| is not a NPT site, if
141 // |has_fetch_handler| is not set it returns OTHER, othewise returns
142 // WITH_FETCH_HANDLER or WITHOUT_FETCH_HANDLER depending on the bool value.
143 static Site SiteFromURL(const GURL& url,
144 base::Optional<bool> has_fetch_handler);
145
139 // Returns true when the event is for a navigation hint. 146 // Returns true when the event is for a navigation hint.
140 static bool IsNavigationHintEvent(EventType event_type); 147 static bool IsNavigationHintEvent(EventType event_type);
141 148
142 // Excludes NTP scope from UMA for now as it tends to dominate the stats and 149 // 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 150 // makes the results largely skewed. Some metrics don't follow this policy
144 // and hence don't call this function. 151 // and hence don't call this function.
145 static bool ShouldExcludeSiteFromHistogram(Site site); 152 static bool ShouldExcludeSiteFromHistogram(Site site);
146 static bool ShouldExcludeURLFromHistogram(const GURL& url);
147 153
148 // Used for ServiceWorkerDiskCache. 154 // Used for ServiceWorkerDiskCache.
149 static void CountInitDiskCacheResult(bool result); 155 static void CountInitDiskCacheResult(bool result);
150 static void CountReadResponseResult(ReadResponseResult result); 156 static void CountReadResponseResult(ReadResponseResult result);
151 static void CountWriteResponseResult(WriteResponseResult result); 157 static void CountWriteResponseResult(WriteResponseResult result);
152 158
153 // Used for ServiceWorkerDatabase. 159 // Used for ServiceWorkerDatabase.
154 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status); 160 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status);
155 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status); 161 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status);
156 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status); 162 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status);
157 static void RecordDestroyDatabaseResult(ServiceWorkerDatabase::Status status); 163 static void RecordDestroyDatabaseResult(ServiceWorkerDatabase::Status status);
158 164
159 // Used for ServiceWorkerStorage. 165 // Used for ServiceWorkerStorage.
160 static void RecordPurgeResourceResult(int net_error); 166 static void RecordPurgeResourceResult(int net_error);
161 static void RecordDeleteAndStartOverResult(DeleteAndStartOverResult result); 167 static void RecordDeleteAndStartOverResult(DeleteAndStartOverResult result);
162 168
163 // Counts the number of page loads controlled by a Service Worker. 169 // Counts the number of page loads controlled by a Service Worker.
164 static void CountControlledPageLoad(const GURL& url, 170 static void CountControlledPageLoad(Site site,
165 bool has_fetch_handler, 171 const GURL& url,
166 bool is_main_frame_load); 172 bool is_main_frame_load);
167 173
168 // Records the result of trying to start a worker. |is_installed| indicates 174 // Records the result of trying to start a worker. |is_installed| indicates
169 // whether the version has been installed. 175 // whether the version has been installed.
170 static void RecordStartWorkerStatus(ServiceWorkerStatusCode status, 176 static void RecordStartWorkerStatus(ServiceWorkerStatusCode status,
171 EventType purpose, 177 EventType purpose,
172 bool is_installed); 178 bool is_installed);
173 179
174 // Records the time taken to successfully start a worker. |is_installed| 180 // Records the time taken to successfully start a worker. |is_installed|
175 // indicates whether the version has been installed. 181 // indicates whether the version has been installed.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 static void RecordStartStatusAfterFailure(int failure_count, 268 static void RecordStartStatusAfterFailure(int failure_count,
263 ServiceWorkerStatusCode status); 269 ServiceWorkerStatusCode status);
264 270
265 private: 271 private:
266 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); 272 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics);
267 }; 273 };
268 274
269 } // namespace content 275 } // namespace content
270 276
271 #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