| 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 base::AddActionCallback(action_callback_); | 381 base::AddActionCallback(action_callback_); |
| 382 } | 382 } |
| 383 | 383 |
| 384 void MetricsService::DisableRecording() { | 384 void MetricsService::DisableRecording() { |
| 385 DCHECK(IsSingleThreaded()); | 385 DCHECK(IsSingleThreaded()); |
| 386 | 386 |
| 387 if (!recording_active_) | 387 if (!recording_active_) |
| 388 return; | 388 return; |
| 389 recording_active_ = false; | 389 recording_active_ = false; |
| 390 | 390 |
| 391 client_->RecordingDisabled(); |
| 392 |
| 391 base::RemoveActionCallback(action_callback_); | 393 base::RemoveActionCallback(action_callback_); |
| 392 | 394 |
| 393 for (size_t i = 0; i < metrics_providers_.size(); ++i) | 395 for (size_t i = 0; i < metrics_providers_.size(); ++i) |
| 394 metrics_providers_[i]->OnRecordingDisabled(); | 396 metrics_providers_[i]->OnRecordingDisabled(); |
| 395 | 397 |
| 396 PushPendingLogsToPersistentStorage(); | 398 PushPendingLogsToPersistentStorage(); |
| 397 } | 399 } |
| 398 | 400 |
| 399 bool MetricsService::recording_active() const { | 401 bool MetricsService::recording_active() const { |
| 400 DCHECK(IsSingleThreaded()); | 402 DCHECK(IsSingleThreaded()); |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 local_state_->SetBoolean(path, value); | 1131 local_state_->SetBoolean(path, value); |
| 1130 RecordCurrentState(local_state_); | 1132 RecordCurrentState(local_state_); |
| 1131 } | 1133 } |
| 1132 | 1134 |
| 1133 void MetricsService::RecordCurrentState(PrefService* pref) { | 1135 void MetricsService::RecordCurrentState(PrefService* pref) { |
| 1134 pref->SetInt64(prefs::kStabilityLastTimestampSec, | 1136 pref->SetInt64(prefs::kStabilityLastTimestampSec, |
| 1135 base::Time::Now().ToTimeT()); | 1137 base::Time::Now().ToTimeT()); |
| 1136 } | 1138 } |
| 1137 | 1139 |
| 1138 } // namespace metrics | 1140 } // namespace metrics |
| OLD | NEW |