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

Unified Diff: base/task_scheduler/task_scheduler_impl.cc

Issue 2426813004: TaskScheduler: Nits in service thread and delayed tasks code. (Closed)
Patch Set: Created 4 years, 2 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 | « base/task_scheduler/scheduler_worker_pool_impl_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/task_scheduler_impl.cc
diff --git a/base/task_scheduler/task_scheduler_impl.cc b/base/task_scheduler/task_scheduler_impl.cc
index a3fc0d3830b99086093df55a4acab424195b921f..4a1feb13ef3103405dc2c8a87b6f1caccb9f4a48 100644
--- a/base/task_scheduler/task_scheduler_impl.cc
+++ b/base/task_scheduler/task_scheduler_impl.cc
@@ -84,7 +84,8 @@ void TaskSchedulerImpl::Initialize(
const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector) {
DCHECK(!worker_pool_params_vector.empty());
- // Start the service thread.
+ // Start the service thread. On POSIX, the service thread runs a
+ // MessageLoopForIO to support FileDescriptorWatcher.
constexpr MessageLoop::Type kServiceThreadMessageLoopType =
#if defined(OS_POSIX)
MessageLoop::TYPE_IO;
@@ -95,15 +96,15 @@ void TaskSchedulerImpl::Initialize(
CHECK(service_thread_.StartWithOptions(
Thread::Options(kServiceThreadMessageLoopType, kDefaultStackSize)));
- const SchedulerWorkerPoolImpl::ReEnqueueSequenceCallback
- re_enqueue_sequence_callback =
- Bind(&TaskSchedulerImpl::ReEnqueueSequenceCallback, Unretained(this));
-
// Instantiate the DelayedTaskManager. The service thread must be started
// before its TaskRunner is available.
delayed_task_manager_ =
base::MakeUnique<DelayedTaskManager>(service_thread_.task_runner());
+ const SchedulerWorkerPoolImpl::ReEnqueueSequenceCallback
robliao 2016/10/18 20:21:43 What the motivation for this reordering?
gab 2016/10/18 20:50:40 It's only required below and |delayed_task_manager
+ re_enqueue_sequence_callback =
+ Bind(&TaskSchedulerImpl::ReEnqueueSequenceCallback, Unretained(this));
+
// Start worker pools.
for (const auto& worker_pool_params : worker_pool_params_vector) {
// Passing pointers to objects owned by |this| to
« no previous file with comments | « base/task_scheduler/scheduler_worker_pool_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698