Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / content / browser / service_worker / service_worker_metrics.cc
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.
4
5 #include "content/browser/service_worker/service_worker_metrics.h"
6
7 #include "base/metrics/histogram.h"
8 #include "base/metrics/user_metrics_action.h"
9 #include "content/public/browser/user_metrics.h"
10
11 namespace content {
12
13 // static
14 void ServiceWorkerMetrics::CountInitDiskCacheResult(bool result) {
15   UMA_HISTOGRAM_BOOLEAN("ServiceWorker.DiskCache.InitResult", result);
16 }
17
18 // static
19 void ServiceWorkerMetrics::CountReadResponseResult(
20     ServiceWorkerMetrics::ReadResponseResult result) {
21   UMA_HISTOGRAM_ENUMERATION("ServiceWorker.DiskCache.ReadResponseResult",
22                             result, NUM_READ_RESPONSE_RESULT_TYPES);
23 }
24
25 // static
26 void ServiceWorkerMetrics::CountWriteResponseResult(
27     ServiceWorkerMetrics::WriteResponseResult result) {
28   UMA_HISTOGRAM_ENUMERATION("ServiceWorker.DiskCache.WriteResponseResult",
29                             result, NUM_WRITE_RESPONSE_RESULT_TYPES);
30 }
31
32 // static
33 void ServiceWorkerMetrics::CountOpenDatabaseResult(
34     ServiceWorkerDatabase::Status status) {
35   UMA_HISTOGRAM_ENUMERATION("ServiceWorker.Database.OpenResult",
36                             status, ServiceWorkerDatabase::STATUS_ERROR_MAX);
37 }
38
39 // static
40 void ServiceWorkerMetrics::CountReadDatabaseResult(
41     ServiceWorkerDatabase::Status status) {
42   UMA_HISTOGRAM_ENUMERATION("ServiceWorker.Database.ReadResult",
43                             status, ServiceWorkerDatabase::STATUS_ERROR_MAX);
44 }
45
46 // static
47 void ServiceWorkerMetrics::CountWriteDatabaseResult(
48     ServiceWorkerDatabase::Status status) {
49   UMA_HISTOGRAM_ENUMERATION("ServiceWorker.Database.WriteResult",
50                             status, ServiceWorkerDatabase::STATUS_ERROR_MAX);
51 }
52
53 // static
54 void ServiceWorkerMetrics::CountControlledPageLoad() {
55   RecordAction(base::UserMetricsAction("ServiceWorker.ControlledPageLoad"));
56 }
57
58 }  // namespace content