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 "chromecast/browser/metrics/cast_metrics_service_client.h" | 5 #include "chromecast/browser/metrics/cast_metrics_service_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "chromecast/browser/metrics/cast_stability_metrics_provider.h" | 9 #include "chromecast/browser/metrics/cast_stability_metrics_provider.h" |
10 #include "chromecast/browser/metrics/platform_metrics_providers.h" | 10 #include "chromecast/browser/metrics/platform_metrics_providers.h" |
11 #include "chromecast/common/chromecast_config.h" | 11 #include "chromecast/common/chromecast_config.h" |
12 #include "chromecast/common/chromecast_switches.h" | 12 #include "chromecast/common/chromecast_switches.h" |
13 #include "components/metrics/client_info.h" | 13 #include "components/metrics/client_info.h" |
14 #include "components/metrics/gpu/gpu_metrics_provider.h" | 14 #include "components/metrics/gpu/gpu_metrics_provider.h" |
15 #include "components/metrics/metrics_provider.h" | 15 #include "components/metrics/metrics_provider.h" |
16 #include "components/metrics/metrics_service.h" | 16 #include "components/metrics/metrics_service.h" |
17 #include "components/metrics/metrics_state_manager.h" | 17 #include "components/metrics/metrics_state_manager.h" |
18 #include "components/metrics/net/net_metrics_log_uploader.h" | 18 #include "components/metrics/net/net_metrics_log_uploader.h" |
19 #include "components/metrics/net/network_metrics_provider.h" | 19 #include "components/metrics/net/network_metrics_provider.h" |
20 #include "components/metrics/profiler/profiler_metrics_provider.h" | 20 #include "components/metrics/profiler/profiler_metrics_provider.h" |
| 21 #include "content/public/common/content_switches.h" |
21 | 22 |
22 #if defined(OS_LINUX) | 23 #if defined(OS_LINUX) |
23 #include "chromecast/browser/metrics/external_metrics.h" | 24 #include "chromecast/browser/metrics/external_metrics.h" |
24 #endif // defined(OS_LINUX) | 25 #endif // defined(OS_LINUX) |
25 | 26 |
26 namespace chromecast { | 27 namespace chromecast { |
27 namespace metrics { | 28 namespace metrics { |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // sending reports as directed by the user. | 154 // sending reports as directed by the user. |
154 // For Setup (which also communicates the user's opt-in preferences), | 155 // For Setup (which also communicates the user's opt-in preferences), |
155 // report the client-id and expect that setup will handle the current opt-in | 156 // report the client-id and expect that setup will handle the current opt-in |
156 // value. | 157 // value. |
157 metrics_state_manager_->ForceClientIdCreation(); | 158 metrics_state_manager_->ForceClientIdCreation(); |
158 | 159 |
159 CastStabilityMetricsProvider* stability_provider = | 160 CastStabilityMetricsProvider* stability_provider = |
160 new CastStabilityMetricsProvider(metrics_service_.get()); | 161 new CastStabilityMetricsProvider(metrics_service_.get()); |
161 metrics_service_->RegisterMetricsProvider( | 162 metrics_service_->RegisterMetricsProvider( |
162 scoped_ptr< ::metrics::MetricsProvider>(stability_provider)); | 163 scoped_ptr< ::metrics::MetricsProvider>(stability_provider)); |
163 metrics_service_->RegisterMetricsProvider( | 164 |
164 scoped_ptr< ::metrics::MetricsProvider>( | 165 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
165 new ::metrics::GPUMetricsProvider)); | 166 if (!command_line->HasSwitch(switches::kDisableGpu)) { |
| 167 metrics_service_->RegisterMetricsProvider( |
| 168 scoped_ptr< ::metrics::MetricsProvider>( |
| 169 new ::metrics::GPUMetricsProvider)); |
| 170 } |
166 metrics_service_->RegisterMetricsProvider( | 171 metrics_service_->RegisterMetricsProvider( |
167 scoped_ptr< ::metrics::MetricsProvider>( | 172 scoped_ptr< ::metrics::MetricsProvider>( |
168 new ::metrics::NetworkMetricsProvider(io_task_runner))); | 173 new ::metrics::NetworkMetricsProvider(io_task_runner))); |
169 metrics_service_->RegisterMetricsProvider( | 174 metrics_service_->RegisterMetricsProvider( |
170 scoped_ptr< ::metrics::MetricsProvider>( | 175 scoped_ptr< ::metrics::MetricsProvider>( |
171 new ::metrics::ProfilerMetricsProvider)); | 176 new ::metrics::ProfilerMetricsProvider)); |
172 RegisterPlatformMetricsProviders(metrics_service_.get()); | 177 RegisterPlatformMetricsProviders(metrics_service_.get()); |
173 | 178 |
174 metrics_service_->InitializeMetricsRecordingState(); | 179 metrics_service_->InitializeMetricsRecordingState(); |
175 | 180 |
(...skipping 10 matching lines...) Expand all Loading... |
186 | 191 |
187 CastMetricsServiceClient::~CastMetricsServiceClient() { | 192 CastMetricsServiceClient::~CastMetricsServiceClient() { |
188 } | 193 } |
189 | 194 |
190 bool CastMetricsServiceClient::IsReportingEnabled() { | 195 bool CastMetricsServiceClient::IsReportingEnabled() { |
191 return PlatformIsReportingEnabled(); | 196 return PlatformIsReportingEnabled(); |
192 } | 197 } |
193 | 198 |
194 } // namespace metrics | 199 } // namespace metrics |
195 } // namespace chromecast | 200 } // namespace chromecast |
OLD | NEW |