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

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

Issue 2531023002: Don't create profile in HttpsEngagementMetricsProvider (Closed)
Patch Set: Add a comment Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/https_engagement_metrics_provider.cc
diff --git a/chrome/browser/metrics/https_engagement_metrics_provider.cc b/chrome/browser/metrics/https_engagement_metrics_provider.cc
index d75bd91c6ea995b9ca979455ba2b231a8a0a45df..185d77e690645e7fe1cc7942e95ac5f6da7e4397 100644
--- a/chrome/browser/metrics/https_engagement_metrics_provider.cc
+++ b/chrome/browser/metrics/https_engagement_metrics_provider.cc
@@ -19,9 +19,16 @@ void HttpsEngagementMetricsProvider::ProvideGeneralMetrics(
if (!profile_manager)
return;
+ // Do not try to create profile here if it does not exist,
+ // because this method can be called during browser shutdown.
+ Profile* profile = profile_manager->GetProfileByPath(
+ profile_manager->GetLastUsedProfileDir(
+ profile_manager->user_data_dir()));
+ if (!profile)
+ return;
+
HttpsEngagementService* engagement_service =
- HttpsEngagementServiceFactory::GetForBrowserContext(
- profile_manager->GetLastUsedProfile());
+ HttpsEngagementServiceFactory::GetForBrowserContext(profile);
if (!engagement_service)
return;
engagement_service->StoreMetricsAndClear();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698