| 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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 | 793 |
| 794 log_manager_.BeginLoggingWithLog(new MetricsLog(client_id_, session_id_)); | 794 log_manager_.BeginLoggingWithLog(new MetricsLog(client_id_, session_id_)); |
| 795 if (state_ == INITIALIZED) { | 795 if (state_ == INITIALIZED) { |
| 796 // We only need to schedule that run once. | 796 // We only need to schedule that run once. |
| 797 state_ = INIT_TASK_SCHEDULED; | 797 state_ = INIT_TASK_SCHEDULED; |
| 798 | 798 |
| 799 // Schedules a task on the file thread for execution of slower | 799 // Schedules a task on the file thread for execution of slower |
| 800 // initialization steps (such as plugin list generation) necessary | 800 // initialization steps (such as plugin list generation) necessary |
| 801 // for sending the initial log. This avoids blocking the main UI | 801 // for sending the initial log. This avoids blocking the main UI |
| 802 // thread. | 802 // thread. |
| 803 g_browser_process->file_thread()->message_loop()->PostDelayedTask(FROM_HERE, | 803 BrowserThread::PostDelayedTask( |
| 804 BrowserThread::FILE, |
| 805 FROM_HERE, |
| 804 base::Bind(&MetricsService::InitTaskGetHardwareClass, | 806 base::Bind(&MetricsService::InitTaskGetHardwareClass, |
| 805 base::Unretained(this), | 807 base::Unretained(this), |
| 806 MessageLoop::current()->message_loop_proxy()), | 808 MessageLoop::current()->message_loop_proxy()), |
| 807 kInitializationDelaySeconds * 1000); | 809 kInitializationDelaySeconds * 1000); |
| 808 } | 810 } |
| 809 } | 811 } |
| 810 | 812 |
| 811 void MetricsService::StopRecording() { | 813 void MetricsService::StopRecording() { |
| 812 if (!log_manager_.current_log()) | 814 if (!log_manager_.current_log()) |
| 813 return; | 815 return; |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1552 if (local_state) { | 1554 if (local_state) { |
| 1553 const PrefService::Preference* uma_pref = | 1555 const PrefService::Preference* uma_pref = |
| 1554 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1556 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 1555 if (uma_pref) { | 1557 if (uma_pref) { |
| 1556 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1558 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 1557 DCHECK(success); | 1559 DCHECK(success); |
| 1558 } | 1560 } |
| 1559 } | 1561 } |
| 1560 return result; | 1562 return result; |
| 1561 } | 1563 } |
| OLD | NEW |