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
3 // found in the LICENSE file.
5 #include "content/browser/service_worker/service_worker_metrics.h"
7 #include "base/metrics/histogram.h"
8 #include "base/metrics/user_metrics_action.h"
9 #include "content/public/browser/user_metrics.h"
14 void ServiceWorkerMetrics::CountInitDiskCacheResult(bool result
) {
15 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.DiskCache.InitResult", result
);
19 void ServiceWorkerMetrics::CountReadResponseResult(
20 ServiceWorkerMetrics::ReadResponseResult result
) {
21 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.DiskCache.ReadResponseResult",
22 result
, NUM_READ_RESPONSE_RESULT_TYPES
);
26 void ServiceWorkerMetrics::CountWriteResponseResult(
27 ServiceWorkerMetrics::WriteResponseResult result
) {
28 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.DiskCache.WriteResponseResult",
29 result
, NUM_WRITE_RESPONSE_RESULT_TYPES
);
33 void ServiceWorkerMetrics::CountOpenDatabaseResult(
34 ServiceWorkerDatabase::Status status
) {
35 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.Database.OpenResult",
36 status
, ServiceWorkerDatabase::STATUS_ERROR_MAX
);
40 void ServiceWorkerMetrics::CountReadDatabaseResult(
41 ServiceWorkerDatabase::Status status
) {
42 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.Database.ReadResult",
43 status
, ServiceWorkerDatabase::STATUS_ERROR_MAX
);
47 void ServiceWorkerMetrics::CountWriteDatabaseResult(
48 ServiceWorkerDatabase::Status status
) {
49 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.Database.WriteResult",
50 status
, ServiceWorkerDatabase::STATUS_ERROR_MAX
);
54 void ServiceWorkerMetrics::CountControlledPageLoad() {
55 RecordAction(base::UserMetricsAction("ServiceWorker.ControlledPageLoad"));
58 } // namespace content