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 typically created at application startup. It | 10 // A MetricsService instance is typically created at application startup. It |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
757 // static | 757 // static |
758 void MetricsService::InitTaskGetHardwareClass( | 758 void MetricsService::InitTaskGetHardwareClass( |
759 base::WeakPtr<MetricsService> self, | 759 base::WeakPtr<MetricsService> self, |
760 base::MessageLoopProxy* target_loop) { | 760 base::MessageLoopProxy* target_loop) { |
761 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 761 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
762 | 762 |
763 std::string hardware_class; | 763 std::string hardware_class; |
764 #if defined(OS_CHROMEOS) | 764 #if defined(OS_CHROMEOS) |
765 chromeos::system::StatisticsProvider::GetInstance()->GetMachineStatistic( | 765 chromeos::system::StatisticsProvider::GetInstance()->GetMachineStatistic( |
766 "hardware_class", &hardware_class); | 766 "hardware_class", &hardware_class); |
767 if (hardware_class.empty()) | |
petkov
2012/04/23 09:34:06
You could use LOG_IF instead.
Joao da Silva
2012/04/23 09:50:06
Another CL (http://codereview.chromium.org/1007801
| |
768 LOG(ERROR) << "Got an empty hardware_class!"; | |
767 #endif // OS_CHROMEOS | 769 #endif // OS_CHROMEOS |
768 | 770 |
769 target_loop->PostTask(FROM_HERE, | 771 target_loop->PostTask(FROM_HERE, |
770 base::Bind(&MetricsService::OnInitTaskGotHardwareClass, | 772 base::Bind(&MetricsService::OnInitTaskGotHardwareClass, |
771 self, hardware_class)); | 773 self, hardware_class)); |
772 } | 774 } |
773 | 775 |
774 void MetricsService::OnInitTaskGotHardwareClass( | 776 void MetricsService::OnInitTaskGotHardwareClass( |
775 const std::string& hardware_class) { | 777 const std::string& hardware_class) { |
776 DCHECK_EQ(state_, INIT_TASK_SCHEDULED); | 778 DCHECK_EQ(state_, INIT_TASK_SCHEDULED); |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1670 if (local_state) { | 1672 if (local_state) { |
1671 const PrefService::Preference* uma_pref = | 1673 const PrefService::Preference* uma_pref = |
1672 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1674 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
1673 if (uma_pref) { | 1675 if (uma_pref) { |
1674 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1676 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
1675 DCHECK(success); | 1677 DCHECK(success); |
1676 } | 1678 } |
1677 } | 1679 } |
1678 return result; | 1680 return result; |
1679 } | 1681 } |
OLD | NEW |