| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 #include <utility> | 129 #include <utility> |
| 130 | 130 |
| 131 #include "base/bind.h" | 131 #include "base/bind.h" |
| 132 #include "base/callback.h" | 132 #include "base/callback.h" |
| 133 #include "base/location.h" | 133 #include "base/location.h" |
| 134 #include "base/metrics/histogram_base.h" | 134 #include "base/metrics/histogram_base.h" |
| 135 #include "base/metrics/histogram_macros.h" | 135 #include "base/metrics/histogram_macros.h" |
| 136 #include "base/metrics/histogram_samples.h" | 136 #include "base/metrics/histogram_samples.h" |
| 137 #include "base/metrics/sparse_histogram.h" | 137 #include "base/metrics/sparse_histogram.h" |
| 138 #include "base/metrics/statistics_recorder.h" | 138 #include "base/metrics/statistics_recorder.h" |
| 139 #include "base/prefs/pref_registry_simple.h" | |
| 140 #include "base/prefs/pref_service.h" | |
| 141 #include "base/rand_util.h" | 139 #include "base/rand_util.h" |
| 142 #include "base/single_thread_task_runner.h" | 140 #include "base/single_thread_task_runner.h" |
| 143 #include "base/strings/string_number_conversions.h" | 141 #include "base/strings/string_number_conversions.h" |
| 144 #include "base/strings/utf_string_conversions.h" | 142 #include "base/strings/utf_string_conversions.h" |
| 145 #include "base/thread_task_runner_handle.h" | 143 #include "base/thread_task_runner_handle.h" |
| 146 #include "base/threading/platform_thread.h" | 144 #include "base/threading/platform_thread.h" |
| 147 #include "base/threading/thread.h" | 145 #include "base/threading/thread.h" |
| 148 #include "base/threading/thread_restrictions.h" | 146 #include "base/threading/thread_restrictions.h" |
| 149 #include "base/time/time.h" | 147 #include "base/time/time.h" |
| 150 #include "base/tracked_objects.h" | 148 #include "base/tracked_objects.h" |
| 151 #include "base/values.h" | 149 #include "base/values.h" |
| 152 #include "build/build_config.h" | 150 #include "build/build_config.h" |
| 153 #include "components/metrics/metrics_log.h" | 151 #include "components/metrics/metrics_log.h" |
| 154 #include "components/metrics/metrics_log_manager.h" | 152 #include "components/metrics/metrics_log_manager.h" |
| 155 #include "components/metrics/metrics_log_uploader.h" | 153 #include "components/metrics/metrics_log_uploader.h" |
| 156 #include "components/metrics/metrics_pref_names.h" | 154 #include "components/metrics/metrics_pref_names.h" |
| 157 #include "components/metrics/metrics_reporting_scheduler.h" | 155 #include "components/metrics/metrics_reporting_scheduler.h" |
| 158 #include "components/metrics/metrics_service_client.h" | 156 #include "components/metrics/metrics_service_client.h" |
| 159 #include "components/metrics/metrics_state_manager.h" | 157 #include "components/metrics/metrics_state_manager.h" |
| 158 #include "components/prefs/pref_registry_simple.h" |
| 159 #include "components/prefs/pref_service.h" |
| 160 #include "components/variations/entropy_provider.h" | 160 #include "components/variations/entropy_provider.h" |
| 161 #include "components/variations/variations_associated_data.h" | 161 #include "components/variations/variations_associated_data.h" |
| 162 | 162 |
| 163 namespace metrics { | 163 namespace metrics { |
| 164 | 164 |
| 165 namespace { | 165 namespace { |
| 166 | 166 |
| 167 // Check to see that we're being called on only one thread. | 167 // Check to see that we're being called on only one thread. |
| 168 bool IsSingleThreaded() { | 168 bool IsSingleThreaded() { |
| 169 static base::PlatformThreadId thread_id = 0; | 169 static base::PlatformThreadId thread_id = 0; |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 base::Time::Now().ToTimeT()); | 1138 base::Time::Now().ToTimeT()); |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 1141 void MetricsService::SkipAndDiscardUpload() { | 1141 void MetricsService::SkipAndDiscardUpload() { |
| 1142 log_manager_.DiscardStagedLog(); | 1142 log_manager_.DiscardStagedLog(); |
| 1143 scheduler_->UploadCancelled(); | 1143 scheduler_->UploadCancelled(); |
| 1144 log_upload_in_progress_ = false; | 1144 log_upload_in_progress_ = false; |
| 1145 } | 1145 } |
| 1146 | 1146 |
| 1147 } // namespace metrics | 1147 } // namespace metrics |
| OLD | NEW |