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