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

Issue 1708773002: TaskScheduler [7] SchedulerThreadPool (Closed)

Created:
4 years, 10 months ago by fdoray
Modified:
4 years, 8 months ago
Reviewers:
robliao, danakj, gab
CC:
chromium-reviews, vmpstr+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@s_5_worker_thread
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

TaskScheduler [7] SchedulerThreadPool A SchedulerThreadPool manages a pool of threads that run Tasks. It provides a CreateTaskRunnerWithTraits() method to create TaskRunners whose PostTask invocations will result in scheduling Tasks on these threads. For now, only the PARALLEL ExecutionMode is supported. This change is a subset of https://codereview.chromium.org/1698183005/ BUG=553459 Committed: https://crrev.com/7422e74e0ca8ff3bada133fce426c59a8094040c Cr-Commit-Position: refs/heads/master@{#387593}

Patch Set 1 #

Patch Set 2 : initial implementation for review #

Patch Set 3 : self review #

Patch Set 4 : self review #

Total comments: 30

Patch Set 5 : CR robliao #10 #

Patch Set 6 : CR robliao #12 #

Patch Set 7 : Use std::unique_ptr, rename ThreadPool -> SchedulerThreadPool. #

Total comments: 8

Patch Set 8 : CR robliao #15 #

Patch Set 9 : TaskFactory in unit tests. #

Patch Set 10 : format #

Patch Set 11 : TaskFactory::PostTask #

Patch Set 12 : self review #

Patch Set 13 : self review #

Patch Set 14 : self review #

Patch Set 15 : self review #

Patch Set 16 : self review #

Patch Set 17 : self review #

Patch Set 18 : self review #

Total comments: 24

Patch Set 19 : CR danakj #19 #

Patch Set 20 : self review #

Patch Set 21 : self review #

Patch Set 22 : merge SchedulerWorkerThreadDelegate #

Total comments: 55

Patch Set 23 : merge SchedulerWorkerThread::Delegate #

Patch Set 24 : move PostTaskHelper to its own file #

Patch Set 25 : self review #

Total comments: 17

Patch Set 26 : CR gab/danakj #21-22 #

Patch Set 27 : self review #

Patch Set 28 : add SchedulerWorkerThreadDelegateImpl #

Total comments: 10

Patch Set 29 : CR gab/danakj #25-26 #

Total comments: 2

Patch Set 30 : CR gab #28 (rename lock) #

Patch Set 31 : Wake up a thread explicitly when a Sequence is added in a PQ. #

Total comments: 31

Patch Set 32 : CR robliao #35 #

Total comments: 15

Patch Set 33 : CR gab #37-40 #

Patch Set 34 : self review #

Total comments: 11

Patch Set 35 : CR danakj #43 #

Patch Set 36 : remove static_assert #

Patch Set 37 : fix windows build error #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1026 lines, -0 lines) Patch
M base/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 3 chunks +7 lines, -0 lines 0 comments Download
M base/base.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +2 lines, -0 lines 0 comments Download
M base/base.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2 chunks +5 lines, -0 lines 0 comments Download
M base/task_scheduler/priority_queue.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +2 lines, -0 lines 0 comments Download
A base/task_scheduler/scheduler_task_executor.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 1 chunk +33 lines, -0 lines 0 comments Download
A base/task_scheduler/scheduler_thread_pool.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 1 chunk +134 lines, -0 lines 0 comments Download
A base/task_scheduler/scheduler_thread_pool.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 1 chunk +277 lines, -0 lines 0 comments Download
A base/task_scheduler/scheduler_thread_pool_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 1 chunk +307 lines, -0 lines 0 comments Download
M base/task_scheduler/task_traits.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 1 chunk +2 lines, -0 lines 0 comments Download
M base/task_scheduler/task_traits.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 35 1 chunk +5 lines, -0 lines 0 comments Download
A base/task_scheduler/utils.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 1 chunk +50 lines, -0 lines 0 comments Download
A base/task_scheduler/utils.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 1 chunk +74 lines, -0 lines 0 comments Download
A base/task_scheduler/utils_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 1 chunk +128 lines, -0 lines 0 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 62 (20 generated)
fdoray
Can you review this CL? Thanks.
4 years, 10 months ago (2016-02-17 20:22:37 UTC) #2
fdoray
robliao@: Can you review this CL? Thanks.
4 years, 8 months ago (2016-03-31 18:52:56 UTC) #9
robliao
A first pass https://codereview.chromium.org/1708773002/diff/60001/base/task_scheduler/thread_pool.cc File base/task_scheduler/thread_pool.cc (right): https://codereview.chromium.org/1708773002/diff/60001/base/task_scheduler/thread_pool.cc#newcode25 base/task_scheduler/thread_pool.cc:25: void PostTaskCallback(scoped_refptr<Sequence> sequence, Wasn't this and ...
4 years, 8 months ago (2016-03-31 22:48:56 UTC) #10
fdoray
robliao@: Can you take another look? Thanks. https://codereview.chromium.org/1708773002/diff/60001/base/task_scheduler/thread_pool.cc File base/task_scheduler/thread_pool.cc (right): https://codereview.chromium.org/1708773002/diff/60001/base/task_scheduler/thread_pool.cc#newcode25 base/task_scheduler/thread_pool.cc:25: void PostTaskCallback(scoped_refptr<Sequence> ...
4 years, 8 months ago (2016-04-01 16:02:52 UTC) #11
robliao
https://codereview.chromium.org/1708773002/diff/60001/base/task_scheduler/thread_pool.cc File base/task_scheduler/thread_pool.cc (right): https://codereview.chromium.org/1708773002/diff/60001/base/task_scheduler/thread_pool.cc#newcode25 base/task_scheduler/thread_pool.cc:25: void PostTaskCallback(scoped_refptr<Sequence> sequence, On 2016/04/01 16:02:51, fdoray wrote: > ...
4 years, 8 months ago (2016-04-01 19:14:49 UTC) #12
fdoray
robliao@: Can you take another look? Thanks. https://codereview.chromium.org/1708773002/diff/60001/base/task_scheduler/thread_pool.cc File base/task_scheduler/thread_pool.cc (right): https://codereview.chromium.org/1708773002/diff/60001/base/task_scheduler/thread_pool.cc#newcode25 base/task_scheduler/thread_pool.cc:25: void PostTaskCallback(scoped_refptr<Sequence> ...
4 years, 8 months ago (2016-04-01 20:16:45 UTC) #13
robliao
lgtm + nits. https://codereview.chromium.org/1708773002/diff/120001/base/task_scheduler/scheduler_thread_pool.cc File base/task_scheduler/scheduler_thread_pool.cc (right): https://codereview.chromium.org/1708773002/diff/120001/base/task_scheduler/scheduler_thread_pool.cc#newcode124 base/task_scheduler/scheduler_thread_pool.cc:124: // If |worker_thread| belongs to this ...
4 years, 8 months ago (2016-04-01 21:05:52 UTC) #15
fdoray
danakj@: Can you review this CL? Thanks. robliao@: All done. Thanks for the reviews. https://codereview.chromium.org/1708773002/diff/120001/base/task_scheduler/scheduler_thread_pool.cc ...
4 years, 8 months ago (2016-04-01 21:45:31 UTC) #17
danakj
https://codereview.chromium.org/1708773002/diff/330001/base/task_scheduler/scheduler_thread_pool.cc File base/task_scheduler/scheduler_thread_pool.cc (right): https://codereview.chromium.org/1708773002/diff/330001/base/task_scheduler/scheduler_thread_pool.cc#newcode41 base/task_scheduler/scheduler_thread_pool.cc:41: DCHECK(delay.is_zero()); Can you leave a comment in this method ...
4 years, 8 months ago (2016-04-05 00:27:59 UTC) #19
fdoray
danakj@: Can you take another look? This CL now depends on these 2 small CLs: ...
4 years, 8 months ago (2016-04-06 19:31:02 UTC) #20
gab
Another great component :-), thanks for keeping SEQUENCED/SINGLE_THREAD/dynamic thread creation for future CLs this one ...
4 years, 8 months ago (2016-04-07 20:32:48 UTC) #21
danakj
https://codereview.chromium.org/1708773002/diff/410001/base/task_scheduler/scheduler_thread_pool.h File base/task_scheduler/scheduler_thread_pool.h (right): https://codereview.chromium.org/1708773002/diff/410001/base/task_scheduler/scheduler_thread_pool.h#newcode112 base/task_scheduler/scheduler_thread_pool.h:112: std::unique_ptr<ConditionVariable> idle_worker_threads_stack_cv_; On 2016/04/07 20:32:48, gab wrote: > Should ...
4 years, 8 months ago (2016-04-07 23:08:44 UTC) #22
fdoray
https://codereview.chromium.org/1708773002/diff/410001/base/task_scheduler/scheduler_thread_pool.cc File base/task_scheduler/scheduler_thread_pool.cc (right): https://codereview.chromium.org/1708773002/diff/410001/base/task_scheduler/scheduler_thread_pool.cc#newcode44 base/task_scheduler/scheduler_thread_pool.cc:44: // Create a new Sequence to allow parallel execution ...
4 years, 8 months ago (2016-04-08 14:53:03 UTC) #23
fdoray
danakj@/gab@: Can you take another look? Thanks. https://codereview.chromium.org/1708773002/diff/470001/base/task_scheduler/scheduler_thread_pool.h File base/task_scheduler/scheduler_thread_pool.h (right): https://codereview.chromium.org/1708773002/diff/470001/base/task_scheduler/scheduler_thread_pool.h#newcode88 base/task_scheduler/scheduler_thread_pool.h:88: // SchedulerWorkerThread::Delegate: ...
4 years, 8 months ago (2016-04-08 15:41:10 UTC) #24
gab
Review of diff from 22=>28. https://codereview.chromium.org/1708773002/diff/410001/base/base.gypi File base/base.gypi (right): https://codereview.chromium.org/1708773002/diff/410001/base/base.gypi#newcode649 base/base.gypi:649: 'task_scheduler/scheduler_worker_thread_delegate.h', Careful with doing ...
4 years, 8 months ago (2016-04-08 17:56:00 UTC) #25
danakj
https://codereview.chromium.org/1708773002/diff/470001/base/task_scheduler/scheduler_thread_pool.h File base/task_scheduler/scheduler_thread_pool.h (right): https://codereview.chromium.org/1708773002/diff/470001/base/task_scheduler/scheduler_thread_pool.h#newcode34 base/task_scheduler/scheduler_thread_pool.h:34: class BASE_EXPORT SchedulerThreadPool : public SchedulerWorkerThread::Delegate { On 2016/04/08 ...
4 years, 8 months ago (2016-04-08 18:05:32 UTC) #26
fdoray
gab@/danakj@: Can you take another look? Let me know if you disagree with my arguments ...
4 years, 8 months ago (2016-04-08 19:00:06 UTC) #27
gab
lgtm w/ nits (didn't review utils*, assuming it's just a cut/paste from the previously reviewed ...
4 years, 8 months ago (2016-04-08 21:10:51 UTC) #28
fdoray
danakj@: Can you take another look? Thanks. https://codereview.chromium.org/1708773002/diff/470001/base/task_scheduler/scheduler_thread_pool.h File base/task_scheduler/scheduler_thread_pool.h (right): https://codereview.chromium.org/1708773002/diff/470001/base/task_scheduler/scheduler_thread_pool.h#newcode34 base/task_scheduler/scheduler_thread_pool.h:34: class BASE_EXPORT ...
4 years, 8 months ago (2016-04-11 13:52:26 UTC) #29
fdoray
danakj@: Can you take another look? Thanks. https://codereview.chromium.org/1708773002/diff/470001/base/task_scheduler/utils.cc File base/task_scheduler/utils.cc (right): https://codereview.chromium.org/1708773002/diff/470001/base/task_scheduler/utils.cc#newcode18 base/task_scheduler/utils.cc:18: bool PostTaskHelper(std::unique_ptr<Task> ...
4 years, 8 months ago (2016-04-11 14:25:46 UTC) #30
fdoray
danakj@: Can you take another look? Post non-delayed task: TaskRunner::PostTask PostTaskHelper SchedulerTaskExecutor::PostTaskNow (STP or SWT) ...
4 years, 8 months ago (2016-04-13 14:37:18 UTC) #31
robliao
On 2016/04/13 14:37:18, fdoray wrote: > danakj@: Can you take another look? > > Post ...
4 years, 8 months ago (2016-04-13 17:56:39 UTC) #32
robliao
On 2016/04/13 17:56:39, robliao wrote: > On 2016/04/13 14:37:18, fdoray wrote: > > danakj@: Can ...
4 years, 8 months ago (2016-04-13 20:42:40 UTC) #33
robliao
On 2016/04/13 17:56:39, robliao wrote: > On 2016/04/13 14:37:18, fdoray wrote: > > danakj@: Can ...
4 years, 8 months ago (2016-04-13 20:42:44 UTC) #34
robliao
Let's try this again. https://codereview.chromium.org/1708773002/diff/590001/base/task_scheduler/scheduler_task_executor.h File base/task_scheduler/scheduler_task_executor.h (right): https://codereview.chromium.org/1708773002/diff/590001/base/task_scheduler/scheduler_task_executor.h#newcode23 base/task_scheduler/scheduler_task_executor.h:23: // delayed run time of ...
4 years, 8 months ago (2016-04-13 20:50:55 UTC) #35
fdoray
danakj@: Can you take another look? Post non-delayed task: TaskRunner::PostTask PostTaskHelper SchedulerTaskExecutor::PostTaskWithSequence (STP or SWT) ...
4 years, 8 months ago (2016-04-13 23:13:13 UTC) #36
gab
Some comments, but still lgtm overall, thanks! https://codereview.chromium.org/1708773002/diff/590001/base/task_scheduler/scheduler_thread_pool.cc File base/task_scheduler/scheduler_thread_pool.cc (right): https://codereview.chromium.org/1708773002/diff/590001/base/task_scheduler/scheduler_thread_pool.cc#newcode237 base/task_scheduler/scheduler_thread_pool.cc:237: { On ...
4 years, 8 months ago (2016-04-14 16:11:35 UTC) #37
robliao
https://codereview.chromium.org/1708773002/diff/590001/base/task_scheduler/scheduler_thread_pool.cc File base/task_scheduler/scheduler_thread_pool.cc (right): https://codereview.chromium.org/1708773002/diff/590001/base/task_scheduler/scheduler_thread_pool.cc#newcode237 base/task_scheduler/scheduler_thread_pool.cc:237: { On 2016/04/14 16:11:34, gab wrote: > On 2016/04/13 ...
4 years, 8 months ago (2016-04-14 16:43:38 UTC) #38
robliao
https://codereview.chromium.org/1708773002/diff/610001/base/task_scheduler/scheduler_thread_pool.cc File base/task_scheduler/scheduler_thread_pool.cc (right): https://codereview.chromium.org/1708773002/diff/610001/base/task_scheduler/scheduler_thread_pool.cc#newcode46 base/task_scheduler/scheduler_thread_pool.cc:46: return tls_current_thread_pool.Get().Get() == executor_; On 2016/04/14 16:11:35, gab wrote: ...
4 years, 8 months ago (2016-04-14 17:06:28 UTC) #39
gab
https://codereview.chromium.org/1708773002/diff/610001/base/task_scheduler/scheduler_thread_pool.cc File base/task_scheduler/scheduler_thread_pool.cc (right): https://codereview.chromium.org/1708773002/diff/610001/base/task_scheduler/scheduler_thread_pool.cc#newcode46 base/task_scheduler/scheduler_thread_pool.cc:46: return tls_current_thread_pool.Get().Get() == executor_; On 2016/04/14 17:06:28, robliao wrote: ...
4 years, 8 months ago (2016-04-14 18:28:21 UTC) #40
fdoray
danakj@: Can you take another look? Post non-delayed task: TaskRunner::PostTask PostTaskHelper SchedulerTaskExecutor::PostTaskWithSequence (STP or SWT) ...
4 years, 8 months ago (2016-04-14 18:41:12 UTC) #41
gab
Minor comments https://codereview.chromium.org/1708773002/diff/610001/base/task_scheduler/scheduler_thread_pool.h File base/task_scheduler/scheduler_thread_pool.h (right): https://codereview.chromium.org/1708773002/diff/610001/base/task_scheduler/scheduler_thread_pool.h#newcode97 base/task_scheduler/scheduler_thread_pool.h:97: void PostTaskWithSequence(std::unique_ptr<Task> task, On 2016/04/14 18:41:12, fdoray ...
4 years, 8 months ago (2016-04-14 19:34:17 UTC) #42
danakj
LGTM w/ a few comments. https://codereview.chromium.org/1708773002/diff/590001/base/task_scheduler/scheduler_thread_pool.cc File base/task_scheduler/scheduler_thread_pool.cc (right): https://codereview.chromium.org/1708773002/diff/590001/base/task_scheduler/scheduler_thread_pool.cc#newcode158 base/task_scheduler/scheduler_thread_pool.cc:158: const EnqueueSequenceCallback enqueue_sequence_callback) const&? ...
4 years, 8 months ago (2016-04-14 19:48:58 UTC) #43
robliao
https://codereview.chromium.org/1708773002/diff/650001/base/task_scheduler/task_traits.cc File base/task_scheduler/task_traits.cc (right): https://codereview.chromium.org/1708773002/diff/650001/base/task_scheduler/task_traits.cc#newcode38 base/task_scheduler/task_traits.cc:38: return with_file_io_ == other.with_file_io_ && priority_ == other.priority_ && ...
4 years, 8 months ago (2016-04-14 20:32:05 UTC) #44
fdoray
Thanks for the reviews! https://codereview.chromium.org/1708773002/diff/590001/base/task_scheduler/scheduler_thread_pool.cc File base/task_scheduler/scheduler_thread_pool.cc (right): https://codereview.chromium.org/1708773002/diff/590001/base/task_scheduler/scheduler_thread_pool.cc#newcode158 base/task_scheduler/scheduler_thread_pool.cc:158: const EnqueueSequenceCallback enqueue_sequence_callback) On 2016/04/14 ...
4 years, 8 months ago (2016-04-14 23:46:59 UTC) #45
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1708773002/670001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1708773002/670001
4 years, 8 months ago (2016-04-15 01:12:38 UTC) #48
commit-bot: I haz the power
Try jobs failed on following builders: chromeos_amd64-generic_chromium_compile_only_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_amd64-generic_chromium_compile_only_ng/builds/122276) chromeos_daisy_chromium_compile_only_ng on tryserver.chromium.linux (JOB_FAILED, ...
4 years, 8 months ago (2016-04-15 01:23:26 UTC) #50
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1708773002/690001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1708773002/690001
4 years, 8 months ago (2016-04-15 02:27:53 UTC) #53
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_compile_dbg_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_compile_dbg_ng/builds/175076)
4 years, 8 months ago (2016-04-15 03:36:38 UTC) #55
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1708773002/710001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1708773002/710001
4 years, 8 months ago (2016-04-15 13:06:48 UTC) #58
commit-bot: I haz the power
Committed patchset #37 (id:710001)
4 years, 8 months ago (2016-04-15 14:09:22 UTC) #60
commit-bot: I haz the power
4 years, 8 months ago (2016-04-15 14:10:40 UTC) #62
Message was sent while issue was closed.
Patchset 37 (id:??) landed as
https://crrev.com/7422e74e0ca8ff3bada133fce426c59a8094040c
Cr-Commit-Position: refs/heads/master@{#387593}

Powered by Google App Engine
This is Rietveld 408576698