| 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" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 FETCH_SUB_FRAME = 11, | 93 FETCH_SUB_FRAME = 11, |
| 94 FETCH_SHARED_WORKER = 12, | 94 FETCH_SHARED_WORKER = 12, |
| 95 FETCH_SUB_RESOURCE = 13, | 95 FETCH_SUB_RESOURCE = 13, |
| 96 UNKNOWN = 14, // Used when event type is not known. | 96 UNKNOWN = 14, // Used when event type is not known. |
| 97 FOREIGN_FETCH = 15, | 97 FOREIGN_FETCH = 15, |
| 98 // Add new events to record here. | 98 // Add new events to record here. |
| 99 NUM_TYPES | 99 NUM_TYPES |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 // Used for UMA. Append only. | 102 // Used for UMA. Append only. |
| 103 enum class Site { OTHER, NEW_TAB_PAGE, NUM_TYPES }; | 103 enum class Site { |
| 104 OTHER, // Obsolete |
| 105 NEW_TAB_PAGE, |
| 106 WITH_FETCH_HANDLER, |
| 107 WITHOUT_FETCH_HANDLER, |
| 108 NUM_TYPES |
| 109 }; |
| 104 | 110 |
| 105 // Not used for UMA. | 111 // Not used for UMA. |
| 106 enum class StartSituation { | 112 enum class StartSituation { |
| 107 UNKNOWN, | 113 UNKNOWN, |
| 108 DURING_STARTUP, | 114 DURING_STARTUP, |
| 109 EXISTING_PROCESS, | 115 EXISTING_PROCESS, |
| 110 NEW_PROCESS | 116 NEW_PROCESS |
| 111 }; | 117 }; |
| 112 | 118 |
| 113 // Not used for UMA. | 119 // Not used for UMA. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 131 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status); | 137 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status); |
| 132 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status); | 138 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status); |
| 133 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status); | 139 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status); |
| 134 static void RecordDestroyDatabaseResult(ServiceWorkerDatabase::Status status); | 140 static void RecordDestroyDatabaseResult(ServiceWorkerDatabase::Status status); |
| 135 | 141 |
| 136 // Used for ServiceWorkerStorage. | 142 // Used for ServiceWorkerStorage. |
| 137 static void RecordPurgeResourceResult(int net_error); | 143 static void RecordPurgeResourceResult(int net_error); |
| 138 static void RecordDeleteAndStartOverResult(DeleteAndStartOverResult result); | 144 static void RecordDeleteAndStartOverResult(DeleteAndStartOverResult result); |
| 139 | 145 |
| 140 // Counts the number of page loads controlled by a Service Worker. | 146 // Counts the number of page loads controlled by a Service Worker. |
| 141 static void CountControlledPageLoad(const GURL& url); | 147 static void CountControlledPageLoad(const GURL& url, bool has_fetch_handler); |
| 142 | 148 |
| 143 // Records the result of trying to start a worker. |is_installed| indicates | 149 // Records the result of trying to start a worker. |is_installed| indicates |
| 144 // whether the version has been installed. | 150 // whether the version has been installed. |
| 145 static void RecordStartWorkerStatus(ServiceWorkerStatusCode status, | 151 static void RecordStartWorkerStatus(ServiceWorkerStatusCode status, |
| 146 EventType purpose, | 152 EventType purpose, |
| 147 bool is_installed); | 153 bool is_installed); |
| 148 | 154 |
| 149 // Records the time taken to successfully start a worker. |is_installed| | 155 // Records the time taken to successfully start a worker. |is_installed| |
| 150 // indicates whether the version has been installed. | 156 // indicates whether the version has been installed. |
| 151 static void RecordStartWorkerTime(base::TimeDelta time, | 157 static void RecordStartWorkerTime(base::TimeDelta time, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 static void RecordStartStatusAfterFailure(int failure_count, | 227 static void RecordStartStatusAfterFailure(int failure_count, |
| 222 ServiceWorkerStatusCode status); | 228 ServiceWorkerStatusCode status); |
| 223 | 229 |
| 224 private: | 230 private: |
| 225 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); | 231 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); |
| 226 }; | 232 }; |
| 227 | 233 |
| 228 } // namespace content | 234 } // namespace content |
| 229 | 235 |
| 230 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ | 236 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ |
| OLD | NEW |