| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 } | 354 } |
| 355 | 355 |
| 356 int64_t MetricsService::GetMetricsReportingEnabledDate() { | 356 int64_t MetricsService::GetMetricsReportingEnabledDate() { |
| 357 return local_state_->GetInt64(prefs::kMetricsReportingEnabledTimestamp); | 357 return local_state_->GetInt64(prefs::kMetricsReportingEnabledTimestamp); |
| 358 } | 358 } |
| 359 | 359 |
| 360 bool MetricsService::WasLastShutdownClean() const { | 360 bool MetricsService::WasLastShutdownClean() const { |
| 361 return clean_exit_beacon_.exited_cleanly(); | 361 return clean_exit_beacon_.exited_cleanly(); |
| 362 } | 362 } |
| 363 | 363 |
| 364 std::unique_ptr<const base::FieldTrial::EntropyProvider> | |
| 365 MetricsService::CreateEntropyProvider() { | |
| 366 // TODO(asvitkine): Refactor the code so that MetricsService does not expose | |
| 367 // this method. | |
| 368 return state_manager_->CreateDefaultEntropyProvider(); | |
| 369 } | |
| 370 | |
| 371 void MetricsService::EnableRecording() { | 364 void MetricsService::EnableRecording() { |
| 372 DCHECK(IsSingleThreaded()); | 365 DCHECK(IsSingleThreaded()); |
| 373 | 366 |
| 374 if (recording_state_ == ACTIVE) | 367 if (recording_state_ == ACTIVE) |
| 375 return; | 368 return; |
| 376 recording_state_ = ACTIVE; | 369 recording_state_ = ACTIVE; |
| 377 | 370 |
| 378 state_manager_->ForceClientIdCreation(); | 371 state_manager_->ForceClientIdCreation(); |
| 379 client_->SetMetricsClientId(state_manager_->client_id()); | 372 client_->SetMetricsClientId(state_manager_->client_id()); |
| 380 if (!log_manager_.current_log()) | 373 if (!log_manager_.current_log()) |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 base::Time::Now().ToTimeT()); | 1201 base::Time::Now().ToTimeT()); |
| 1209 } | 1202 } |
| 1210 | 1203 |
| 1211 void MetricsService::SkipAndDiscardUpload() { | 1204 void MetricsService::SkipAndDiscardUpload() { |
| 1212 log_manager_.DiscardStagedLog(); | 1205 log_manager_.DiscardStagedLog(); |
| 1213 scheduler_->UploadCancelled(); | 1206 scheduler_->UploadCancelled(); |
| 1214 log_upload_in_progress_ = false; | 1207 log_upload_in_progress_ = false; |
| 1215 } | 1208 } |
| 1216 | 1209 |
| 1217 } // namespace metrics | 1210 } // namespace metrics |
| OLD | NEW |