Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: chrome/browser/metrics/chrome_metrics_service_client.cc

Issue 2549593002: Revert of Make Crashpad use the user data dir, rather than always default location (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/app/chrome_main_delegate.cc ('k') | chrome/browser/policy/policy_path_parser_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
200 base::FilePath user_data_dir; 201 base::FilePath user_data_dir;
201 if (base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { 202 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 }
207 208
208 // Register the Crashpad metrics files. 209 // Read the Crashpad metrics files.
210 base::FilePath default_user_data_dir;
211 if (chrome::GetDefaultUserDataDirectory(&default_user_data_dir)) {
209 // Register the data from the previous run if crashpad_handler didn't exit 212 // Register the data from the previous run if crashpad_handler didn't exit
210 // cleanly. 213 // cleanly.
211 RegisterOrRemovePreviousRunMetricsFile( 214 RegisterOrRemovePreviousRunMetricsFile(
212 metrics_reporting_enabled, user_data_dir, 215 metrics_reporting_enabled, default_user_data_dir,
213 kCrashpadHistogramAllocatorName, task_runner, 216 kCrashpadHistogramAllocatorName, task_runner,
214 file_metrics_provider.get()); 217 file_metrics_provider.get());
215 if (metrics_reporting_enabled) { 218 if (metrics_reporting_enabled) {
216 base::FilePath active_path; 219 base::FilePath active_path;
217 base::GlobalHistogramAllocator::ConstructFilePaths( 220 base::GlobalHistogramAllocator::ConstructFilePaths(
218 user_data_dir, kCrashpadHistogramAllocatorName, nullptr, 221 default_user_data_dir, kCrashpadHistogramAllocatorName, nullptr,
219 &active_path); 222 &active_path);
220 // Register data that will be populated for the current run. 223 // Register data that will be populated for the current run.
221 file_metrics_provider->RegisterSource( 224 file_metrics_provider->RegisterSource(
222 active_path, 225 active_path,
223 metrics::FileMetricsProvider::SOURCE_HISTOGRAMS_ATOMIC_FILE, 226 metrics::FileMetricsProvider::SOURCE_HISTOGRAMS_ATOMIC_FILE,
224 metrics::FileMetricsProvider::ASSOCIATE_CURRENT_RUN, 227 metrics::FileMetricsProvider::ASSOCIATE_CURRENT_RUN,
225 kCrashpadHistogramAllocatorName); 228 kCrashpadHistogramAllocatorName);
226 } 229 }
227 } 230 }
228 231
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 } 892 }
890 } 893 }
891 894
892 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) { 895 void ChromeMetricsServiceClient::OnURLOpenedFromOmnibox(OmniboxLog* log) {
893 metrics_service_->OnApplicationNotIdle(); 896 metrics_service_->OnApplicationNotIdle();
894 } 897 }
895 898
896 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() { 899 bool ChromeMetricsServiceClient::IsUMACellularUploadLogicEnabled() {
897 return metrics::IsCellularLogicEnabled(); 900 return metrics::IsCellularLogicEnabled();
898 } 901 }
OLDNEW
« no previous file with comments | « chrome/app/chrome_main_delegate.cc ('k') | chrome/browser/policy/policy_path_parser_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698