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

Issue 2608963002: Use TaskScheduler instead of WorkerPool in page_handler.cc. (Closed)

Created:
3 years, 11 months ago by fdoray
Modified:
3 years, 11 months ago
Reviewers:
dgozman
CC:
chromium-reviews, jam, darin-cc_chromium.org, pfeldman, devtools-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use TaskScheduler instead of WorkerPool in page_handler.cc. The following traits are used: Priority: Inherited (default) The priority is inherited from the calling context (i.e. TaskTraits are initialized with the priority of the current task). Shutdown behavior: CONTINUE_ON_SHUTDOWN Tasks posted with this mode which have not started executing before shutdown is initiated will never run. Tasks with this mode running at shutdown will be ignored (the worker will not be joined). Note: Tasks that were previously posted to base::WorkerPool should use this shutdown behavior because this is how base::WorkerPool handles all its tasks. Does Not Block (default): Tasks without the MayBlock() and WithBaseSyncPrimitives() traits may not block. BUG=659191 Committed: https://crrev.com/375ad9dd131cbc748491195c7bb43bbcfefe76fa Cr-Commit-Position: refs/heads/master@{#441180}

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -3 lines) Patch
M content/browser/devtools/protocol/page_handler.cc View 2 chunks +4 lines, -3 lines 0 comments Download

Messages

Total messages: 17 (9 generated)
fdoray
PTAL. WorkerPool is being deprecated in favor of TaskScheduler.
3 years, 11 months ago (2017-01-01 19:20:57 UTC) #6
dgozman
Is there a doc or a guide outlining new traits system? From the new code ...
3 years, 11 months ago (2017-01-02 04:48:41 UTC) #7
fdoray
On 2017/01/02 04:48:41, dgozman wrote: > Is there a doc or a guide outlining new ...
3 years, 11 months ago (2017-01-02 16:55:16 UTC) #8
dgozman
On 2017/01/02 16:55:16, fdoray wrote: > On 2017/01/02 04:48:41, dgozman wrote: > > Is there ...
3 years, 11 months ago (2017-01-03 18:02:47 UTC) #9
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/2608963002/1
3 years, 11 months ago (2017-01-03 18:06:15 UTC) #11
commit-bot: I haz the power
Committed patchset #1 (id:1)
3 years, 11 months ago (2017-01-03 19:19:09 UTC) #14
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/375ad9dd131cbc748491195c7bb43bbcfefe76fa Cr-Commit-Position: refs/heads/master@{#441180}
3 years, 11 months ago (2017-01-03 19:22:30 UTC) #16
fdoray
3 years, 11 months ago (2017-01-04 16:38:32 UTC) #17
Message was sent while issue was closed.
On 2017/01/03 18:02:47, dgozman wrote:
> On 2017/01/02 16:55:16, fdoray wrote:
> > On 2017/01/02 04:48:41, dgozman wrote:
> > > Is there a doc or a guide outlining new traits system?
> > > 
> > > From the new code it's not clear for me where does the task go, is it
> blocking
> > > some important thread, or on which thread the objects I passed with
> ownership
> > > will be destroyed.
> > 
> > You can learn a lot about TaskScheduler by reading comments in
> > base/task_scheduler/post_task.h and base/task_scheduler/task_traits.h. You
can
> > also read the full design doc :
> >
>
https://docs.google.com/a/chromium.org/document/d/1S2AAeoo1xa_vsLbDYBsDHCqhrk...
> > 
> > Tl;Dr
> > 
> > TaskScheduler is a dynamic thread pool. It creates/destroys threads
depending
> on
> > workload. All tasks are associated with traits. The WithPriority() trait
> > determines in which order tasks are scheduled. Tasks without an explicit
> > WithPriority() trait inherit their priority from the calling context
> > (USER_VISIBLE by default). See CL description for the WithShutdownBehavior()
> > trait. The MayBlock() trait is used on some platforms as an indicator that
the
> > task is probably not using the CPU when it takes a lot of time to run (and
> hence
> > that new threads should be created to maximize CPU utilization). On other
> > platforms, CPU utilization of tasks is measured dynamically using OS APIs.
> > 
> > Since TaskScheduler creates/destroys threads on demand, your task cannot
block
> > anything forever. Arguments are destroyed right after the task runs (on the
> same
> > thread). This is the same behavior as base::WorkerPool, to which the task
was
> > posted before this CL.
> 
> Thanks for explanation. I think it would've been helpful to include that
> information into the bug linked.
> I'm probably not the only one who wants to know what's happening.
> 
> lgtm

I update the bug description with the information I provided you in this CL.

Powered by Google App Engine
This is Rietveld 408576698