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

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

Issue 2237643002: Delay asynchronous work from the metrics clients until after startup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@b2_afterstartup_runner
Patch Set: rebase dependent Created 4 years, 4 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
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 da34086e4d4f1db29e5757b68223a22ba1a5188d..c94f55f7887c412b7b639c590b081521a69693e5 100644
--- a/chrome/browser/metrics/chrome_metrics_service_client.cc
+++ b/chrome/browser/metrics/chrome_metrics_service_client.cc
@@ -22,6 +22,7 @@
#include "base/strings/string16.h"
#include "base/threading/platform_thread.h"
#include "build/build_config.h"
+#include "chrome/browser/after_startup_task_utils.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/google/google_brand.h"
@@ -138,9 +139,10 @@ CreateInstallerFileMetricsProvider(bool metrics_reporting_enabled) {
// Fetch a worker-pool for performing I/O tasks that are not allowed on
// the main UI thread.
scoped_refptr<base::TaskRunner> task_runner =
- content::BrowserThread::GetBlockingPool()
- ->GetTaskRunnerWithShutdownBehavior(
- base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
+ new AfterStartupTaskUtils::Runner(
+ content::BrowserThread::GetBlockingPool()
+ ->GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN));
// Create an object to monitor files of metrics and include them in reports.
std::unique_ptr<metrics::FileMetricsProvider> file_metrics_provider(
@@ -419,8 +421,8 @@ void ChromeMetricsServiceClient::Initialize() {
#endif
metrics_service_->RegisterMetricsProvider(
std::unique_ptr<metrics::MetricsProvider>(
- new metrics::NetworkMetricsProvider(
- content::BrowserThread::GetBlockingPool())));
+ new metrics::NetworkMetricsProvider(new AfterStartupTaskUtils::Runner(
+ content::BrowserThread::GetBlockingPool()))));
Alexei Svitkine (slow) 2016/08/12 18:28:18 Similar to AntiVirusMetricsProvider, this could de
// Currently, we configure OmniboxMetricsProvider to not log events to UMA
// if there is a single incognito session visible. In the future, it may
@@ -480,12 +482,14 @@ void ChromeMetricsServiceClient::Initialize() {
std::unique_ptr<metrics::MetricsProvider>(
new browser_watcher::WatcherMetricsProviderWin(
chrome::GetBrowserExitCodesRegistryPath(),
- content::BrowserThread::GetBlockingPool())));
-
- antivirus_metrics_provider_ = new AntiVirusMetricsProvider(
- content::BrowserThread::GetBlockingPool()
- ->GetTaskRunnerWithShutdownBehavior(
- base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN));
+ new AfterStartupTaskUtils::Runner(
+ content::BrowserThread::GetBlockingPool()))));
Alexei Svitkine (slow) 2016/08/12 18:28:18 This seems fine. Used to clean up registry data wh
+
+ antivirus_metrics_provider_ =
+ new AntiVirusMetricsProvider(new AfterStartupTaskUtils::Runner(
Alexei Svitkine (slow) 2016/08/12 18:28:18 This will delay running GetAntiVirusProductsOnFile
gab 2016/08/15 19:39:56 For startup's sake on slow machines (forgetting th
+ content::BrowserThread::GetBlockingPool()
+ ->GetTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN)));
metrics_service_->RegisterMetricsProvider(
std::unique_ptr<metrics::MetricsProvider>(antivirus_metrics_provider_));

Powered by Google App Engine
This is Rietveld 408576698