OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/external_metrics.h" | 5 #include "chrome/browser/chromeos/external_metrics.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
16 #include "base/metrics/sparse_histogram.h" | 16 #include "base/metrics/sparse_histogram.h" |
17 #include "base/metrics/statistics_recorder.h" | 17 #include "base/metrics/statistics_recorder.h" |
| 18 #include "base/metrics/user_metrics.h" |
18 #include "base/threading/sequenced_worker_pool.h" | 19 #include "base/threading/sequenced_worker_pool.h" |
19 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/metrics/chromeos_metrics_provider.h" | 21 #include "chrome/browser/metrics/chromeos_metrics_provider.h" |
21 #include "components/metrics/metrics_service.h" | 22 #include "components/metrics/metrics_service.h" |
22 #include "components/metrics/serialization/metric_sample.h" | 23 #include "components/metrics/serialization/metric_sample.h" |
23 #include "components/metrics/serialization/serialization_utils.h" | 24 #include "components/metrics/serialization/serialization_utils.h" |
24 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
25 #include "content/public/browser/user_metrics.h" | |
26 | 26 |
27 using base::UserMetricsAction; | |
28 using content::BrowserThread; | 27 using content::BrowserThread; |
29 | 28 |
30 namespace chromeos { | 29 namespace chromeos { |
31 | 30 |
32 namespace { | 31 namespace { |
33 | 32 |
34 bool CheckValues(const std::string& name, | 33 bool CheckValues(const std::string& name, |
35 int minimum, | 34 int minimum, |
36 int maximum, | 35 int maximum, |
37 uint32_t bucket_count) { | 36 uint32_t bucket_count) { |
(...skipping 28 matching lines...) Expand all Loading... |
66 | 65 |
67 // static | 66 // static |
68 scoped_refptr<ExternalMetrics> ExternalMetrics::CreateForTesting( | 67 scoped_refptr<ExternalMetrics> ExternalMetrics::CreateForTesting( |
69 const std::string& filename) { | 68 const std::string& filename) { |
70 scoped_refptr<ExternalMetrics> external_metrics(new ExternalMetrics()); | 69 scoped_refptr<ExternalMetrics> external_metrics(new ExternalMetrics()); |
71 external_metrics->uma_events_file_ = filename; | 70 external_metrics->uma_events_file_ = filename; |
72 return external_metrics; | 71 return external_metrics; |
73 } | 72 } |
74 | 73 |
75 void ExternalMetrics::RecordActionUI(const std::string& action_string) { | 74 void ExternalMetrics::RecordActionUI(const std::string& action_string) { |
76 content::RecordComputedAction(action_string); | 75 base::RecordComputedAction(action_string); |
77 } | 76 } |
78 | 77 |
79 void ExternalMetrics::RecordAction(const std::string& action) { | 78 void ExternalMetrics::RecordAction(const std::string& action) { |
80 BrowserThread::PostTask( | 79 BrowserThread::PostTask( |
81 BrowserThread::UI, | 80 BrowserThread::UI, |
82 FROM_HERE, | 81 FROM_HERE, |
83 base::Bind(&ExternalMetrics::RecordActionUI, this, action)); | 82 base::Bind(&ExternalMetrics::RecordActionUI, this, action)); |
84 } | 83 } |
85 | 84 |
86 void ExternalMetrics::RecordCrashUI(const std::string& crash_kind) { | 85 void ExternalMetrics::RecordCrashUI(const std::string& crash_kind) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 172 |
174 void ExternalMetrics::ScheduleCollector() { | 173 void ExternalMetrics::ScheduleCollector() { |
175 bool result = BrowserThread::GetBlockingPool()->PostDelayedWorkerTask( | 174 bool result = BrowserThread::GetBlockingPool()->PostDelayedWorkerTask( |
176 FROM_HERE, | 175 FROM_HERE, |
177 base::Bind(&chromeos::ExternalMetrics::CollectEventsAndReschedule, this), | 176 base::Bind(&chromeos::ExternalMetrics::CollectEventsAndReschedule, this), |
178 base::TimeDelta::FromSeconds(kExternalMetricsCollectionIntervalSeconds)); | 177 base::TimeDelta::FromSeconds(kExternalMetricsCollectionIntervalSeconds)); |
179 DCHECK(result); | 178 DCHECK(result); |
180 } | 179 } |
181 | 180 |
182 } // namespace chromeos | 181 } // namespace chromeos |
OLD | NEW |