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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 enum StopWorkerStatus { | 68 enum StopWorkerStatus { |
| 69 STOP_STATUS_STOPPING, | 69 STOP_STATUS_STOPPING, |
| 70 STOP_STATUS_STOPPED, | 70 STOP_STATUS_STOPPED, |
| 71 STOP_STATUS_STALLED, | 71 STOP_STATUS_STALLED, |
| 72 STOP_STATUS_STALLED_THEN_STOPPED, | 72 STOP_STATUS_STALLED_THEN_STOPPED, |
| 73 NUM_STOP_STATUS_TYPES | 73 NUM_STOP_STATUS_TYPES |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 enum EventType { | |
| 77 EVENT_TYPE_FETCH, | |
| 78 // Add new events to record here. | |
| 79 | |
| 80 NUM_EVENT_TYPES | |
| 81 }; | |
| 82 | |
| 76 // Used for ServiceWorkerDiskCache. | 83 // Used for ServiceWorkerDiskCache. |
| 77 static void CountInitDiskCacheResult(bool result); | 84 static void CountInitDiskCacheResult(bool result); |
| 78 static void CountReadResponseResult(ReadResponseResult result); | 85 static void CountReadResponseResult(ReadResponseResult result); |
| 79 static void CountWriteResponseResult(WriteResponseResult result); | 86 static void CountWriteResponseResult(WriteResponseResult result); |
| 80 | 87 |
| 81 // Used for ServiceWorkerDatabase. | 88 // Used for ServiceWorkerDatabase. |
| 82 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status); | 89 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status); |
| 83 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status); | 90 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status); |
| 84 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status); | 91 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status); |
| 85 static void RecordDestroyDatabaseResult(ServiceWorkerDatabase::Status status); | 92 static void RecordDestroyDatabaseResult(ServiceWorkerDatabase::Status status); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 103 | 110 |
| 104 // Records the result of trying to stop a worker. | 111 // Records the result of trying to stop a worker. |
| 105 static void RecordStopWorkerStatus(StopWorkerStatus status); | 112 static void RecordStopWorkerStatus(StopWorkerStatus status); |
| 106 | 113 |
| 107 // Records the time taken to successfully stop a worker. | 114 // Records the time taken to successfully stop a worker. |
| 108 static void RecordStopWorkerTime(const base::TimeDelta& time); | 115 static void RecordStopWorkerTime(const base::TimeDelta& time); |
| 109 | 116 |
| 110 static void RecordActivateEventStatus(ServiceWorkerStatusCode status); | 117 static void RecordActivateEventStatus(ServiceWorkerStatusCode status); |
| 111 static void RecordInstallEventStatus(ServiceWorkerStatusCode status); | 118 static void RecordInstallEventStatus(ServiceWorkerStatusCode status); |
| 112 | 119 |
| 113 // Records the ratio of unhandled events to the all events fired during | 120 // Records how much of dispatched events is handled while a Service |
|
falken
2015/07/03 04:45:00
I think it's "are handled"
kinuko
2015/07/05 09:19:04
Done.
| |
| 114 // the lifetime of ServiceWorker. | 121 // Worker is awake (i.e. after it is woken up until it gets stopped). |
| 115 static void RecordEventStatus(size_t fired_events, size_t handled_events); | 122 static void RecordEventHandledRatio(const GURL& scope, |
| 123 EventType event, | |
| 124 size_t handled_events, | |
| 125 size_t fired_events); | |
| 116 | 126 |
| 117 // Records the result of dispatching a fetch event to a service worker. | 127 // Records the result of dispatching a fetch event to a service worker. |
| 118 static void RecordFetchEventStatus(bool is_main_resource, | 128 static void RecordFetchEventStatus(bool is_main_resource, |
| 119 ServiceWorkerStatusCode status); | 129 ServiceWorkerStatusCode status); |
| 120 | 130 |
| 121 // Records result of a ServiceWorkerURLRequestJob that was forwarded to | 131 // Records result of a ServiceWorkerURLRequestJob that was forwarded to |
| 122 // the service worker. | 132 // the service worker. |
| 123 static void RecordURLRequestJobResult(bool is_main_resource, | 133 static void RecordURLRequestJobResult(bool is_main_resource, |
| 124 URLRequestJobResult result); | 134 URLRequestJobResult result); |
| 125 | 135 |
| 126 | 136 |
| 127 private: | 137 private: |
| 128 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); | 138 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); |
| 129 }; | 139 }; |
| 130 | 140 |
| 131 } // namespace content | 141 } // namespace content |
| 132 | 142 |
| 133 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ | 143 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ |
| OLD | NEW |