| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 static const int kInitialUMAUploadTimeoutMilliSeconds = 30000; | 74 static const int kInitialUMAUploadTimeoutMilliSeconds = 30000; |
| 75 | 75 |
| 76 // Default to one UMA upload per 10 mins. | 76 // Default to one UMA upload per 10 mins. |
| 77 static const int kMinMilliSecondsPerUMAUpload = 600000; | 77 static const int kMinMilliSecondsPerUMAUpload = 600000; |
| 78 | 78 |
| 79 base::LazyInstance<base::ThreadLocalPointer<MetricsService> > | 79 base::LazyInstance<base::ThreadLocalPointer<MetricsService> > |
| 80 MetricsService::g_metrics_instance_(base::LINKER_INITIALIZED); | 80 MetricsService::g_metrics_instance_(base::LINKER_INITIALIZED); |
| 81 | 81 |
| 82 base::Lock MetricsService::metrics_service_lock_; | 82 base::Lock MetricsService::metrics_service_lock_; |
| 83 | 83 |
| 84 extern base::LazyInstance<base::StatisticsRecorder> g_statistics_recorder_; | |
| 85 | |
| 86 // This class provides functionality to upload the ChromeFrame UMA data to the | 84 // This class provides functionality to upload the ChromeFrame UMA data to the |
| 87 // server. An instance of this class is created whenever we have data to be | 85 // server. An instance of this class is created whenever we have data to be |
| 88 // uploaded to the server. | 86 // uploaded to the server. |
| 89 class ChromeFrameMetricsDataUploader : public BSCBImpl { | 87 class ChromeFrameMetricsDataUploader : public BSCBImpl { |
| 90 public: | 88 public: |
| 91 ChromeFrameMetricsDataUploader() | 89 ChromeFrameMetricsDataUploader() |
| 92 : cache_stream_(NULL), | 90 : cache_stream_(NULL), |
| 93 upload_data_size_(0) { | 91 upload_data_size_(0) { |
| 94 DVLOG(1) << __FUNCTION__; | 92 DVLOG(1) << __FUNCTION__; |
| 95 } | 93 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 DCHECK(state_ == INITIALIZED); | 260 DCHECK(state_ == INITIALIZED); |
| 263 | 261 |
| 264 thread_ = base::PlatformThread::CurrentId(); | 262 thread_ = base::PlatformThread::CurrentId(); |
| 265 | 263 |
| 266 user_permits_upload_ = GoogleUpdateSettings::GetCollectStatsConsent(); | 264 user_permits_upload_ = GoogleUpdateSettings::GetCollectStatsConsent(); |
| 267 // Update session ID | 265 // Update session ID |
| 268 session_id_ = CrashMetricsReporter::GetInstance()->IncrementMetric( | 266 session_id_ = CrashMetricsReporter::GetInstance()->IncrementMetric( |
| 269 CrashMetricsReporter::SESSION_ID); | 267 CrashMetricsReporter::SESSION_ID); |
| 270 | 268 |
| 271 // Ensure that an instance of the StatisticsRecorder object is created. | 269 // Ensure that an instance of the StatisticsRecorder object is created. |
| 272 g_statistics_recorder_.Get(); | |
| 273 CrashMetricsReporter::GetInstance()->set_active(true); | 270 CrashMetricsReporter::GetInstance()->set_active(true); |
| 274 } | 271 } |
| 275 | 272 |
| 276 // static | 273 // static |
| 277 void MetricsService::Start() { | 274 void MetricsService::Start() { |
| 278 base::AutoLock lock(metrics_service_lock_); | 275 base::AutoLock lock(metrics_service_lock_); |
| 279 | 276 |
| 280 if (GetInstance()->state_ == ACTIVE) | 277 if (GetInstance()->state_ == ACTIVE) |
| 281 return; | 278 return; |
| 282 | 279 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 version += "-F"; | 480 version += "-F"; |
| 484 if (!version_info.IsOfficialBuild()) | 481 if (!version_info.IsOfficialBuild()) |
| 485 version.append("-devel"); | 482 version.append("-devel"); |
| 486 return version; | 483 return version; |
| 487 } else { | 484 } else { |
| 488 NOTREACHED() << "Unable to retrieve version string."; | 485 NOTREACHED() << "Unable to retrieve version string."; |
| 489 } | 486 } |
| 490 | 487 |
| 491 return std::string(); | 488 return std::string(); |
| 492 } | 489 } |
| OLD | NEW |