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 #include "chrome/browser/metrics/chrome_metrics_service_client.h" | 5 #include "chrome/browser/metrics/chrome_metrics_service_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 scoped_refptr<base::TaskRunner> task_runner = | 190 scoped_refptr<base::TaskRunner> task_runner = |
191 content::BrowserThread::GetBlockingPool() | 191 content::BrowserThread::GetBlockingPool() |
192 ->GetTaskRunnerWithShutdownBehavior( | 192 ->GetTaskRunnerWithShutdownBehavior( |
193 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); | 193 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); |
194 | 194 |
195 // Create an object to monitor files of metrics and include them in reports. | 195 // Create an object to monitor files of metrics and include them in reports. |
196 std::unique_ptr<metrics::FileMetricsProvider> file_metrics_provider( | 196 std::unique_ptr<metrics::FileMetricsProvider> file_metrics_provider( |
197 new metrics::FileMetricsProvider(task_runner, | 197 new metrics::FileMetricsProvider(task_runner, |
198 g_browser_process->local_state())); | 198 g_browser_process->local_state())); |
199 | 199 |
200 // Register the file holding browser metrics. | |
201 base::FilePath user_data_dir; | 200 base::FilePath user_data_dir; |
202 if (base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { | 201 if (base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { |
| 202 // Register the file holding browser metrics. |
203 RegisterOrRemovePreviousRunMetricsFile( | 203 RegisterOrRemovePreviousRunMetricsFile( |
204 metrics_reporting_enabled, user_data_dir, | 204 metrics_reporting_enabled, user_data_dir, |
205 ChromeMetricsServiceClient::kBrowserMetricsName, task_runner, | 205 ChromeMetricsServiceClient::kBrowserMetricsName, task_runner, |
206 file_metrics_provider.get()); | 206 file_metrics_provider.get()); |
207 } | |
208 | 207 |
209 // Read the Crashpad metrics files. | 208 // Register the Crashpad metrics files. |
210 base::FilePath default_user_data_dir; | |
211 if (chrome::GetDefaultUserDataDirectory(&default_user_data_dir)) { | |
212 // Register the data from the previous run if crashpad_handler didn't exit | 209 // Register the data from the previous run if crashpad_handler didn't exit |
213 // cleanly. | 210 // cleanly. |
214 RegisterOrRemovePreviousRunMetricsFile( | 211 RegisterOrRemovePreviousRunMetricsFile( |
215 metrics_reporting_enabled, default_user_data_dir, | 212 metrics_reporting_enabled, user_data_dir, |
216 kCrashpadHistogramAllocatorName, task_runner, | 213 kCrashpadHistogramAllocatorName, task_runner, |
217 file_metrics_provider.get()); | 214 file_metrics_provider.get()); |
218 if (metrics_reporting_enabled) { | 215 if (metrics_reporting_enabled) { |
219 base::FilePath active_path; | 216 base::FilePath active_path; |
220 base::GlobalHistogramAllocator::ConstructFilePaths( | 217 base::GlobalHistogramAllocator::ConstructFilePaths( |
221 default_user_data_dir, kCrashpadHistogramAllocatorName, nullptr, | 218 user_data_dir, kCrashpadHistogramAllocatorName, nullptr, |
222 &active_path); | 219 &active_path); |
223 // Register data that will be populated for the current run. | 220 // Register data that will be populated for the current run. |
224 file_metrics_provider->RegisterSource( | 221 file_metrics_provider->RegisterSource( |
225 active_path, | 222 active_path, |
226 metrics::FileMetricsProvider::SOURCE_HISTOGRAMS_ATOMIC_FILE, | 223 metrics::FileMetricsProvider::SOURCE_HISTOGRAMS_ATOMIC_FILE, |
227 metrics::FileMetricsProvider::ASSOCIATE_CURRENT_RUN, | 224 metrics::FileMetricsProvider::ASSOCIATE_CURRENT_RUN, |
228 kCrashpadHistogramAllocatorName); | 225 kCrashpadHistogramAllocatorName); |
229 } | 226 } |
230 } | 227 } |
231 | 228 |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 } | 889 } |
893 } | 890 } |
894 | 891 |
895 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { | 892 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { |
896 metrics_service_->OnApplicationNotIdle(); | 893 metrics_service_->OnApplicationNotIdle(); |
897 } | 894 } |
898 | 895 |
899 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { | 896 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { |
900 return metrics::IsCellularLogicEnabled(); | 897 return metrics::IsCellularLogicEnabled(); |
901 } | 898 } |
OLD | NEW |