ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / content / browser / service_worker / service_worker_metrics.cc
blob30cd11471384075c8a451cb58c01749eaf10780a
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/browser_thread.h"
10 #include "content/public/browser/content_browser_client.h"
11 #include "content/public/browser/user_metrics.h"
12 #include "content/public/common/content_client.h"
14 namespace content {
16 namespace {
18 void RecordURLMetricOnUI(const GURL& url) {
19 DCHECK_CURRENTLY_ON(BrowserThread::UI);
20 GetContentClient()->browser()->RecordURLMetric(
21 "ServiceWorker.ControlledPageUrl", url);
24 } // namespace
26 // static
27 void ServiceWorkerMetrics::CountInitDiskCacheResult(bool result) {
28 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.DiskCache.InitResult", result);
31 // static
32 void ServiceWorkerMetrics::CountReadResponseResult(
33 ServiceWorkerMetrics::ReadResponseResult result) {
34 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.DiskCache.ReadResponseResult",
35 result, NUM_READ_RESPONSE_RESULT_TYPES);
38 // static
39 void ServiceWorkerMetrics::CountWriteResponseResult(
40 ServiceWorkerMetrics::WriteResponseResult result) {
41 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.DiskCache.WriteResponseResult",
42 result, NUM_WRITE_RESPONSE_RESULT_TYPES);
45 // static
46 void ServiceWorkerMetrics::CountOpenDatabaseResult(
47 ServiceWorkerDatabase::Status status) {
48 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.Database.OpenResult",
49 status, ServiceWorkerDatabase::STATUS_ERROR_MAX);
52 // static
53 void ServiceWorkerMetrics::CountReadDatabaseResult(
54 ServiceWorkerDatabase::Status status) {
55 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.Database.ReadResult",
56 status, ServiceWorkerDatabase::STATUS_ERROR_MAX);
59 // static
60 void ServiceWorkerMetrics::CountWriteDatabaseResult(
61 ServiceWorkerDatabase::Status status) {
62 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.Database.WriteResult",
63 status, ServiceWorkerDatabase::STATUS_ERROR_MAX);
66 // static
67 void ServiceWorkerMetrics::CountControlledPageLoad(const GURL& url) {
68 RecordAction(base::UserMetricsAction("ServiceWorker.ControlledPageLoad"));
69 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
70 base::Bind(&RecordURLMetricOnUI, url));
73 } // namespace content