| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 // process is killed. | 511 // process is killed. |
| 512 OpenNewLog(); | 512 OpenNewLog(); |
| 513 } | 513 } |
| 514 } | 514 } |
| 515 | 515 |
| 516 void MetricsService::OnAppEnterForeground() { | 516 void MetricsService::OnAppEnterForeground() { |
| 517 local_state_->SetBoolean(metrics::prefs::kStabilityExitedCleanly, false); | 517 local_state_->SetBoolean(metrics::prefs::kStabilityExitedCleanly, false); |
| 518 StartSchedulerIfNecessary(); | 518 StartSchedulerIfNecessary(); |
| 519 } | 519 } |
| 520 #else | 520 #else |
| 521 void MetricsService::LogNeedForCleanShutdown(PrefService* local_state) { | 521 void MetricsService::LogNeedForCleanShutdown() { |
| 522 local_state->SetBoolean(metrics::prefs::kStabilityExitedCleanly, false); | 522 local_state_->SetBoolean(metrics::prefs::kStabilityExitedCleanly, false); |
| 523 // Redundant setting to be sure we call for a clean shutdown. | 523 // Redundant setting to be sure we call for a clean shutdown. |
| 524 clean_shutdown_status_ = NEED_TO_SHUTDOWN; | 524 clean_shutdown_status_ = NEED_TO_SHUTDOWN; |
| 525 } | 525 } |
| 526 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 526 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
| 527 | 527 |
| 528 // static | 528 // static |
| 529 void MetricsService::SetExecutionPhase(ExecutionPhase execution_phase, | 529 void MetricsService::SetExecutionPhase(ExecutionPhase execution_phase, |
| 530 PrefService* local_state) { | 530 PrefService* local_state) { |
| 531 execution_phase_ = execution_phase; | 531 execution_phase_ = execution_phase; |
| 532 local_state->SetInteger(metrics::prefs::kStabilityExecutionPhase, | 532 local_state->SetInteger(metrics::prefs::kStabilityExecutionPhase, |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 local_state_->SetBoolean(path, value); | 1176 local_state_->SetBoolean(path, value); |
| 1177 RecordCurrentState(local_state_); | 1177 RecordCurrentState(local_state_); |
| 1178 } | 1178 } |
| 1179 | 1179 |
| 1180 void MetricsService::RecordCurrentState(PrefService* pref) { | 1180 void MetricsService::RecordCurrentState(PrefService* pref) { |
| 1181 pref->SetInt64(metrics::prefs::kStabilityLastTimestampSec, | 1181 pref->SetInt64(metrics::prefs::kStabilityLastTimestampSec, |
| 1182 base::Time::Now().ToTimeT()); | 1182 base::Time::Now().ToTimeT()); |
| 1183 } | 1183 } |
| 1184 | 1184 |
| 1185 } // namespace metrics | 1185 } // namespace metrics |
| OLD | NEW |