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

Unified Diff: base/task_scheduler/scheduler_thread_pool_impl.cc

Issue 1911023002: TaskScheduler: Add TaskRunnerHandle support to TaskScheduler tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@c1_1876363004_STTR
Patch Set: review:danakj#28 Created 4 years, 8 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 | « no previous file | base/task_scheduler/sequence.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/scheduler_thread_pool_impl.cc
diff --git a/base/task_scheduler/scheduler_thread_pool_impl.cc b/base/task_scheduler/scheduler_thread_pool_impl.cc
index ab9bbf6caa88e81dd70bbf3e37e754157fae6775..dc88a871b6e35b2e3d2df8a4a569f991f2dff1ac 100644
--- a/base/task_scheduler/scheduler_thread_pool_impl.cc
+++ b/base/task_scheduler/scheduler_thread_pool_impl.cc
@@ -78,10 +78,12 @@ class SchedulerSequencedTaskRunner : public SequencedTaskRunner {
bool PostDelayedTask(const tracked_objects::Location& from_here,
const Closure& closure,
TimeDelta delay) override {
+ std::unique_ptr<Task> task(new Task(from_here, closure, traits_, delay));
+ task->sequenced_task_runner_ref = this;
+
// Post the task as part of |sequence_|.
- return thread_pool_->PostTaskWithSequence(
- WrapUnique(new Task(from_here, closure, traits_, delay)), sequence_,
- nullptr);
+ return thread_pool_->PostTaskWithSequence(std::move(task), sequence_,
+ nullptr);
}
bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
@@ -125,10 +127,12 @@ class SchedulerSingleThreadTaskRunner : public SingleThreadTaskRunner {
bool PostDelayedTask(const tracked_objects::Location& from_here,
const Closure& closure,
TimeDelta delay) override {
+ std::unique_ptr<Task> task(new Task(from_here, closure, traits_, delay));
+ task->single_thread_task_runner_ref = this;
+
// Post the task to be executed by |worker_thread_| as part of |sequence_|.
- return thread_pool_->PostTaskWithSequence(
- WrapUnique(new Task(from_here, closure, traits_, delay)), sequence_,
- worker_thread_);
+ return thread_pool_->PostTaskWithSequence(std::move(task), sequence_,
+ worker_thread_);
}
bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
« no previous file with comments | « no previous file | base/task_scheduler/sequence.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698