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

Unified Diff: base/task_scheduler/scheduler_thread_pool.h

Issue 1806473002: TaskScheduler [9] Delayed Task Manager (Closed) Base URL: https://luckyluke-private.googlesource.com/src@s_5_worker_thread
Patch Set: self review 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/scheduler_thread_pool.h
diff --git a/base/task_scheduler/scheduler_thread_pool.h b/base/task_scheduler/scheduler_thread_pool.h
index bd85108b860a27f20aef6364e73c4be6317a75d4..0eb4edf19266f29016e2d9d547d550da6aa8dee2 100644
--- a/base/task_scheduler/scheduler_thread_pool.h
+++ b/base/task_scheduler/scheduler_thread_pool.h
@@ -27,6 +27,7 @@
namespace base {
namespace internal {
+class DelayedTaskManager;
struct SequenceSortKey;
class TaskTracker;
@@ -39,14 +40,17 @@ class BASE_EXPORT SchedulerThreadPool {
// Creates a SchedulerThreadPool with up to |max_threads| threads of priority
// |thread_priority|. |enqueue_sequence_callback| will be invoked after a
- // thread of this thread pool tries to run a Task. |task_tracker| is used to
- // handle shutdown behavior of Tasks. Returns nullptr on failure to create a
- // thread pool with at least one thread.
+ // thread of this thread pool tries to run a Task. Tasks posted to TaskRunners
+ // returned by CreateTaskRunnerWithTraits with a delay are handled by
+ // |delayed_task_manager|. |task_tracker| handles shutdown behavior of Tasks.
+ // Returns nullptr on failure to create a thread pool with at least one
+ // thread.
static std::unique_ptr<SchedulerThreadPool> CreateThreadPool(
ThreadPriority thread_priority,
size_t max_threads,
const EnqueueSequenceCallback& enqueue_sequence_callback,
- TaskTracker* task_tracker);
+ TaskTracker* task_tracker,
+ DelayedTaskManager* delayed_task_manager);
// Destroying a SchedulerThreadPool returned by CreateThreadPool() is not
// allowed in production; it is always leaked. In tests, it can only be
@@ -77,7 +81,8 @@ class BASE_EXPORT SchedulerThreadPool {
class SchedulerWorkerThreadDelegateImpl;
SchedulerThreadPool(const EnqueueSequenceCallback& enqueue_sequence_callback,
- TaskTracker* task_tracker);
+ TaskTracker* task_tracker,
+ DelayedTaskManager* delayed_task_manager);
bool Initialize(ThreadPriority thread_priority, size_t max_threads);
@@ -113,6 +118,7 @@ class BASE_EXPORT SchedulerThreadPool {
std::unique_ptr<SchedulerWorkerThread::Delegate> worker_thread_delegate_;
TaskTracker* const task_tracker_;
+ DelayedTaskManager* const delayed_task_manager_;
DISALLOW_COPY_AND_ASSIGN(SchedulerThreadPool);
};

Powered by Google App Engine
This is Rietveld 408576698