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

Issue 2405243003: TaskScheduler: Replace the SchedulerServiceThread with a base::Thread. (Closed)

Created:
4 years, 2 months ago by fdoray
Modified:
4 years, 2 months ago
Reviewers:
robliao, danakj, gab
CC:
chromium-reviews, gab+watch_chromium.org, robliao+watch_chromium.org, fdoray+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

TaskScheduler: Replace the SchedulerServiceThread with a base::Thread. In order to support the FileDescriptorWatcher API within TaskScheduler, the service thread needs to run a MessageLoopForIO on POSIX. The simplest way to run a MessageLoopForIO is to use a base::Thread. BUG=553459 TBR=danakj@chromium.org Committed: https://crrev.com/546624d0d8ab564a914e669a0437cc51f0222aea Cr-Commit-Position: refs/heads/master@{#425474}

Patch Set 1 #

Patch Set 2 : self-review #

Total comments: 11

Patch Set 3 : CR robliao #3 #

Patch Set 4 : CR robliao #7 #

Patch Set 5 : self-review #

Total comments: 2

Patch Set 6 : CR robliao #9 #

Total comments: 16
Unified diffs Side-by-side diffs Delta from patch set Stats (+143 lines, -707 lines) Patch
M base/BUILD.gn View 1 2 3 2 chunks +0 lines, -3 lines 0 comments Download
D base/task_scheduler/delayed_task_manager.h View 1 2 3 4 2 chunks +15 lines, -46 lines 2 comments Download
D base/task_scheduler/delayed_task_manager.cc View 1 2 3 4 2 chunks +14 lines, -121 lines 3 comments Download
D base/task_scheduler/delayed_task_manager_unittest.cc View 1 2 3 4 5 3 chunks +46 lines, -138 lines 2 comments Download
D base/task_scheduler/scheduler_service_thread.h View 1 chunk +0 lines, -50 lines 0 comments Download
D base/task_scheduler/scheduler_service_thread.cc View 1 chunk +0 lines, -102 lines 0 comments Download
D base/task_scheduler/scheduler_service_thread_unittest.cc View 1 chunk +0 lines, -188 lines 0 comments Download
M base/task_scheduler/scheduler_worker_pool_impl.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M base/task_scheduler/scheduler_worker_pool_impl_unittest.cc View 1 2 3 4 5 4 chunks +39 lines, -36 lines 5 comments Download
M base/task_scheduler/task.h View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M base/task_scheduler/task.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M base/task_scheduler/task_scheduler_impl.h View 1 2 3 1 chunk +2 lines, -6 lines 0 comments Download
M base/task_scheduler/task_scheduler_impl.cc View 1 2 3 5 chunks +21 lines, -15 lines 4 comments Download

Messages

Total messages: 26 (10 generated)
fdoray
PTAL
4 years, 2 months ago (2016-10-11 15:50:23 UTC) #2
robliao
This particular approach looks fine. I've suggested an alternative approach that keeps the DelayedTaskManager around. ...
4 years, 2 months ago (2016-10-12 20:55:45 UTC) #3
fdoray
PTAnL https://codereview.chromium.org/2405243003/diff/20001/base/task_scheduler/delayed_task_manager.cc File base/task_scheduler/delayed_task_manager.cc (left): https://codereview.chromium.org/2405243003/diff/20001/base/task_scheduler/delayed_task_manager.cc#oldcode56 base/task_scheduler/delayed_task_manager.cc:56: void DelayedTaskManager::AddDelayedTask(std::unique_ptr<Task> task, On 2016/10/12 20:55:45, robliao wrote: ...
4 years, 2 months ago (2016-10-13 13:51:30 UTC) #4
robliao
https://codereview.chromium.org/2405243003/diff/20001/base/task_scheduler/delayed_task_manager.cc File base/task_scheduler/delayed_task_manager.cc (left): https://codereview.chromium.org/2405243003/diff/20001/base/task_scheduler/delayed_task_manager.cc#oldcode56 base/task_scheduler/delayed_task_manager.cc:56: void DelayedTaskManager::AddDelayedTask(std::unique_ptr<Task> task, On 2016/10/13 13:51:29, fdoray wrote: > ...
4 years, 2 months ago (2016-10-13 17:03:39 UTC) #5
fdoray
On 2016/10/13 17:03:39, robliao wrote: > https://codereview.chromium.org/2405243003/diff/20001/base/task_scheduler/delayed_task_manager.cc > File base/task_scheduler/delayed_task_manager.cc (left): > > https://codereview.chromium.org/2405243003/diff/20001/base/task_scheduler/delayed_task_manager.cc#oldcode56 > ...
4 years, 2 months ago (2016-10-13 18:30:10 UTC) #6
robliao
On 2016/10/13 18:30:10, fdoray wrote: > On 2016/10/13 17:03:39, robliao wrote: > > > https://codereview.chromium.org/2405243003/diff/20001/base/task_scheduler/delayed_task_manager.cc ...
4 years, 2 months ago (2016-10-13 18:33:43 UTC) #7
fdoray
PTAnL The service thread can wake up a SchedulerWorker that has been joined when a ...
4 years, 2 months ago (2016-10-13 20:13:00 UTC) #8
robliao
Thanks! lgtm + nit. https://codereview.chromium.org/2405243003/diff/80001/base/task_scheduler/delayed_task_manager_unittest.cc File base/task_scheduler/delayed_task_manager_unittest.cc (right): https://codereview.chromium.org/2405243003/diff/80001/base/task_scheduler/delayed_task_manager_unittest.cc#newcode25 base/task_scheduler/delayed_task_manager_unittest.cc:25: constexpr TimeDelta kDelay = TimeDelta::FromHours(1); ...
4 years, 2 months ago (2016-10-14 18:15:28 UTC) #9
fdoray
https://codereview.chromium.org/2405243003/diff/80001/base/task_scheduler/delayed_task_manager_unittest.cc File base/task_scheduler/delayed_task_manager_unittest.cc (right): https://codereview.chromium.org/2405243003/diff/80001/base/task_scheduler/delayed_task_manager_unittest.cc#newcode25 base/task_scheduler/delayed_task_manager_unittest.cc:25: constexpr TimeDelta kDelay = TimeDelta::FromHours(1); On 2016/10/14 18:15:28, robliao ...
4 years, 2 months ago (2016-10-14 20:05:33 UTC) #10
fdoray
+danakj@ TBR for base/BUILD.gn
4 years, 2 months ago (2016-10-14 20:06:23 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2405243003/100001
4 years, 2 months ago (2016-10-14 20:07:15 UTC) #18
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 2 months ago (2016-10-14 21:40:59 UTC) #20
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/546624d0d8ab564a914e669a0437cc51f0222aea Cr-Commit-Position: refs/heads/master@{#425474}
4 years, 2 months ago (2016-10-14 21:43:27 UTC) #22
gab
lgtm % comments https://codereview.chromium.org/2405243003/diff/100001/base/task_scheduler/delayed_task_manager.cc File base/task_scheduler/delayed_task_manager.cc (right): https://codereview.chromium.org/2405243003/diff/100001/base/task_scheduler/delayed_task_manager.cc#newcode40 base/task_scheduler/delayed_task_manager.cc:40: Unretained(worker_pool), Passed(std::move(task)), std::move not required inside ...
4 years, 2 months ago (2016-10-17 19:09:19 UTC) #24
fdoray
Comments addressed in https://codereview.chromium.org/2426813004/ https://codereview.chromium.org/2405243003/diff/100001/base/task_scheduler/delayed_task_manager.cc File base/task_scheduler/delayed_task_manager.cc (right): https://codereview.chromium.org/2405243003/diff/100001/base/task_scheduler/delayed_task_manager.cc#newcode40 base/task_scheduler/delayed_task_manager.cc:40: Unretained(worker_pool), Passed(std::move(task)), On 2016/10/17 19:09:18, ...
4 years, 2 months ago (2016-10-18 20:10:49 UTC) #25
gab
4 years, 2 months ago (2016-10-18 20:59:03 UTC) #26
Message was sent while issue was closed.
Thanks, reply below FTR

https://codereview.chromium.org/2405243003/diff/100001/base/task_scheduler/de...
File base/task_scheduler/delayed_task_manager.cc (right):

https://codereview.chromium.org/2405243003/diff/100001/base/task_scheduler/de...
base/task_scheduler/delayed_task_manager.cc:40: Unretained(worker_pool),
Passed(std::move(task)),
On 2016/10/18 20:10:49, fdoray wrote:
> On 2016/10/17 19:09:18, gab wrote:
> > std::move not required inside Passed() IIRC
> 
> It's required. See other call sites
>
https://cs.chromium.org/chromium/src/base/bind_helpers.h?sq=package:chromium&...
> 
> c:\src\chromium\src\base\task_scheduler\delayed_task_manager.cc(40): error
> C2672: 'Passed': no matching overloaded function found
> c:\src\chromium\src\base\task_scheduler\delayed_task_manager.cc(40): error
> C2784: 'base::internal::PassedWrapper<T> base::Passed(T *)': could not deduce
> template argument for 'T *' from
> 'std::unique_ptr<base::internal::Task,std::default_delete<_Ty>>'
>         with
>         [
>             _Ty=base::internal::Task
>         ]
> c:\src\chromium\src\base\bind_helpers.h(444): note: see declaration of
> 'base::Passed'
> c:\src\chromium\src\base\task_scheduler\delayed_task_manager.cc(40): error
> C2783: 'base::internal::PassedWrapper<T> base::Passed(T &&)': could not deduce
> template argument for '__formal'
> c:\src\chromium\src\base\bind_helpers.h(440): note: see declaration of
> 'base::Passed'
> c:\src\chromium\src\base\task_scheduler\delayed_task_manager.cc(42): error
> C2664: 'bool base::TaskRunner::PostDelayedTask(const tracked_objects::Location
> &,const base::Closure &,base::TimeDelta)': cannot convert argument 2 from
> 'base::Callback<R (base::internal::SchedulerWorker
> *),base::internal::CopyMode::Copyable,base::internal::RepeatMode::Repeating>'
to
> 'const base::Closure &'
>         with
>         [
>             R=void
>         ]
> c:\src\chromium\src\base\task_scheduler\delayed_task_manager.cc(42): note:
> Reason: cannot convert from 'base::Callback<R (base::internal::SchedulerWorker
> *),base::internal::CopyMode::Copyable,base::internal::RepeatMode::Repeating>'
to
> 'const base::Closure'
>         with
>         [
>             R=void
>         ]
> c:\src\chromium\src\base\task_scheduler\delayed_task_manager.cc(42): note: No
> user-defined-conversion operator available that can perform this conversion,
or
> the operator cannot be called

Ah interesting, in retrospect it makes sense. base::Passed was previously
adapted to work with scoped_ptr (which was a hack with MOVE_ONLY_CPP03 macro or
something) but I guess it can't work around it for std::unique_ptr (i.e. can't
fake an rvalue). This mostly makes base::Passed outdated I think but wtv that's
beyond this CL and it's still required in today's Bind world.

Powered by Google App Engine
This is Rietveld 408576698