| 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 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 // (and that we don't use some alternate path, and not call LogCleanShutdown). | 1298 // (and that we don't use some alternate path, and not call LogCleanShutdown). |
| 1299 clean_shutdown_status_ = CLEANLY_SHUTDOWN; | 1299 clean_shutdown_status_ = CLEANLY_SHUTDOWN; |
| 1300 | 1300 |
| 1301 RecordBooleanPrefValue(prefs::kStabilityExitedCleanly, true); | 1301 RecordBooleanPrefValue(prefs::kStabilityExitedCleanly, true); |
| 1302 local_state_->SetInteger(prefs::kStabilityExecutionPhase, | 1302 local_state_->SetInteger(prefs::kStabilityExecutionPhase, |
| 1303 MetricsService::SHUTDOWN_COMPLETE); | 1303 MetricsService::SHUTDOWN_COMPLETE); |
| 1304 } | 1304 } |
| 1305 | 1305 |
| 1306 void MetricsService::LogPluginLoadingError(const base::FilePath& plugin_path) { | 1306 void MetricsService::LogPluginLoadingError(const base::FilePath& plugin_path) { |
| 1307 #if defined(ENABLE_PLUGINS) | 1307 #if defined(ENABLE_PLUGINS) |
| 1308 // TODO(asvitkine): Move this out of here. | |
| 1309 plugin_metrics_provider_->LogPluginLoadingError(plugin_path); | 1308 plugin_metrics_provider_->LogPluginLoadingError(plugin_path); |
| 1310 #endif | 1309 #endif |
| 1311 } | 1310 } |
| 1312 | 1311 |
| 1313 bool MetricsService::ShouldLogEvents() { | 1312 bool MetricsService::ShouldLogEvents() { |
| 1314 // We simply don't log events to UMA if there is a single incognito | 1313 // We simply don't log events to UMA if there is a single incognito |
| 1315 // session visible. The problem is that we always notify using the orginal | 1314 // session visible. The problem is that we always notify using the orginal |
| 1316 // profile in order to simplify notification processing. | 1315 // profile in order to simplify notification processing. |
| 1317 return !client_->IsOffTheRecordSessionActive(); | 1316 return !client_->IsOffTheRecordSessionActive(); |
| 1318 } | 1317 } |
| 1319 | 1318 |
| 1320 void MetricsService::RecordBooleanPrefValue(const char* path, bool value) { | 1319 void MetricsService::RecordBooleanPrefValue(const char* path, bool value) { |
| 1321 DCHECK(IsSingleThreaded()); | 1320 DCHECK(IsSingleThreaded()); |
| 1322 local_state_->SetBoolean(path, value); | 1321 local_state_->SetBoolean(path, value); |
| 1323 RecordCurrentState(local_state_); | 1322 RecordCurrentState(local_state_); |
| 1324 } | 1323 } |
| 1325 | 1324 |
| 1326 void MetricsService::RecordCurrentState(PrefService* pref) { | 1325 void MetricsService::RecordCurrentState(PrefService* pref) { |
| 1327 pref->SetInt64(prefs::kStabilityLastTimestampSec, Time::Now().ToTimeT()); | 1326 pref->SetInt64(prefs::kStabilityLastTimestampSec, Time::Now().ToTimeT()); |
| 1328 | 1327 |
| 1329 #if defined(ENABLE_PLUGINS) | 1328 for (size_t i = 0; i < metrics_providers_.size(); ++i) |
| 1330 plugin_metrics_provider_->RecordPluginChanges(); | 1329 metrics_providers_[i]->RecordCurrentState(); |
| 1331 #endif | |
| 1332 } | 1330 } |
| OLD | NEW |