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

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

Issue 2566323002: Defer Posting StoreMetricsClientInfo During PreCreateThreads (Closed)
Patch Set: Update Comment 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 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/chrome_metrics_services_manager_client.cc
diff --git a/chrome/browser/metrics/chrome_metrics_services_manager_client.cc b/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
index 82a5a10ac877320c1b619cf3acae581465813315..186811f8a864a12f8eeab7a1bab34f3ba3a382a4 100644
--- a/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
+++ b/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
@@ -59,9 +59,19 @@ const base::Feature kMetricsReportingFeature{"MetricsReporting",
// Posts |GoogleUpdateSettings::StoreMetricsClientInfo| on blocking pool thread
// because it needs access to IO and cannot work from UI thread.
void PostStoreMetricsClientInfo(const metrics::ClientInfo& client_info) {
- content::BrowserThread::GetBlockingPool()->PostTask(
- FROM_HERE,
- base::Bind(&GoogleUpdateSettings::StoreMetricsClientInfo, client_info));
+ // The message loop processes messages after the blocking pool is initialized.
+ // Posting a task to the message loop to post a task to the blocking pool
+ // ensures that the blocking pool is ready to accept tasks at that time.
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI, FROM_HERE,
+ base::Bind(
+ [](const metrics::ClientInfo& client_info) {
+ content::BrowserThread::PostBlockingPoolTask(
+ FROM_HERE,
+ base::Bind(&GoogleUpdateSettings::StoreMetricsClientInfo,
+ client_info));
+ },
+ client_info));
}
// Appends a group to the sampling controlling |trial|. The group will be
« 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