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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 SERVICE_PORT_CONNECT, | 84 SERVICE_PORT_CONNECT, |
85 MESSAGE, | 85 MESSAGE, |
86 // Add new events to record here. | 86 // Add new events to record here. |
87 | 87 |
88 NUM_TYPES | 88 NUM_TYPES |
89 }; | 89 }; |
90 | 90 |
91 // Used for UMA. Append only. | 91 // Used for UMA. Append only. |
92 enum class Site { OTHER, NEW_TAB_PAGE, NUM_TYPES }; | 92 enum class Site { OTHER, NEW_TAB_PAGE, NUM_TYPES }; |
93 | 93 |
| 94 // Converts an event type to a string. Used for tracing. |
| 95 static const char* EventTypeToString(EventType event_type); |
| 96 |
94 // Excludes NTP scope from UMA for now as it tends to dominate the stats and | 97 // Excludes NTP scope from UMA for now as it tends to dominate the stats and |
95 // makes the results largely skewed. Some metrics don't follow this policy | 98 // makes the results largely skewed. Some metrics don't follow this policy |
96 // and hence don't call this function. | 99 // and hence don't call this function. |
97 static bool ShouldExcludeSiteFromHistogram(Site site); | 100 static bool ShouldExcludeSiteFromHistogram(Site site); |
98 static bool ShouldExcludeURLFromHistogram(const GURL& url); | 101 static bool ShouldExcludeURLFromHistogram(const GURL& url); |
99 | 102 |
100 // Used for ServiceWorkerDiskCache. | 103 // Used for ServiceWorkerDiskCache. |
101 static void CountInitDiskCacheResult(bool result); | 104 static void CountInitDiskCacheResult(bool result); |
102 static void CountReadResponseResult(ReadResponseResult result); | 105 static void CountReadResponseResult(ReadResponseResult result); |
103 static void CountWriteResponseResult(WriteResponseResult result); | 106 static void CountWriteResponseResult(WriteResponseResult result); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // previous event ended). | 177 // previous event ended). |
175 static void RecordTimeBetweenEvents(const base::TimeDelta& time); | 178 static void RecordTimeBetweenEvents(const base::TimeDelta& time); |
176 | 179 |
177 private: | 180 private: |
178 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); | 181 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); |
179 }; | 182 }; |
180 | 183 |
181 } // namespace content | 184 } // namespace content |
182 | 185 |
183 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ | 186 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ |
OLD | NEW |