| 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 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
| 6 // Description of the life cycle of a instance of MetricsService. | 6 // Description of the life cycle of a instance of MetricsService. |
| 7 // | 7 // |
| 8 // OVERVIEW | 8 // OVERVIEW |
| 9 // | 9 // |
| 10 // A MetricsService instance is created at ChromeFrame startup in | 10 // A MetricsService instance is created at ChromeFrame startup in |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // Default to one UMA upload per 10 mins. | 78 // Default to one UMA upload per 10 mins. |
| 79 static const int kMinMilliSecondsPerUMAUpload = 600000; | 79 static const int kMinMilliSecondsPerUMAUpload = 600000; |
| 80 | 80 |
| 81 base::LazyInstance<base::ThreadLocalPointer<MetricsService> > | 81 base::LazyInstance<base::ThreadLocalPointer<MetricsService> > |
| 82 MetricsService::g_metrics_instance_ = LAZY_INSTANCE_INITIALIZER; | 82 MetricsService::g_metrics_instance_ = LAZY_INSTANCE_INITIALIZER; |
| 83 | 83 |
| 84 std::string MetricsService::client_id_; | 84 std::string MetricsService::client_id_; |
| 85 | 85 |
| 86 base::Lock MetricsService::metrics_service_lock_; | 86 base::Lock MetricsService::metrics_service_lock_; |
| 87 | 87 |
| 88 // Initialize histogram statistics gathering system. | |
| 89 base::LazyInstance<base::StatisticsRecorder> | |
| 90 g_statistics_recorder_ = LAZY_INSTANCE_INITIALIZER; | |
| 91 | |
| 92 // This class provides functionality to upload the ChromeFrame UMA data to the | 88 // This class provides functionality to upload the ChromeFrame UMA data to the |
| 93 // server. An instance of this class is created whenever we have data to be | 89 // server. An instance of this class is created whenever we have data to be |
| 94 // uploaded to the server. | 90 // uploaded to the server. |
| 95 class ChromeFrameMetricsDataUploader : public BSCBImpl { | 91 class ChromeFrameMetricsDataUploader : public BSCBImpl { |
| 96 public: | 92 public: |
| 97 ChromeFrameMetricsDataUploader() | 93 ChromeFrameMetricsDataUploader() |
| 98 : cache_stream_(NULL), | 94 : cache_stream_(NULL), |
| 99 upload_data_size_(0) { | 95 upload_data_size_(0) { |
| 100 DVLOG(1) << __FUNCTION__; | 96 DVLOG(1) << __FUNCTION__; |
| 101 } | 97 } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 void MetricsService::InitializeMetricsState() { | 260 void MetricsService::InitializeMetricsState() { |
| 265 DCHECK(state_ == INITIALIZED); | 261 DCHECK(state_ == INITIALIZED); |
| 266 | 262 |
| 267 thread_ = base::PlatformThread::CurrentId(); | 263 thread_ = base::PlatformThread::CurrentId(); |
| 268 | 264 |
| 269 user_permits_upload_ = GoogleUpdateSettings::GetCollectStatsConsent(); | 265 user_permits_upload_ = GoogleUpdateSettings::GetCollectStatsConsent(); |
| 270 // Update session ID | 266 // Update session ID |
| 271 session_id_ = CrashMetricsReporter::GetInstance()->IncrementMetric( | 267 session_id_ = CrashMetricsReporter::GetInstance()->IncrementMetric( |
| 272 CrashMetricsReporter::SESSION_ID); | 268 CrashMetricsReporter::SESSION_ID); |
| 273 | 269 |
| 274 // Ensure that an instance of the StatisticsRecorder object is created. | 270 base::StatisticsRecorder::Initialize(); |
| 275 g_statistics_recorder_.Get(); | |
| 276 CrashMetricsReporter::GetInstance()->set_active(true); | 271 CrashMetricsReporter::GetInstance()->set_active(true); |
| 277 } | 272 } |
| 278 | 273 |
| 279 // static | 274 // static |
| 280 void MetricsService::Start() { | 275 void MetricsService::Start() { |
| 281 base::AutoLock lock(metrics_service_lock_); | 276 base::AutoLock lock(metrics_service_lock_); |
| 282 | 277 |
| 283 if (GetInstance()->state_ == ACTIVE) | 278 if (GetInstance()->state_ == ACTIVE) |
| 284 return; | 279 return; |
| 285 | 280 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 version += "-F"; | 462 version += "-F"; |
| 468 if (!version_info.IsOfficialBuild()) | 463 if (!version_info.IsOfficialBuild()) |
| 469 version.append("-devel"); | 464 version.append("-devel"); |
| 470 return version; | 465 return version; |
| 471 } else { | 466 } else { |
| 472 NOTREACHED() << "Unable to retrieve version string."; | 467 NOTREACHED() << "Unable to retrieve version string."; |
| 473 } | 468 } |
| 474 | 469 |
| 475 return std::string(); | 470 return std::string(); |
| 476 } | 471 } |
| OLD | NEW |