Index: chrome/browser/metrics/chrome_metrics_service_client.cc |
diff --git a/chrome/browser/metrics/chrome_metrics_service_client.cc b/chrome/browser/metrics/chrome_metrics_service_client.cc |
index a2b2d7da315fb5517d4128c18e8f4146241cddec..adc077e5fa0d92a6fe7a8c1b23897a621de61dcd 100644 |
--- a/chrome/browser/metrics/chrome_metrics_service_client.cc |
+++ b/chrome/browser/metrics/chrome_metrics_service_client.cc |
@@ -110,6 +110,10 @@ namespace { |
// data. |
const int kMaxHistogramGatheringWaitDuration = 60000; // 60 seconds. |
+// Needs to be kept in sync with the writer in |
+// third_party/crashpad/crashpad/handler/handler_main.cc. |
+const char kCrashpadHistogramAllocatorName[] = "CrashpadMetrics"; |
+ |
// Checks whether it is the first time that cellular uploads logic should be |
// enabled based on whether the the preference for that logic is initialized. |
// This should happen only once as the used preference will be initialized |
@@ -132,6 +136,9 @@ void RegisterInstallerFileMetricsPreferences(PrefRegistrySimple* registry) { |
metrics::FileMetricsProvider::RegisterPrefs( |
registry, installer::kSetupHistogramAllocatorName); |
#endif |
+ |
+ metrics::FileMetricsProvider::RegisterPrefs(registry, |
bcwhite
2016/09/13 14:27:48
Move above the windows-specific stuff.
scottmg
2016/09/13 19:15:32
Done.
|
+ kCrashpadHistogramAllocatorName); |
} |
std::unique_ptr<metrics::FileMetricsProvider> |
@@ -183,6 +190,25 @@ CreateInstallerFileMetricsProvider(bool metrics_reporting_enabled) { |
installer::kSetupHistogramAllocatorName); |
#endif |
+ // Read the Crashpad metrics file. |
bcwhite
2016/09/13 14:27:48
Move above the windows-specific stuff.
scottmg
2016/09/13 19:15:32
Done.
|
+ base::FilePath crashpad_metrics_file; |
+ if (base::PathService::Get(chrome::DIR_CRASH_DUMPS, &crashpad_metrics_file)) { |
+ crashpad_metrics_file = |
+ crashpad_metrics_file.AppendASCII(kCrashpadHistogramAllocatorName) |
+ .AddExtension(base::PersistentMemoryAllocator::kFileExtension); |
+ if (metrics_reporting_enabled) { |
+ file_metrics_provider->RegisterSource( |
+ crashpad_metrics_file, |
+ metrics::FileMetricsProvider::SOURCE_HISTOGRAMS_ATOMIC_FILE, |
+ metrics::FileMetricsProvider::ASSOCIATE_PREVIOUS_RUN, |
+ kCrashpadHistogramAllocatorName); |
+ } else { |
+ task_runner->PostTask( |
+ FROM_HERE, base::Bind(base::IgnoreResult(&base::DeleteFile), |
+ crashpad_metrics_file, /*recursive=*/false)); |
+ } |
+ } |
+ |
return file_metrics_provider; |
} |