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

Unified Diff: chrome/browser/metrics/chrome_metrics_service_client.cc

Issue 2344343002: Wire in postmortem report collection (Closed)
Patch Set: Merge Created 4 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/metrics/chrome_metrics_service_client.h ('k') | components/browser_watcher/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 922c7fe43ddc851e172e938c5646a384335594a1..45130f3a6e9d24a6e5e9d75e679f665988cf7415 100644
--- a/chrome/browser/metrics/chrome_metrics_service_client.cc
+++ b/chrome/browser/metrics/chrome_metrics_service_client.cc
@@ -237,6 +237,8 @@ ChromeMetricsServiceClient::ChromeMetricsServiceClient(
#endif
#if defined(OS_WIN)
google_update_metrics_provider_(nullptr),
+ watcher_metrics_provider_(nullptr),
+ antivirus_metrics_provider_(nullptr),
#endif
drive_metrics_provider_(nullptr),
start_time_(base::TimeTicks::Now()),
@@ -488,11 +490,19 @@ void ChromeMetricsServiceClient::Initialize() {
std::unique_ptr<metrics::MetricsProvider>(
google_update_metrics_provider_));
+ base::FilePath user_data_dir;
+ base::FilePath crash_dir;
+ if (!base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir) ||
+ !base::PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dir)) {
+ // If either call fails, then clear both.
+ user_data_dir = base::FilePath();
+ crash_dir = base::FilePath();
+ }
+ watcher_metrics_provider_ = new browser_watcher::WatcherMetricsProviderWin(
+ chrome::GetBrowserExitCodesRegistryPath(), user_data_dir, crash_dir,
+ content::BrowserThread::GetBlockingPool());
metrics_service_->RegisterMetricsProvider(
- std::unique_ptr<metrics::MetricsProvider>(
- new browser_watcher::WatcherMetricsProviderWin(
- chrome::GetBrowserExitCodesRegistryPath(),
- content::BrowserThread::GetBlockingPool())));
+ std::unique_ptr<metrics::MetricsProvider>(watcher_metrics_provider_));
antivirus_metrics_provider_ = new AntiVirusMetricsProvider(
content::BrowserThread::GetBlockingPool()
@@ -602,6 +612,16 @@ void ChromeMetricsServiceClient::OnInitTaskGotAntiVirusData() {
}
void ChromeMetricsServiceClient::OnInitTaskGotDriveMetrics() {
+#if defined(OS_WIN)
+ watcher_metrics_provider_->CollectPostmortemReports(base::Bind(
+ &ChromeMetricsServiceClient::OnInitTaskCollectedPostmortemReports,
+ weak_ptr_factory_.GetWeakPtr()));
+#else
+ OnInitTaskCollectedPostmortemReports();
+#endif // defined(OS_WIN)
+}
+
+void ChromeMetricsServiceClient::OnInitTaskCollectedPostmortemReports() {
finished_init_task_callback_.Run();
}
« no previous file with comments | « chrome/browser/metrics/chrome_metrics_service_client.h ('k') | components/browser_watcher/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698