| 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 "base/time/time.h" |
| 9 #include "content/browser/service_worker/service_worker_database.h" | 10 #include "content/browser/service_worker/service_worker_database.h" |
| 10 | 11 |
| 11 namespace content { | 12 namespace content { |
| 12 | 13 |
| 13 class ServiceWorkerMetrics { | 14 class ServiceWorkerMetrics { |
| 14 public: | 15 public: |
| 15 enum ReadResponseResult { | 16 enum ReadResponseResult { |
| 16 READ_OK, | 17 READ_OK, |
| 17 READ_HEADERS_ERROR, | 18 READ_HEADERS_ERROR, |
| 18 READ_DATA_ERROR, | 19 READ_DATA_ERROR, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 32 static void CountWriteResponseResult(WriteResponseResult result); | 33 static void CountWriteResponseResult(WriteResponseResult result); |
| 33 | 34 |
| 34 // Used for ServiceWorkerDatabase. | 35 // Used for ServiceWorkerDatabase. |
| 35 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status); | 36 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status); |
| 36 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status); | 37 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status); |
| 37 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status); | 38 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status); |
| 38 | 39 |
| 39 // Counts the number of page loads controlled by a Service Worker. | 40 // Counts the number of page loads controlled by a Service Worker. |
| 40 static void CountControlledPageLoad(); | 41 static void CountControlledPageLoad(); |
| 41 | 42 |
| 43 // Measure the execution time of onfetch/oninstall event |
| 44 static void MeasureFetchEventExecutionTime(base::TimeDelta delta); |
| 45 static void MeasureRegistrationTime(base::TimeDelta delta); |
| 46 |
| 42 private: | 47 private: |
| 43 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); | 48 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics); |
| 44 }; | 49 }; |
| 45 | 50 |
| 46 } // namespace content | 51 } // namespace content |
| 47 | 52 |
| 48 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ | 53 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_ |
| OLD | NEW |