| 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 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 // (and that we don't use some alternate path, and not call LogCleanShutdown). | 1385 // (and that we don't use some alternate path, and not call LogCleanShutdown). |
| 1386 clean_shutdown_status_ = CLEANLY_SHUTDOWN; | 1386 clean_shutdown_status_ = CLEANLY_SHUTDOWN; |
| 1387 | 1387 |
| 1388 RecordBooleanPrefValue(prefs::kStabilityExitedCleanly, true); | 1388 RecordBooleanPrefValue(prefs::kStabilityExitedCleanly, true); |
| 1389 local_state_->SetInteger(prefs::kStabilityExecutionPhase, | 1389 local_state_->SetInteger(prefs::kStabilityExecutionPhase, |
| 1390 MetricsService::SHUTDOWN_COMPLETE); | 1390 MetricsService::SHUTDOWN_COMPLETE); |
| 1391 } | 1391 } |
| 1392 | 1392 |
| 1393 void MetricsService::LogPluginLoadingError(const base::FilePath& plugin_path) { | 1393 void MetricsService::LogPluginLoadingError(const base::FilePath& plugin_path) { |
| 1394 #if defined(ENABLE_PLUGINS) | 1394 #if defined(ENABLE_PLUGINS) |
| 1395 // TODO(asvitkine): Move this out of here. | |
| 1396 plugin_metrics_provider_->LogPluginLoadingError(plugin_path); | 1395 plugin_metrics_provider_->LogPluginLoadingError(plugin_path); |
| 1397 #endif | 1396 #endif |
| 1398 } | 1397 } |
| 1399 | 1398 |
| 1400 bool MetricsService::ShouldLogEvents() { | 1399 bool MetricsService::ShouldLogEvents() { |
| 1401 // We simply don't log events to UMA if there is a single incognito | 1400 // We simply don't log events to UMA if there is a single incognito |
| 1402 // session visible. The problem is that we always notify using the orginal | 1401 // session visible. The problem is that we always notify using the orginal |
| 1403 // profile in order to simplify notification processing. | 1402 // profile in order to simplify notification processing. |
| 1404 return !client_->IsOffTheRecordSessionActive(); | 1403 return !client_->IsOffTheRecordSessionActive(); |
| 1405 } | 1404 } |
| 1406 | 1405 |
| 1407 void MetricsService::RecordBooleanPrefValue(const char* path, bool value) { | 1406 void MetricsService::RecordBooleanPrefValue(const char* path, bool value) { |
| 1408 DCHECK(IsSingleThreaded()); | 1407 DCHECK(IsSingleThreaded()); |
| 1409 local_state_->SetBoolean(path, value); | 1408 local_state_->SetBoolean(path, value); |
| 1410 RecordCurrentState(local_state_); | 1409 RecordCurrentState(local_state_); |
| 1411 } | 1410 } |
| 1412 | 1411 |
| 1413 void MetricsService::RecordCurrentState(PrefService* pref) { | 1412 void MetricsService::RecordCurrentState(PrefService* pref) { |
| 1414 pref->SetInt64(prefs::kStabilityLastTimestampSec, Time::Now().ToTimeT()); | 1413 pref->SetInt64(prefs::kStabilityLastTimestampSec, Time::Now().ToTimeT()); |
| 1415 | 1414 |
| 1416 #if defined(ENABLE_PLUGINS) | 1415 for (size_t i = 0; i < metrics_providers_.size(); ++i) |
| 1417 plugin_metrics_provider_->RecordPluginChanges(); | 1416 metrics_providers_[i]->RecordCurrentState(); |
| 1418 #endif | |
| 1419 } | 1417 } |
| OLD | NEW |