Chromium Code Reviews| 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 #include "content/browser/service_worker/service_worker_metrics.h" | 5 #include "content/browser/service_worker/service_worker_metrics.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/metrics/user_metrics_action.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" | |
| 9 #include "content/public/browser/user_metrics.h" | 11 #include "content/public/browser/user_metrics.h" |
| 12 #include "content/public/common/content_client.h" | |
| 10 | 13 |
| 11 namespace content { | 14 namespace content { |
| 12 | 15 |
| 16 namespace { | |
| 17 | |
| 18 void SampleDomainAndRegistryFromGURLOnUI(const GURL&url) { | |
|
falken
2015/02/25 01:43:59
missing space before url (weird, does that compile
horo
2015/02/25 02:27:00
Done.
| |
| 19 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 20 GetContentClient()->browser()->SampleDomainAndRegistryFromGURL( | |
| 21 "ServiceWorker.ControlledPageLoad", | |
|
falken
2015/02/25 01:43:59
I might not understand RAPPOR enough, but I feel w
horo
2015/02/25 02:27:00
Done.
| |
| 22 url); | |
| 23 } | |
| 24 | |
| 25 } // namespace | |
| 26 | |
| 13 // static | 27 // static |
| 14 void ServiceWorkerMetrics::CountInitDiskCacheResult(bool result) { | 28 void ServiceWorkerMetrics::CountInitDiskCacheResult(bool result) { |
| 15 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.DiskCache.InitResult", result); | 29 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.DiskCache.InitResult", result); |
| 16 } | 30 } |
| 17 | 31 |
| 18 // static | 32 // static |
| 19 void ServiceWorkerMetrics::CountReadResponseResult( | 33 void ServiceWorkerMetrics::CountReadResponseResult( |
| 20 ServiceWorkerMetrics::ReadResponseResult result) { | 34 ServiceWorkerMetrics::ReadResponseResult result) { |
| 21 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.DiskCache.ReadResponseResult", | 35 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.DiskCache.ReadResponseResult", |
| 22 result, NUM_READ_RESPONSE_RESULT_TYPES); | 36 result, NUM_READ_RESPONSE_RESULT_TYPES); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 44 } | 58 } |
| 45 | 59 |
| 46 // static | 60 // static |
| 47 void ServiceWorkerMetrics::CountWriteDatabaseResult( | 61 void ServiceWorkerMetrics::CountWriteDatabaseResult( |
| 48 ServiceWorkerDatabase::Status status) { | 62 ServiceWorkerDatabase::Status status) { |
| 49 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.Database.WriteResult", | 63 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.Database.WriteResult", |
| 50 status, ServiceWorkerDatabase::STATUS_ERROR_MAX); | 64 status, ServiceWorkerDatabase::STATUS_ERROR_MAX); |
| 51 } | 65 } |
| 52 | 66 |
| 53 // static | 67 // static |
| 54 void ServiceWorkerMetrics::CountControlledPageLoad() { | 68 void ServiceWorkerMetrics::CountControlledPageLoad(const GURL& url) { |
| 55 RecordAction(base::UserMetricsAction("ServiceWorker.ControlledPageLoad")); | 69 RecordAction(base::UserMetricsAction("ServiceWorker.ControlledPageLoad")); |
| 70 BrowserThread::PostTask( | |
| 71 BrowserThread::UI, | |
| 72 FROM_HERE, | |
| 73 base::Bind(&SampleDomainAndRegistryFromGURLOnUI, url)); | |
| 56 } | 74 } |
| 57 | 75 |
| 58 } // namespace content | 76 } // namespace content |
| OLD | NEW |