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

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

Issue 2769803002: Use TaskScheduler instead of blocking pool in chrome_metrics_services_manager_client.cc. (Closed)
Patch Set: rebase Created 3 years, 8 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 | « 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 bb5c6fc12369fe5e890246c96a32f2be8d500838..a6cbf3d843eca395742253b098d2b93846703344 100644
--- a/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
+++ b/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
+#include "base/task_scheduler/post_task.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
#include "chrome/browser/metrics/chrome_metrics_service_client.h"
@@ -62,19 +63,13 @@ 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) {
- // 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::BindOnce(
- [](const metrics::ClientInfo& client_info) {
- content::BrowserThread::PostBlockingPoolTask(
- FROM_HERE,
- base::BindOnce(&GoogleUpdateSettings::StoreMetricsClientInfo,
- client_info));
- },
- client_info));
+ base::PostTaskWithTraits(
+ FROM_HERE,
+ base::TaskTraits()
+ .WithPriority(base::TaskPriority::BACKGROUND)
+ .MayBlock(),
+ base::BindOnce(&GoogleUpdateSettings::StoreMetricsClientInfo,
+ 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