| 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 } | 395 } |
| 396 | 396 |
| 397 void MetricsService::EnableRecording() { | 397 void MetricsService::EnableRecording() { |
| 398 DCHECK(IsSingleThreaded()); | 398 DCHECK(IsSingleThreaded()); |
| 399 | 399 |
| 400 if (recording_active_) | 400 if (recording_active_) |
| 401 return; | 401 return; |
| 402 recording_active_ = true; | 402 recording_active_ = true; |
| 403 | 403 |
| 404 state_manager_->ForceClientIdCreation(); | 404 state_manager_->ForceClientIdCreation(); |
| 405 client_->SetClientID(state_manager_->client_id()); | 405 client_->RegisterClientID(state_manager_->client_id()); |
| 406 if (!log_manager_.current_log()) | 406 if (!log_manager_.current_log()) |
| 407 OpenNewLog(); | 407 OpenNewLog(); |
| 408 | 408 |
| 409 for (size_t i = 0; i < metrics_providers_.size(); ++i) | 409 for (size_t i = 0; i < metrics_providers_.size(); ++i) |
| 410 metrics_providers_[i]->OnRecordingEnabled(); | 410 metrics_providers_[i]->OnRecordingEnabled(); |
| 411 | 411 |
| 412 base::RemoveActionCallback(action_callback_); | 412 base::RemoveActionCallback(action_callback_); |
| 413 action_callback_ = base::Bind(&MetricsService::OnUserAction, | 413 action_callback_ = base::Bind(&MetricsService::OnUserAction, |
| 414 base::Unretained(this)); | 414 base::Unretained(this)); |
| 415 base::AddActionCallback(action_callback_); | 415 base::AddActionCallback(action_callback_); |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 RecordCurrentState(local_state_); | 1201 RecordCurrentState(local_state_); |
| 1202 } | 1202 } |
| 1203 | 1203 |
| 1204 void MetricsService::RecordCurrentState(PrefService* pref) { | 1204 void MetricsService::RecordCurrentState(PrefService* pref) { |
| 1205 pref->SetInt64(metrics::prefs::kStabilityLastTimestampSec, | 1205 pref->SetInt64(metrics::prefs::kStabilityLastTimestampSec, |
| 1206 Time::Now().ToTimeT()); | 1206 Time::Now().ToTimeT()); |
| 1207 | 1207 |
| 1208 for (size_t i = 0; i < metrics_providers_.size(); ++i) | 1208 for (size_t i = 0; i < metrics_providers_.size(); ++i) |
| 1209 metrics_providers_[i]->RecordCurrentState(); | 1209 metrics_providers_[i]->RecordCurrentState(); |
| 1210 } | 1210 } |
| OLD | NEW |