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

Unified Diff: base/task_scheduler/delayed_task_manager.h

Issue 1876363004: TaskScheduler [11] Support ExecutionMode::SINGLE_THREADED. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@8_delayed
Patch Set: rebase 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
Index: base/task_scheduler/delayed_task_manager.h
diff --git a/base/task_scheduler/delayed_task_manager.h b/base/task_scheduler/delayed_task_manager.h
index 9113fc561724469dd2ddbf042504938a185cb9e9..fcd7ec31ba6a3e3e5aea3187b1818b00bd738896 100644
--- a/base/task_scheduler/delayed_task_manager.h
+++ b/base/task_scheduler/delayed_task_manager.h
@@ -24,10 +24,10 @@ namespace base {
namespace internal {
class SchedulerThreadPool;
+class SchedulerWorkerThread;
// A DelayedTaskManager holds delayed Tasks until they become ripe for
-// execution. When they become ripe for execution, it posts them to their
-// associated Sequence and SchedulerThreadPool. This class is thread-safe.
+// execution. This class is thread-safe.
class BASE_EXPORT DelayedTaskManager {
public:
// |on_delayed_run_time_updated| is invoked when the delayed run time is
@@ -36,14 +36,16 @@ class BASE_EXPORT DelayedTaskManager {
~DelayedTaskManager();
// Adds |task| to a queue of delayed tasks. The task will be posted to
- // |thread_pool| as part of |sequence| the first time that PostReadyTasks() is
- // called while Now() is passed |task->delayed_run_time|.
+ // |thread_pool| with |sequence| and |worker_thread| the first time that
+ // PostReadyTasks() is called while Now() is passed |task->delayed_run_time|.
+ // |worker_thread| is optional.
gab 2016/04/25 21:00:20 Given the above comment says it will be "passed to
fdoray 2016/04/25 22:34:44 Done.
//
- // TODO(robliao): Find a concrete way to manage |thread_pool|'s memory. It is
- // never deleted in production, but it is better not to spread this assumption
- // throughout the scheduler.
+ // TODO(robliao): Find a concrete way to manage the memory of |worker_thread|
+ // and |thread_pool|. These objects are never deleted in production, but it is
+ // better not to spread this assumption throughout the scheduler.
void AddDelayedTask(std::unique_ptr<Task> task,
scoped_refptr<Sequence> sequence,
+ SchedulerWorkerThread* worker_thread,
gab 2016/04/25 21:00:20 I'm not a fan of having a |worker_thread| paramete
robliao 2016/04/25 21:42:38 Alternatively we could have two delayed tasks meth
fdoray 2016/04/25 22:34:44 The 3 solutions are: 1. Keep this as-is. 2. Add a
gab 2016/04/26 11:46:27 Meh, not sure about 3. either as DelayedTask's con
robliao 2016/04/26 16:58:56 Exposing DelayedTask's constructor allows you to h
gab 2016/04/26 20:30:58 Good point, I'd be okay with that then. Maybe in a
fdoray 2016/04/27 16:09:59 If we want a single version of SchedulerThreadPool
robliao 2016/04/27 17:43:45 The thing that I like to avoid is forcing callers
gab 2016/04/27 18:11:43 Either way PostTaskWithSequenceNow() will need to
robliao 2016/04/27 18:21:03 Yup, agreed on the default argument points. I'm fi
fdoray 2016/04/27 19:17:04 Keeping this discussion for another CL.
SchedulerThreadPool* thread_pool);
// Posts delayed tasks that are ripe for execution.
« no previous file with comments | « no previous file | base/task_scheduler/delayed_task_manager.cc » ('j') | base/task_scheduler/scheduler_thread_pool.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698