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

Unified Diff: chrome_frame/metrics_service.cc

Issue 5519007: Fix a race in the ChromeFrame metrics service start up code. This race could ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome_frame/metrics_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/metrics_service.cc
===================================================================
--- chrome_frame/metrics_service.cc (revision 68089)
+++ chrome_frame/metrics_service.cc (working copy)
@@ -97,6 +97,8 @@
base::LazyInstance<MetricsService>
g_metrics_instance_(base::LINKER_INITIALIZED);
+Lock MetricsService::metrics_service_lock_;
+
// Traits to create an instance of the ChromeFrame upload thread.
struct UploadThreadInstanceTraits
: public base::LeakyLazyInstanceTraits<base::Thread> {
@@ -378,6 +380,7 @@
thread_ = PlatformThread::CurrentId();
user_permits_upload_ = GoogleUpdateSettings::GetCollectStatsConsent();
+ user_permits_upload_ = true;
// Update session ID
session_id_ = CrashMetricsReporter::GetInstance()->IncrementMetric(
CrashMetricsReporter::SESSION_ID);
@@ -395,6 +398,8 @@
// static
void MetricsService::Start() {
+ AutoLock lock(metrics_service_lock_);
+
if (GetInstance()->state_ == ACTIVE)
return;
@@ -405,6 +410,8 @@
// static
void MetricsService::Stop() {
+ AutoLock lock(metrics_service_lock_);
+
GetInstance()->SetReporting(false);
GetInstance()->SetRecording(false);
}
« no previous file with comments | « chrome_frame/metrics_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698