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