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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 base::AddActionCallback(action_callback_); | 389 base::AddActionCallback(action_callback_); |
390 } | 390 } |
391 | 391 |
392 void MetricsService::DisableRecording() { | 392 void MetricsService::DisableRecording() { |
393 DCHECK(IsSingleThreaded()); | 393 DCHECK(IsSingleThreaded()); |
394 | 394 |
395 if (recording_state_ == INACTIVE) | 395 if (recording_state_ == INACTIVE) |
396 return; | 396 return; |
397 recording_state_ = INACTIVE; | 397 recording_state_ = INACTIVE; |
398 | 398 |
399 client_->OnRecordingDisabled(); | |
400 | |
401 base::RemoveActionCallback(action_callback_); | 399 base::RemoveActionCallback(action_callback_); |
402 | 400 |
403 for (MetricsProvider* provider : metrics_providers_) | 401 for (MetricsProvider* provider : metrics_providers_) |
404 provider->OnRecordingDisabled(); | 402 provider->OnRecordingDisabled(); |
405 | 403 |
406 PushPendingLogsToPersistentStorage(); | 404 PushPendingLogsToPersistentStorage(); |
407 } | 405 } |
408 | 406 |
409 bool MetricsService::recording_active() const { | 407 bool MetricsService::recording_active() const { |
410 DCHECK(IsSingleThreaded()); | 408 DCHECK(IsSingleThreaded()); |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 base::Time::Now().ToTimeT()); | 1205 base::Time::Now().ToTimeT()); |
1208 } | 1206 } |
1209 | 1207 |
1210 void MetricsService::SkipAndDiscardUpload() { | 1208 void MetricsService::SkipAndDiscardUpload() { |
1211 log_manager_.DiscardStagedLog(); | 1209 log_manager_.DiscardStagedLog(); |
1212 scheduler_->UploadCancelled(); | 1210 scheduler_->UploadCancelled(); |
1213 log_upload_in_progress_ = false; | 1211 log_upload_in_progress_ = false; |
1214 } | 1212 } |
1215 | 1213 |
1216 } // namespace metrics | 1214 } // namespace metrics |
OLD | NEW |