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

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

Issue 1106213002: 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: Review comments. 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
« no previous file with comments | « components/scheduler/child/null_worker_scheduler.cc ('k') | components/scheduler/child/scheduler_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/scheduler/child/scheduler_helper.h
diff --git a/components/scheduler/child/scheduler_helper.h b/components/scheduler/child/scheduler_helper.h
index 3cb6997f8bae7e7a3560282276b64c58b18309f3..8cd0f5b96e253da657003af465b43d0e93cae743 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,10 @@ 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 the shutdown queue. 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 +102,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.
@@ -195,8 +204,12 @@ 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_;
+ bool in_preshutdown_;
+
// 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_;
« no previous file with comments | « components/scheduler/child/null_worker_scheduler.cc ('k') | components/scheduler/child/scheduler_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698