| 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 typically created at application startup. It | 10 // A MetricsService instance is typically created at application startup. It |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 SetRecording(true); | 464 SetRecording(true); |
| 465 SetReporting(false); | 465 SetReporting(false); |
| 466 } | 466 } |
| 467 | 467 |
| 468 void MetricsService::Stop() { | 468 void MetricsService::Stop() { |
| 469 HandleIdleSinceLastTransmission(false); | 469 HandleIdleSinceLastTransmission(false); |
| 470 SetReporting(false); | 470 SetReporting(false); |
| 471 SetRecording(false); | 471 SetRecording(false); |
| 472 } | 472 } |
| 473 | 473 |
| 474 std::string MetricsService::GetClientId() { |
| 475 return client_id_; |
| 476 } |
| 477 |
| 474 void MetricsService::SetRecording(bool enabled) { | 478 void MetricsService::SetRecording(bool enabled) { |
| 475 DCHECK(IsSingleThreaded()); | 479 DCHECK(IsSingleThreaded()); |
| 476 | 480 |
| 477 if (enabled == recording_active_) | 481 if (enabled == recording_active_) |
| 478 return; | 482 return; |
| 479 | 483 |
| 480 if (enabled) { | 484 if (enabled) { |
| 481 if (client_id_.empty()) { | 485 if (client_id_.empty()) { |
| 482 PrefService* pref = g_browser_process->local_state(); | 486 PrefService* pref = g_browser_process->local_state(); |
| 483 DCHECK(pref); | 487 DCHECK(pref); |
| (...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 thread_id = base::PlatformThread::CurrentId(); | 1689 thread_id = base::PlatformThread::CurrentId(); |
| 1686 return base::PlatformThread::CurrentId() == thread_id; | 1690 return base::PlatformThread::CurrentId() == thread_id; |
| 1687 } | 1691 } |
| 1688 | 1692 |
| 1689 #if defined(OS_CHROMEOS) | 1693 #if defined(OS_CHROMEOS) |
| 1690 void MetricsService::StartExternalMetrics() { | 1694 void MetricsService::StartExternalMetrics() { |
| 1691 external_metrics_ = new chromeos::ExternalMetrics; | 1695 external_metrics_ = new chromeos::ExternalMetrics; |
| 1692 external_metrics_->Start(); | 1696 external_metrics_->Start(); |
| 1693 } | 1697 } |
| 1694 #endif | 1698 #endif |
| OLD | NEW |