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

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 2517443002: Revert of Disallow posting tasks to SequencedWorkerPools by default. (Closed)
Patch Set: 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 | « base/threading/sequenced_worker_pool_unittest.cc ('k') | chrome/service/service_process.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index ddae219d0d59d1b19f7bd6c7bd1df49cec96aedb..ef8d8ccada69f44a348f08479ff86379c8f99f86 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -315,12 +315,7 @@
}
#endif // !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
-// Initializes TaskScheduler if enabled via field trial or command line flag.
-// The function returns true if it enables redirection of SequencedWorkerPool to
-// TaskScheduler.
-bool MaybeInitializeTaskScheduler() {
- bool sequenced_worker_pool_redirected = false;
-
+void MaybeInitializeTaskScheduler() {
static constexpr char kFieldTrialName[] = "BrowserScheduler";
std::map<std::string, std::string> variation_params;
if (!variations::GetVariationParams(kFieldTrialName, &variation_params)) {
@@ -330,22 +325,19 @@
<< switches::kEnableBrowserTaskScheduler
<< " because there is no available variation param for this build or "
" the task scheduler is disabled in chrome://flags.";
- return sequenced_worker_pool_redirected;
+ return;
}
if (!task_scheduler_util::InitializeDefaultTaskScheduler(variation_params))
- return sequenced_worker_pool_redirected;
+ return;
// TODO(gab): Remove this when http://crbug.com/622400 concludes.
const auto sequenced_worker_pool_param =
variation_params.find("RedirectSequencedWorkerPools");
if (sequenced_worker_pool_param != variation_params.end() &&
sequenced_worker_pool_param->second == "true") {
- sequenced_worker_pool_redirected = true;
- base::SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess();
- }
-
- return sequenced_worker_pool_redirected;
+ base::SequencedWorkerPool::RedirectToTaskSchedulerForProcess();
+ }
}
// Returns the new local state object, guaranteed non-NULL.
@@ -1245,8 +1237,7 @@
// IOThread's initialization which happens in BrowserProcess:PreCreateThreads.
SetupFieldTrials();
- // Initializing TaskScheduler and enabling SequencedWorkerPool needs to be
- // here for the following reasons:
+ // Task Scheduler initialization needs to be here for the following reasons:
// * After |SetupFieldTrials()|: Initialization uses variations.
// * Before |SetupMetrics()|: |SetupMetrics()| uses the blocking pool. The
// Task Scheduler must do any necessary redirection before then.
@@ -1255,14 +1246,7 @@
// threads itself so instantiating it earlier is also incorrect.
// To maintain scoping symmetry, if this line is moved, the corresponding
// shutdown call may also need to be moved.
- const bool sequenced_worker_pool_redirected = MaybeInitializeTaskScheduler();
-
- // If MaybeInitializeTaskScheduler() hasn't enabled SequencedWorkerPool with
- // redirection to TaskScheduler, enable it without redirection.
- // TODO(fdoray): Remove this once the SequencedWorkerPool to TaskScheduler
- // redirection experiment concludes https://crbug.com/622400.
- if (!sequenced_worker_pool_redirected)
- base::SequencedWorkerPool::EnableForProcess();
+ MaybeInitializeTaskScheduler();
SetupMetrics();
« no previous file with comments | « base/threading/sequenced_worker_pool_unittest.cc ('k') | chrome/service/service_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698