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

Unified Diff: components/scheduler/child/scheduler_helper.h

Issue 1101703003: Adds a SHUTDOWN_TASK_QUEUE and a PreShutdown api to the scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment Created 5 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: components/scheduler/child/scheduler_helper.h
diff --git a/components/scheduler/child/scheduler_helper.h b/components/scheduler/child/scheduler_helper.h
index 7ace6944c42b3d8ab5d0403f4bdd28c2fb46f73d..8b0d9bdf514d4c8de36819a700412137067fedae 100644
--- a/components/scheduler/child/scheduler_helper.h
+++ b/components/scheduler/child/scheduler_helper.h
@@ -61,6 +61,10 @@ class SCHEDULER_EXPORT SchedulerHelper {
// time if no idle time is available.
scoped_refptr<SingleThreadIdleTaskRunner> IdleTaskRunner();
+ // Returns the shutdown task runner. Intended for tasks that must be able to
+ // run, even after PreShutdown() is called.
+ scoped_refptr<base::SingleThreadTaskRunner> ShutdownTaskRunner();
+
// Returns the control task runner. Tasks posted to this runner are executed
// with the highest priority. Care must be taken to avoid starvation of other
// task queues.
@@ -82,6 +86,11 @@ class SCHEDULER_EXPORT SchedulerHelper {
void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer);
void RemoveTaskObserver(base::MessageLoop::TaskObserver* task_observer);
+ // Optional. This stops all queues except for shutdown and control queues.
+ // Also ends any idle periods. Must be called from the thread this class was
+ // created on.
+ void PreShutdown();
+
// Shuts down the scheduler by dropping any remaining pending work in the work
// queues. After this call any work posted to the task runners will be
// silently dropped.
@@ -94,6 +103,7 @@ class SCHEDULER_EXPORT SchedulerHelper {
enum QueueId {
DEFAULT_TASK_QUEUE,
IDLE_TASK_QUEUE,
+ SHUTDOWN_TASK_QUEUE,
CONTROL_TASK_QUEUE,
CONTROL_TASK_AFTER_WAKEUP_QUEUE,
// Must be the last entry.
@@ -190,8 +200,11 @@ class SCHEDULER_EXPORT SchedulerHelper {
scoped_refptr<base::SingleThreadTaskRunner> control_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> control_task_after_wakeup_runner_;
scoped_refptr<base::SingleThreadTaskRunner> default_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> shutdown_task_runner_;
scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_;
+ size_t total_task_queue_count_;
+
// A bitmap which controls the set of queues that are checked for quiescence
// before triggering a long idle period.
uint64 quiescence_monitored_task_queue_mask_;

Powered by Google App Engine
This is Rietveld 408576698