| 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/guid.h" | 8 #include "base/guid.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 external_metrics_.reset(new ExternalMetrics(stability_provider)); | 243 external_metrics_.reset(new ExternalMetrics(stability_provider)); |
| 244 external_metrics_->Start(); | 244 external_metrics_->Start(); |
| 245 #endif // defined(OS_LINUX) | 245 #endif // defined(OS_LINUX) |
| 246 } | 246 } |
| 247 | 247 |
| 248 void CastMetricsServiceClient::Finalize() { | 248 void CastMetricsServiceClient::Finalize() { |
| 249 #if !defined(OS_ANDROID) | 249 #if !defined(OS_ANDROID) |
| 250 // Set clean_shutdown bit. | 250 // Set clean_shutdown bit. |
| 251 metrics_service_->RecordCompletedSessionEnd(); | 251 metrics_service_->RecordCompletedSessionEnd(); |
| 252 #endif // !defined(OS_ANDROID) | 252 #endif // !defined(OS_ANDROID) |
| 253 |
| 254 // Stop metrics service cleanly before destructing CastMetricsServiceClient. |
| 255 #if defined(OS_LINUX) |
| 256 external_metrics_.release()->DestroySelf(); |
| 257 #endif // defined(OS_LINUX) |
| 258 metrics_service_->Stop(); |
| 253 } | 259 } |
| 254 | 260 |
| 255 bool CastMetricsServiceClient::IsReportingEnabled() { | 261 bool CastMetricsServiceClient::IsReportingEnabled() { |
| 256 return PlatformIsReportingEnabled(cast_service_); | 262 return PlatformIsReportingEnabled(cast_service_); |
| 257 } | 263 } |
| 258 | 264 |
| 259 } // namespace metrics | 265 } // namespace metrics |
| 260 } // namespace chromecast | 266 } // namespace chromecast |
| OLD | NEW |