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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 scoped_refptr<base::TaskRunner> task_runner = | 187 scoped_refptr<base::TaskRunner> task_runner = |
188 content::BrowserThread::GetBlockingPool() | 188 content::BrowserThread::GetBlockingPool() |
189 ->GetTaskRunnerWithShutdownBehavior( | 189 ->GetTaskRunnerWithShutdownBehavior( |
190 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); | 190 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); |
191 | 191 |
192 // Create an object to monitor files of metrics and include them in reports. | 192 // Create an object to monitor files of metrics and include them in reports. |
193 std::unique_ptr<metrics::FileMetricsProvider> file_metrics_provider( | 193 std::unique_ptr<metrics::FileMetricsProvider> file_metrics_provider( |
194 new metrics::FileMetricsProvider(task_runner, | 194 new metrics::FileMetricsProvider(task_runner, |
195 g_browser_process->local_state())); | 195 g_browser_process->local_state())); |
196 | 196 |
197 // Register the file holding browser metrics. | |
198 base::FilePath user_data_dir; | 197 base::FilePath user_data_dir; |
199 if (base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { | 198 if (base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { |
| 199 // Register the file holding browser metrics. |
200 RegisterOrRemovePreviousRunMetricsFile( | 200 RegisterOrRemovePreviousRunMetricsFile( |
201 metrics_reporting_enabled, user_data_dir, | 201 metrics_reporting_enabled, user_data_dir, |
202 ChromeMetricsServiceClient::kBrowserMetricsName, task_runner, | 202 ChromeMetricsServiceClient::kBrowserMetricsName, task_runner, |
203 file_metrics_provider.get()); | 203 file_metrics_provider.get()); |
204 } | |
205 | 204 |
206 // Read the Crashpad metrics files. | 205 // Register the Crashpad metrics files. |
207 base::FilePath default_user_data_dir; | |
208 if (chrome::GetDefaultUserDataDirectory(&default_user_data_dir)) { | |
209 // Register the data from the previous run if crashpad_handler didn't exit | 206 // Register the data from the previous run if crashpad_handler didn't exit |
210 // cleanly. | 207 // cleanly. |
211 RegisterOrRemovePreviousRunMetricsFile( | 208 RegisterOrRemovePreviousRunMetricsFile( |
212 metrics_reporting_enabled, default_user_data_dir, | 209 metrics_reporting_enabled, user_data_dir, |
213 kCrashpadHistogramAllocatorName, task_runner, | 210 kCrashpadHistogramAllocatorName, task_runner, |
214 file_metrics_provider.get()); | 211 file_metrics_provider.get()); |
215 if (metrics_reporting_enabled) { | 212 if (metrics_reporting_enabled) { |
216 base::FilePath active_path; | 213 base::FilePath active_path; |
217 base::GlobalHistogramAllocator::ConstructFilePaths( | 214 base::GlobalHistogramAllocator::ConstructFilePaths( |
218 default_user_data_dir, kCrashpadHistogramAllocatorName, nullptr, | 215 user_data_dir, kCrashpadHistogramAllocatorName, nullptr, |
219 &active_path); | 216 &active_path); |
220 // Register data that will be populated for the current run. | 217 // Register data that will be populated for the current run. |
221 file_metrics_provider->RegisterSource( | 218 file_metrics_provider->RegisterSource( |
222 active_path, | 219 active_path, |
223 metrics::FileMetricsProvider::SOURCE_HISTOGRAMS_ATOMIC_FILE, | 220 metrics::FileMetricsProvider::SOURCE_HISTOGRAMS_ATOMIC_FILE, |
224 metrics::FileMetricsProvider::ASSOCIATE_CURRENT_RUN, | 221 metrics::FileMetricsProvider::ASSOCIATE_CURRENT_RUN, |
225 kCrashpadHistogramAllocatorName); | 222 kCrashpadHistogramAllocatorName); |
226 } | 223 } |
227 } | 224 } |
228 | 225 |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 } | 875 } |
879 } | 876 } |
880 | 877 |
881 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { | 878 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { |
882 metrics_service_->OnApplicationNotIdle(); | 879 metrics_service_->OnApplicationNotIdle(); |
883 } | 880 } |
884 | 881 |
885 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { | 882 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { |
886 return metrics::IsCellularLogicEnabled(); | 883 return metrics::IsCellularLogicEnabled(); |
887 } | 884 } |
OLD | NEW |