OLD | NEW |
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 "content/browser/service_worker/service_worker_database.h" | 11 #include "content/browser/service_worker/service_worker_database.h" |
12 #include "content/common/service_worker/service_worker_types.h" | 12 #include "content/common/service_worker/service_worker_types.h" |
13 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponseError.h" | 13 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponseError.h" |
14 | 14 |
15 class GURL; | 15 class GURL; |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
| 19 enum class EmbeddedWorkerStatus; |
| 20 |
19 class ServiceWorkerMetrics { | 21 class ServiceWorkerMetrics { |
20 public: | 22 public: |
21 // Used for UMA. Append-only. | 23 // Used for UMA. Append-only. |
22 enum ReadResponseResult { | 24 enum ReadResponseResult { |
23 READ_OK, | 25 READ_OK, |
24 READ_HEADERS_ERROR, | 26 READ_HEADERS_ERROR, |
25 READ_DATA_ERROR, | 27 READ_DATA_ERROR, |
26 NUM_READ_RESPONSE_RESULT_TYPES, | 28 NUM_READ_RESPONSE_RESULT_TYPES, |
27 }; | 29 }; |
28 | 30 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 EventType purpose, | 156 EventType purpose, |
155 bool is_installed); | 157 bool is_installed); |
156 | 158 |
157 // Records the time taken to successfully start a worker. |is_installed| | 159 // Records the time taken to successfully start a worker. |is_installed| |
158 // indicates whether the version has been installed. | 160 // indicates whether the version has been installed. |
159 static void RecordStartWorkerTime(base::TimeDelta time, | 161 static void RecordStartWorkerTime(base::TimeDelta time, |
160 bool is_installed, | 162 bool is_installed, |
161 StartSituation start_situation, | 163 StartSituation start_situation, |
162 EventType purpose); | 164 EventType purpose); |
163 | 165 |
| 166 // Records the time taken to prepare an activated Service Worker for a main |
| 167 // frame fetch. |
| 168 static void RecordActivatedWorkerPreparationTimeForMainFrame( |
| 169 base::TimeDelta time, |
| 170 EmbeddedWorkerStatus initial_worker_status, |
| 171 StartSituation start_situation); |
| 172 |
164 // Records the result of trying to stop a worker. | 173 // Records the result of trying to stop a worker. |
165 static void RecordWorkerStopped(StopStatus status); | 174 static void RecordWorkerStopped(StopStatus status); |
166 | 175 |
167 // Records the time taken to successfully stop a worker. | 176 // Records the time taken to successfully stop a worker. |
168 static void RecordStopWorkerTime(base::TimeDelta time); | 177 static void RecordStopWorkerTime(base::TimeDelta time); |
169 | 178 |
170 static void RecordActivateEventStatus(ServiceWorkerStatusCode status, | 179 static void RecordActivateEventStatus(ServiceWorkerStatusCode status, |
171 bool is_shutdown); | 180 bool is_shutdown); |
172 static void RecordInstallEventStatus(ServiceWorkerStatusCode status); | 181 static void RecordInstallEventStatus(ServiceWorkerStatusCode status); |
173 | 182 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 static void RecordStartStatusAfterFailure(int failure_count, | 240 static void RecordStartStatusAfterFailure(int failure_count, |
232 ServiceWorkerStatusCode status); | 241 ServiceWorkerStatusCode status); |
233 | 242 |
234 private: | 243 private: |
235 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); | 244 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); |
236 }; | 245 }; |
237 | 246 |
238 } // namespace content | 247 } // namespace content |
239 | 248 |
240 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ | 249 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ |
OLD | NEW |