Chromium Code Reviews| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "content/browser/service_worker/service_worker_database.h" | 9 #include "content/browser/service_worker/service_worker_database.h" |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 REQUEST_JOB_ERROR_STREAM_ABORTED, | 58 REQUEST_JOB_ERROR_STREAM_ABORTED, |
| 59 REQUEST_JOB_ERROR_KILLED, | 59 REQUEST_JOB_ERROR_KILLED, |
| 60 REQUEST_JOB_ERROR_KILLED_WITH_BLOB, | 60 REQUEST_JOB_ERROR_KILLED_WITH_BLOB, |
| 61 REQUEST_JOB_ERROR_KILLED_WITH_STREAM, | 61 REQUEST_JOB_ERROR_KILLED_WITH_STREAM, |
| 62 REQUEST_JOB_ERROR_DESTROYED, | 62 REQUEST_JOB_ERROR_DESTROYED, |
| 63 REQUEST_JOB_ERROR_DESTROYED_WITH_BLOB, | 63 REQUEST_JOB_ERROR_DESTROYED_WITH_BLOB, |
| 64 REQUEST_JOB_ERROR_DESTROYED_WITH_STREAM, | 64 REQUEST_JOB_ERROR_DESTROYED_WITH_STREAM, |
| 65 NUM_REQUEST_JOB_RESULT_TYPES, | 65 NUM_REQUEST_JOB_RESULT_TYPES, |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 enum EventType { | |
| 69 EVENT_TYPE_FETCH, | |
| 70 // Add new event to record here. | |
| 71 EVENT_TYPE_MAX, | |
|
falken
2015/06/25 09:31:39
the histogram people encouraged us to use NUM_EVEN
kinuko
2015/07/02 14:27:26
Done.
| |
| 72 }; | |
| 73 | |
| 68 // Used for ServiceWorkerDiskCache. | 74 // Used for ServiceWorkerDiskCache. |
| 69 static void CountInitDiskCacheResult(bool result); | 75 static void CountInitDiskCacheResult(bool result); |
| 70 static void CountReadResponseResult(ReadResponseResult result); | 76 static void CountReadResponseResult(ReadResponseResult result); |
| 71 static void CountWriteResponseResult(WriteResponseResult result); | 77 static void CountWriteResponseResult(WriteResponseResult result); |
| 72 | 78 |
| 73 // Used for ServiceWorkerDatabase. | 79 // Used for ServiceWorkerDatabase. |
| 74 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status); | 80 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status); |
| 75 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status); | 81 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status); |
| 76 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status); | 82 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status); |
| 77 static void RecordDestroyDatabaseResult(ServiceWorkerDatabase::Status status); | 83 static void RecordDestroyDatabaseResult(ServiceWorkerDatabase::Status status); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 91 // Records the time taken to successfully start a worker. |is_installed| | 97 // Records the time taken to successfully start a worker. |is_installed| |
| 92 // indicates whether the version has been installed. | 98 // indicates whether the version has been installed. |
| 93 static void RecordStartWorkerTime(const base::TimeDelta& time, | 99 static void RecordStartWorkerTime(const base::TimeDelta& time, |
| 94 bool is_installed); | 100 bool is_installed); |
| 95 | 101 |
| 96 static void RecordActivateEventStatus(ServiceWorkerStatusCode status); | 102 static void RecordActivateEventStatus(ServiceWorkerStatusCode status); |
| 97 static void RecordInstallEventStatus(ServiceWorkerStatusCode status); | 103 static void RecordInstallEventStatus(ServiceWorkerStatusCode status); |
| 98 | 104 |
| 99 // Records the ratio of unhandled events to the all events fired during | 105 // Records the ratio of unhandled events to the all events fired during |
| 100 // the lifetime of ServiceWorker. | 106 // the lifetime of ServiceWorker. |
| 101 static void RecordEventStatus(size_t fired_events, size_t handled_events); | 107 static void RecordPerWorkerEventHandledStatus(const GURL& scope, |
| 108 EventType event, | |
| 109 size_t handled_events, | |
| 110 size_t fired_events); | |
| 111 | |
| 112 // Records if each ServiceWorker event is handled or not. | |
| 113 static void RecordEventHandledStatus(const GURL& scope, | |
| 114 EventType event, | |
| 115 bool handled); | |
| 102 | 116 |
| 103 // Records result of a ServiceWorkerURLRequestJob that was forwarded to | 117 // Records result of a ServiceWorkerURLRequestJob that was forwarded to |
| 104 // the service worker. | 118 // the service worker. |
| 105 static void RecordURLRequestJobResult(bool is_main_resource, | 119 static void RecordURLRequestJobResult(bool is_main_resource, |
| 106 URLRequestJobResult result); | 120 URLRequestJobResult result); |
| 107 | 121 |
| 108 // Records the result of dispatching a fetch event to a service worker. | 122 // Records the result of dispatching a fetch event to a service worker. |
| 109 static void RecordFetchEventStatus(bool is_main_resource, | 123 static void RecordFetchEventStatus(bool is_main_resource, |
| 110 ServiceWorkerStatusCode status); | 124 ServiceWorkerStatusCode status); |
| 111 | 125 |
| 112 private: | 126 private: |
| 113 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); | 127 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); |
| 114 }; | 128 }; |
| 115 | 129 |
| 116 } // namespace content | 130 } // namespace content |
| 117 | 131 |
| 118 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ | 132 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ |
| OLD | NEW |