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

Unified Diff: base/task_scheduler/task_scheduler_impl.cc

Issue 2076153002: [TaskScheduler] Support TaskRunnerHandles from parallel tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mix_c_Ab
Patch Set: Created 4 years, 6 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/task.h ('k') | base/task_scheduler/task_tracker.h » ('j') | 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 592839c74b09a3b9a12e8aed62d623e8158386a7..a96fde3e38cb4d3825d7efe9a357f0e4db00869d 100644
--- a/base/task_scheduler/task_scheduler_impl.cc
+++ b/base/task_scheduler/task_scheduler_impl.cc
@@ -35,10 +35,11 @@ void TaskSchedulerImpl::PostTaskWithTraits(
const tracked_objects::Location& from_here,
const TaskTraits& traits,
const Closure& task) {
- // Post |task| as part of a one-off single-task Sequence.
- GetThreadPoolForTraits(traits)->PostTaskWithSequence(
- WrapUnique(new Task(from_here, task, traits, TimeDelta())),
- make_scoped_refptr(new Sequence), nullptr);
+ // Although this is a one-off task, still need to create a TaskRunner for it
+ // to support TaskRunnerHandles in its context.
+ GetThreadPoolForTraits(traits)
+ ->CreateTaskRunnerWithTraits(traits, ExecutionMode::PARALLEL)
+ ->PostTask(from_here, task);
}
scoped_refptr<TaskRunner> TaskSchedulerImpl::CreateTaskRunnerWithTraits(
« no previous file with comments | « base/task_scheduler/task.h ('k') | base/task_scheduler/task_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698