Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Side by Side Diff: chromecast/browser/metrics/cast_metrics_service_client.cc

Issue 845003002: [chromecast] ExternalMetrics has to destroy itself in file thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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)
lcwu1 2015/01/10 00:36:39 In our case, !OS_ANDROID is equal to OS_LINUX, so
gunsch 2015/01/10 00:42:23 I'd prefer not---RecordCompletedSessionEnd is actu
gfhuang 2015/01/10 00:58:30 Acknowledged.
256 external_metrics_.release()->StopAndSelfDestroy();
gunsch 2015/01/10 00:31:46 Thought: this mechanic is sort of strange. I think
gfhuang 2015/01/10 00:58:30 Done.
gfhuang 2015/01/10 01:17:30 Note that I have to revert back to use PostTask in
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
OLDNEW
« no previous file with comments | « no previous file | chromecast/browser/metrics/external_metrics.h » ('j') | chromecast/browser/metrics/external_metrics.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698