| 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 is | 10 // A MetricsService instance is typically created at application startup. It is |
| (...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1225 // RecordIncrementalStabilityElements only exists on the derived | 1225 // RecordIncrementalStabilityElements only exists on the derived |
| 1226 // MetricsLog class. | 1226 // MetricsLog class. |
| 1227 MetricsLog* current_log = | 1227 MetricsLog* current_log = |
| 1228 static_cast<MetricsLog*>(log_manager_.current_log()); | 1228 static_cast<MetricsLog*>(log_manager_.current_log()); |
| 1229 DCHECK(current_log); | 1229 DCHECK(current_log); |
| 1230 std::vector<chrome_variations::ActiveGroupId> synthetic_trials; | 1230 std::vector<chrome_variations::ActiveGroupId> synthetic_trials; |
| 1231 GetCurrentSyntheticFieldTrials(&synthetic_trials); | 1231 GetCurrentSyntheticFieldTrials(&synthetic_trials); |
| 1232 current_log->RecordEnvironment(plugins_, google_update_metrics_, | 1232 current_log->RecordEnvironment(plugins_, google_update_metrics_, |
| 1233 synthetic_trials); | 1233 synthetic_trials); |
| 1234 PrefService* pref = g_browser_process->local_state(); | 1234 PrefService* pref = g_browser_process->local_state(); |
| 1235 current_log->RecordStabilityMetrics(plugins_, GetIncrementalUptime(pref), | 1235 current_log->RecordStabilityMetrics(GetIncrementalUptime(pref), |
| 1236 MetricsLog::ONGOING_LOG); | 1236 MetricsLog::ONGOING_LOG); |
| 1237 | 1237 |
| 1238 RecordCurrentHistograms(); | 1238 RecordCurrentHistograms(); |
| 1239 | 1239 |
| 1240 log_manager_.FinishCurrentLog(); | 1240 log_manager_.FinishCurrentLog(); |
| 1241 } | 1241 } |
| 1242 | 1242 |
| 1243 void MetricsService::PushPendingLogsToPersistentStorage() { | 1243 void MetricsService::PushPendingLogsToPersistentStorage() { |
| 1244 if (state_ < INITIAL_LOG_READY) | 1244 if (state_ < INITIAL_LOG_READY) |
| 1245 return; // We didn't and still don't have time to get plugin list etc. | 1245 return; // We didn't and still don't have time to get plugin list etc. |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 DCHECK_EQ(INIT_TASK_DONE, state_); | 1466 DCHECK_EQ(INIT_TASK_DONE, state_); |
| 1467 | 1467 |
| 1468 DCHECK(initial_log_.get()); | 1468 DCHECK(initial_log_.get()); |
| 1469 initial_log_->set_hardware_class(hardware_class_); | 1469 initial_log_->set_hardware_class(hardware_class_); |
| 1470 | 1470 |
| 1471 std::vector<chrome_variations::ActiveGroupId> synthetic_trials; | 1471 std::vector<chrome_variations::ActiveGroupId> synthetic_trials; |
| 1472 GetCurrentSyntheticFieldTrials(&synthetic_trials); | 1472 GetCurrentSyntheticFieldTrials(&synthetic_trials); |
| 1473 initial_log_->RecordEnvironment(plugins_, google_update_metrics_, | 1473 initial_log_->RecordEnvironment(plugins_, google_update_metrics_, |
| 1474 synthetic_trials); | 1474 synthetic_trials); |
| 1475 PrefService* pref = g_browser_process->local_state(); | 1475 PrefService* pref = g_browser_process->local_state(); |
| 1476 initial_log_->RecordStabilityMetrics(plugins_, GetIncrementalUptime(pref), | 1476 initial_log_->RecordStabilityMetrics(GetIncrementalUptime(pref), |
| 1477 MetricsLog::INITIAL_LOG); | 1477 MetricsLog::INITIAL_LOG); |
| 1478 | 1478 |
| 1479 // Histograms only get written to the current log, so make the new log current | 1479 // Histograms only get written to the current log, so make the new log current |
| 1480 // before writing them. | 1480 // before writing them. |
| 1481 log_manager_.PauseCurrentLog(); | 1481 log_manager_.PauseCurrentLog(); |
| 1482 log_manager_.BeginLoggingWithLog(initial_log_.release(), | 1482 log_manager_.BeginLoggingWithLog(initial_log_.release(), |
| 1483 MetricsLog::INITIAL_LOG); | 1483 MetricsLog::INITIAL_LOG); |
| 1484 RecordCurrentHistograms(); | 1484 RecordCurrentHistograms(); |
| 1485 log_manager_.FinishCurrentLog(); | 1485 log_manager_.FinishCurrentLog(); |
| 1486 log_manager_.ResumePausedLog(); | 1486 log_manager_.ResumePausedLog(); |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1926 if (local_state) { | 1926 if (local_state) { |
| 1927 const PrefService::Preference* uma_pref = | 1927 const PrefService::Preference* uma_pref = |
| 1928 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1928 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 1929 if (uma_pref) { | 1929 if (uma_pref) { |
| 1930 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1930 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 1931 DCHECK(success); | 1931 DCHECK(success); |
| 1932 } | 1932 } |
| 1933 } | 1933 } |
| 1934 return result; | 1934 return result; |
| 1935 } | 1935 } |
| OLD | NEW |