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 | |
478 void MetricsService::SetRecording(bool enabled) { | 474 void MetricsService::SetRecording(bool enabled) { |
479 DCHECK(IsSingleThreaded()); | 475 DCHECK(IsSingleThreaded()); |
480 | 476 |
481 if (enabled == recording_active_) | 477 if (enabled == recording_active_) |
482 return; | 478 return; |
483 | 479 |
484 if (enabled) { | 480 if (enabled) { |
485 if (client_id_.empty()) { | 481 if (client_id_.empty()) { |
486 PrefService* pref = g_browser_process->local_state(); | 482 PrefService* pref = g_browser_process->local_state(); |
487 DCHECK(pref); | 483 DCHECK(pref); |
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 thread_id = base::PlatformThread::CurrentId(); | 1685 thread_id = base::PlatformThread::CurrentId(); |
1690 return base::PlatformThread::CurrentId() == thread_id; | 1686 return base::PlatformThread::CurrentId() == thread_id; |
1691 } | 1687 } |
1692 | 1688 |
1693 #if defined(OS_CHROMEOS) | 1689 #if defined(OS_CHROMEOS) |
1694 void MetricsService::StartExternalMetrics() { | 1690 void MetricsService::StartExternalMetrics() { |
1695 external_metrics_ = new chromeos::ExternalMetrics; | 1691 external_metrics_ = new chromeos::ExternalMetrics; |
1696 external_metrics_->Start(); | 1692 external_metrics_->Start(); |
1697 } | 1693 } |
1698 #endif | 1694 #endif |
OLD | NEW |