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

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

Issue 2566323002: Defer Posting StoreMetricsClientInfo During PreCreateThreads (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 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..628d8ce881270f4263a65781184b0dd60d171275 100644
--- a/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
+++ b/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
@@ -59,9 +59,18 @@ 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 delayed post task allows this function to get called before the
+ // blocking pool is ready to go.
gab 2016/12/13 15:58:39 (this sentence is backwards?) // Posting the task
robliao 2016/12/13 18:19:38 Clarified to // The message loop processes message
+ 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