| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 #include "base/single_thread_task_runner.h" | 142 #include "base/single_thread_task_runner.h" |
| 143 #include "base/strings/string_number_conversions.h" | 143 #include "base/strings/string_number_conversions.h" |
| 144 #include "base/strings/utf_string_conversions.h" | 144 #include "base/strings/utf_string_conversions.h" |
| 145 #include "base/threading/platform_thread.h" | 145 #include "base/threading/platform_thread.h" |
| 146 #include "base/threading/thread.h" | 146 #include "base/threading/thread.h" |
| 147 #include "base/threading/thread_restrictions.h" | 147 #include "base/threading/thread_restrictions.h" |
| 148 #include "base/threading/thread_task_runner_handle.h" | 148 #include "base/threading/thread_task_runner_handle.h" |
| 149 #include "base/time/time.h" | 149 #include "base/time/time.h" |
| 150 #include "base/tracked_objects.h" | 150 #include "base/tracked_objects.h" |
| 151 #include "build/build_config.h" | 151 #include "build/build_config.h" |
| 152 #include "components/browser_watcher/stability_debugging.h" |
| 152 #include "components/metrics/data_use_tracker.h" | 153 #include "components/metrics/data_use_tracker.h" |
| 153 #include "components/metrics/metrics_log.h" | 154 #include "components/metrics/metrics_log.h" |
| 154 #include "components/metrics/metrics_log_manager.h" | 155 #include "components/metrics/metrics_log_manager.h" |
| 155 #include "components/metrics/metrics_log_uploader.h" | 156 #include "components/metrics/metrics_log_uploader.h" |
| 156 #include "components/metrics/metrics_pref_names.h" | 157 #include "components/metrics/metrics_pref_names.h" |
| 157 #include "components/metrics/metrics_reporting_scheduler.h" | 158 #include "components/metrics/metrics_reporting_scheduler.h" |
| 158 #include "components/metrics/metrics_service_client.h" | 159 #include "components/metrics/metrics_service_client.h" |
| 159 #include "components/metrics/metrics_state_manager.h" | 160 #include "components/metrics/metrics_state_manager.h" |
| 160 #include "components/prefs/pref_registry_simple.h" | 161 #include "components/prefs/pref_registry_simple.h" |
| 161 #include "components/prefs/pref_service.h" | 162 #include "components/prefs/pref_service.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 // Redundant setting to be sure we call for a clean shutdown. | 493 // Redundant setting to be sure we call for a clean shutdown. |
| 493 clean_shutdown_status_ = NEED_TO_SHUTDOWN; | 494 clean_shutdown_status_ = NEED_TO_SHUTDOWN; |
| 494 } | 495 } |
| 495 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 496 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
| 496 | 497 |
| 497 // static | 498 // static |
| 498 void MetricsService::SetExecutionPhase(ExecutionPhase execution_phase, | 499 void MetricsService::SetExecutionPhase(ExecutionPhase execution_phase, |
| 499 PrefService* local_state) { | 500 PrefService* local_state) { |
| 500 execution_phase_ = execution_phase; | 501 execution_phase_ = execution_phase; |
| 501 local_state->SetInteger(prefs::kStabilityExecutionPhase, execution_phase_); | 502 local_state->SetInteger(prefs::kStabilityExecutionPhase, execution_phase_); |
| 503 browser_watcher::SetStabilityDataInt(prefs::kStabilityExecutionPhase, |
| 504 execution_phase_); |
| 502 } | 505 } |
| 503 | 506 |
| 504 void MetricsService::RecordBreakpadRegistration(bool success) { | 507 void MetricsService::RecordBreakpadRegistration(bool success) { |
| 505 if (!success) | 508 if (!success) |
| 506 IncrementPrefValue(prefs::kStabilityBreakpadRegistrationFail); | 509 IncrementPrefValue(prefs::kStabilityBreakpadRegistrationFail); |
| 507 else | 510 else |
| 508 IncrementPrefValue(prefs::kStabilityBreakpadRegistrationSuccess); | 511 IncrementPrefValue(prefs::kStabilityBreakpadRegistrationSuccess); |
| 509 } | 512 } |
| 510 | 513 |
| 511 void MetricsService::RecordBreakpadHasDebugger(bool has_debugger) { | 514 void MetricsService::RecordBreakpadHasDebugger(bool has_debugger) { |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 base::Time::Now().ToTimeT()); | 1232 base::Time::Now().ToTimeT()); |
| 1230 } | 1233 } |
| 1231 | 1234 |
| 1232 void MetricsService::SkipAndDiscardUpload() { | 1235 void MetricsService::SkipAndDiscardUpload() { |
| 1233 log_manager_.DiscardStagedLog(); | 1236 log_manager_.DiscardStagedLog(); |
| 1234 scheduler_->UploadCancelled(); | 1237 scheduler_->UploadCancelled(); |
| 1235 log_upload_in_progress_ = false; | 1238 log_upload_in_progress_ = false; |
| 1236 } | 1239 } |
| 1237 | 1240 |
| 1238 } // namespace metrics | 1241 } // namespace metrics |
| OLD | NEW |