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

Unified Diff: chrome/service/service_process.cc

Issue 2501033002: Redirect SequencedWorkerPool to TaskScheduler in the service process. (Closed)
Patch Set: rebase 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/service_process.cc
diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc
index 241af3f9066275ae62ce74d2098fe9464ee7eddc..3e3b8d81b826301b5791eb7901b8f31b4c6b33a0 100644
--- a/chrome/service/service_process.cc
+++ b/chrome/service/service_process.cc
@@ -21,8 +21,10 @@
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/waitable_event.h"
+#include "base/task_scheduler/task_scheduler.h"
#include "base/threading/sequenced_worker_pool.h"
#include "base/threading/thread_task_runner_handle.h"
+#include "base/time/time.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/common/chrome_constants.h"
@@ -158,10 +160,11 @@ bool ServiceProcess::Initialize(base::MessageLoopForUI* message_loop,
return false;
}
- // Enable SequencedWorkerPool in the service process.
- // TODO(fdoray): Remove this once the SequencedWorkerPool to TaskScheduler
- // redirection experiment concludes https://crbug.com/622400.
- base::SequencedWorkerPool::EnableForProcess();
+ // Initialize TaskScheduler and redirect SequencedWorkerPool tasks to it.
+ constexpr int kMaxTaskSchedulerThreads = 3;
+ base::TaskScheduler::CreateAndSetSimpleTaskScheduler(
+ kMaxTaskSchedulerThreads);
+ base::SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess();
blocking_pool_ = new base::SequencedWorkerPool(
3, "ServiceBlocking", base::TaskPriority::USER_VISIBLE);
@@ -264,6 +267,9 @@ bool ServiceProcess::Teardown() {
blocking_pool_ = NULL;
}
+ if (base::TaskScheduler::GetInstance())
+ base::TaskScheduler::GetInstance()->Shutdown();
+
// The NetworkChangeNotifier must be destroyed after all other threads that
// might use it have been shut down.
network_change_notifier_.reset();
« 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