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 10 matching lines...) Expand all Loading... |
21 NUM_READ_RESPONSE_RESULT_TYPES, | 21 NUM_READ_RESPONSE_RESULT_TYPES, |
22 }; | 22 }; |
23 | 23 |
24 enum WriteResponseResult { | 24 enum WriteResponseResult { |
25 WRITE_OK, | 25 WRITE_OK, |
26 WRITE_HEADERS_ERROR, | 26 WRITE_HEADERS_ERROR, |
27 WRITE_DATA_ERROR, | 27 WRITE_DATA_ERROR, |
28 NUM_WRITE_RESPONSE_RESULT_TYPES, | 28 NUM_WRITE_RESPONSE_RESULT_TYPES, |
29 }; | 29 }; |
30 | 30 |
| 31 enum DiskCacheMigrationResult { |
| 32 MIGRATION_OK, |
| 33 MIGRATION_NOT_NECESSARY, |
| 34 MIGRATION_ERROR_FAILED, |
| 35 NUM_MIGRATION_RESULT_TYPES, |
| 36 }; |
| 37 |
31 enum DeleteAndStartOverResult { | 38 enum DeleteAndStartOverResult { |
32 DELETE_OK, | 39 DELETE_OK, |
33 DELETE_DATABASE_ERROR, | 40 DELETE_DATABASE_ERROR, |
34 DELETE_DISK_CACHE_ERROR, | 41 DELETE_DISK_CACHE_ERROR, |
35 NUM_DELETE_AND_START_OVER_RESULT_TYPES, | 42 NUM_DELETE_AND_START_OVER_RESULT_TYPES, |
36 }; | 43 }; |
37 | 44 |
38 // Used for ServiceWorkerDiskCache. | 45 // Used for ServiceWorkerDiskCache. |
39 static void CountInitDiskCacheResult(bool result); | 46 static void CountInitDiskCacheResult(bool result); |
40 static void CountReadResponseResult(ReadResponseResult result); | 47 static void CountReadResponseResult(ReadResponseResult result); |
41 static void CountWriteResponseResult(WriteResponseResult result); | 48 static void CountWriteResponseResult(WriteResponseResult result); |
42 | 49 |
43 // Used for ServiceWorkerDatabase. | 50 // Used for ServiceWorkerDatabase. |
44 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status); | 51 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status); |
45 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status); | 52 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status); |
46 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status); | 53 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status); |
47 static void RecordDestroyDatabaseResult(ServiceWorkerDatabase::Status status); | 54 static void RecordDestroyDatabaseResult(ServiceWorkerDatabase::Status status); |
48 | 55 |
49 // Used for ServiceWorkerStorage. | 56 // Used for ServiceWorkerStorage. |
50 static void RecordDeleteAndStartOverResult(DeleteAndStartOverResult result); | 57 static void RecordDeleteAndStartOverResult(DeleteAndStartOverResult result); |
| 58 static void RecordDiskCacheMigrationResult(DiskCacheMigrationResult result); |
51 | 59 |
52 // Counts the number of page loads controlled by a Service Worker. | 60 // Counts the number of page loads controlled by a Service Worker. |
53 static void CountControlledPageLoad(const GURL& url); | 61 static void CountControlledPageLoad(const GURL& url); |
54 | 62 |
55 // Records the result of trying to start a worker. |is_installed| indicates | 63 // Records the result of trying to start a worker. |is_installed| indicates |
56 // whether the version has been installed. | 64 // whether the version has been installed. |
57 static void RecordStartWorkerStatus(ServiceWorkerStatusCode status, | 65 static void RecordStartWorkerStatus(ServiceWorkerStatusCode status, |
58 bool is_installed); | 66 bool is_installed); |
59 | 67 |
60 // Records the time taken to successfully start a worker. |is_installed| | 68 // Records the time taken to successfully start a worker. |is_installed| |
61 // indicates whether the version has been installed. | 69 // indicates whether the version has been installed. |
62 static void RecordStartWorkerTime(const base::TimeDelta& time, | 70 static void RecordStartWorkerTime(const base::TimeDelta& time, |
63 bool is_installed); | 71 bool is_installed); |
64 | 72 |
65 static void RecordActivateEventStatus(ServiceWorkerStatusCode status); | 73 static void RecordActivateEventStatus(ServiceWorkerStatusCode status); |
66 static void RecordInstallEventStatus(ServiceWorkerStatusCode status); | 74 static void RecordInstallEventStatus(ServiceWorkerStatusCode status); |
67 | 75 |
68 // Records the ratio of unhandled events to the all events fired during | 76 // Records the ratio of unhandled events to the all events fired during |
69 // the lifetime of ServiceWorker. | 77 // the lifetime of ServiceWorker. |
70 static void RecordEventStatus(size_t fired_events, size_t handled_events); | 78 static void RecordEventStatus(size_t fired_events, size_t handled_events); |
71 | 79 |
72 private: | 80 private: |
73 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); | 81 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); |
74 }; | 82 }; |
75 | 83 |
76 } // namespace content | 84 } // namespace content |
77 | 85 |
78 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ | 86 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ |
OLD | NEW |