Re: Add SequencedTaskRunner::PostTaskAndReplyWithResult()?

1 view
Skip to first unread message

Alexander Timin

unread,
Jan 29, 2020, 12:02:30 PM1/29/20
to Gabriel Charette, platform-architecture-dev, Kentaro Hara, François Doray, Darin Fisher, scheduler-dev, Dana Jansens, Albert Wong

+Kentaro Hara +platform-architecture-dev 

I think that from the Blink perspective we might want this to be a static function, which can be banned in blink.
The main reason is that we want to enforce a dedicated callback type for cross-thread task posting (WTF::CrossThreadOnceClosure) to be used, which guarantees that on-heap objects are correctly passed across threads (see blink::PostCrossThreadTask).



On Wed, 29 Jan 2020 at 01:59, Gabriel Charette <g...@chromium.org> wrote:

On Tue, Jan 28, 2020 at 8:44 PM François Doray <fdo...@chromium.org> wrote:
+1 to adding on TaskRunner

Le mar. 28 janv. 2020 20 h 35, Gabriel Charette <g...@chromium.org> a écrit :


On Tue, Jan 28, 2020 at 7:32 PM Darin Fisher <da...@chromium.org> wrote:
Actually, shouldn't it be added to TaskRunner rather than SequencedTaskRunner?

Ah, yes indeed :)
 

-Darin

On Tue, Jan 28, 2020 at 4:30 PM Darin Fisher <da...@chromium.org> wrote:
+1

On Tue, Jan 28, 2020 at 4:29 PM Gabriel Charette <g...@chromium.org> wrote:
Hello folks,

as I'm migrating to task APIs v3. I realize that we now have base::ThreadPool::PostTaskAndReplyWithResult() but not base::SequencedTaskRunner::PostTaskAndReplyWithResult().

This makes the migration from base::PostTaskAndReplyWithResult(FROM_HERE, {BrowserThread::IO}, ...) weird as it can't just become content::GetIOThreadTaskRunner({})->PostTaskAndReplyWithResult() like all the other Post(Delayed)?Task(AndReply)? variants will.

I don't see a good reason for PostTaskAndReplyWithResult() to be a separate helper (on task_runner_util.h) anymore.

Thoughts?

See the thread_pool.h migration for an equivalence.

Cheers,
Gab

--
You received this message because you are subscribed to the Google Groups "scheduler-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scheduler-de...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/scheduler-dev/CAP0-QpuoXRKTOPvrZgZrbzNimaM18AY%3DSvqH46ZjcsA5Km8bOA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "scheduler-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scheduler-de...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/scheduler-dev/CAJTZ7LKzhEdZhj99U6zUU%2BVJx08PZj9-Xqr7wj-DGuZF_exPoA%40mail.gmail.com.

François Doray

unread,
Jan 29, 2020, 12:19:29 PM1/29/20
to Alexander Timin, Gabriel Charette, platform-architecture-dev, Kentaro Hara, Darin Fisher, scheduler-dev, Dana Jansens, Albert Wong
Would there be a reason to ban TaskRunner::PostTaskAndReplyWithResult but not TaskRunner::PostTask? Both methods can post a task to another thread.

Gabriel Charette

unread,
Jan 29, 2020, 1:51:08 PM1/29/20
to François Doray, Alexander Timin, Gabriel Charette, platform-architecture-dev, Kentaro Hara, Darin Fisher, scheduler-dev, Dana Jansens, Albert Wong
On Wed, Jan 29, 2020 at 12:19 PM François Doray <fdo...@chromium.org> wrote:
Would there be a reason to ban TaskRunner::PostTaskAndReplyWithResult but not TaskRunner::PostTask? Both methods can post a task to another thread.

I think altimin is referring to Blink's worker_pool:: API ? If you have a TaskRunner* you can already use its PostTaskAndReply so don't see why PostTaskAndReplyWithResult would be a problem.

Darin Fisher

unread,
Jan 29, 2020, 2:05:07 PM1/29/20
to Gabriel Charette, François Doray, Alexander Timin, platform-architecture-dev, Kentaro Hara, scheduler-dev, Dana Jansens, Albert Wong


On Wed, Jan 29, 2020, 10:51 AM Gabriel Charette <g...@chromium.org> wrote:


On Wed, Jan 29, 2020 at 12:19 PM François Doray <fdo...@chromium.org> wrote:
Would there be a reason to ban TaskRunner::PostTaskAndReplyWithResult but not TaskRunner::PostTask? Both methods can post a task to another thread.

I think altimin is referring to Blink's worker_pool:: API ? If you have a TaskRunner* you can already use its PostTaskAndReply so don't see why PostTaskAndReplyWithResult would be a problem.
 

+1

Alexander Timin

unread,
Jan 29, 2020, 5:11:48 PM1/29/20
to Darin Fisher, Gabriel Charette, François Doray, platform-architecture-dev, Kentaro Hara, scheduler-dev, Dana Jansens, Albert Wong
Ah, sorry for misleading — managed to confuse a lot of things here. Please disregard my comment above :(

+1 to the proposal SequencedTaskRunner::PostTaskAndReplyWithResult.

Also, TIL that we have a method on TaskRunner, thought that we have only a static function.

You received this message because you are subscribed to the Google Groups "platform-architecture-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to platform-architect...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/platform-architecture-dev/CAP0-QpstxPikFtNyCM0iStcxO1nfnszOSS9YGYhjJDHA-hY4Lw%40mail.gmail.com.

Kentaro Hara

unread,
Jan 29, 2020, 5:48:15 PM1/29/20
to Alexander Timin, Darin Fisher, Gabriel Charette, François Doray, platform-architecture-dev, scheduler-dev, Dana Jansens, Albert Wong
+1

--
Kentaro Hara, Tokyo, Japan

Albert J. Wong (王重傑)

unread,
Jan 29, 2020, 7:21:10 PM1/29/20
to Kentaro Hara, Alexander Timin, Darin Fisher, Gabriel Charette, François Doray, platform-architecture-dev, scheduler-dev, Dana Jansens
+1 too
Reply all
Reply to author
Forward
0 new messages