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

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

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.cc
diff --git a/components/scheduler/child/scheduler_helper.cc b/components/scheduler/child/scheduler_helper.cc
index 19e8d2b65120525765527af4775d9564d2590f51..4e9910ae6b52af3b1259237ac8e266896da3cecf 100644
--- a/components/scheduler/child/scheduler_helper.cc
+++ b/components/scheduler/child/scheduler_helper.cc
@@ -4,6 +4,7 @@
#include "components/scheduler/child/scheduler_helper.h"
+#include "base/synchronization/waitable_event.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_event_argument.h"
#include "components/scheduler/child/nestable_single_thread_task_runner.h"
@@ -34,6 +35,9 @@ SchedulerHelper::SchedulerHelper(
QueueId::CONTROL_TASK_AFTER_WAKEUP_QUEUE)),
default_task_runner_(
task_queue_manager_->TaskRunnerForQueue(QueueId::DEFAULT_TASK_QUEUE)),
+ shutdown_task_runner_(task_queue_manager_->TaskRunnerForQueue(
+ QueueId::SHUTDOWN_TASK_QUEUE)),
+ total_task_queue_count_(total_task_queue_count),
quiescence_monitored_task_queue_mask_(
((1ull << total_task_queue_count) - 1ull) &
~(1ull << QueueId::IDLE_TASK_QUEUE) &
@@ -97,6 +101,19 @@ SchedulerHelper::SchedulerHelperDelegate::SchedulerHelperDelegate() {
SchedulerHelper::SchedulerHelperDelegate::~SchedulerHelperDelegate() {
}
+void SchedulerHelper::PreShutdown() {
+ CheckOnValidThread();
+ TRACE_EVENT0(disabled_by_default_tracing_category_, "PreShutdownInternal");
+ task_queue_selector_->DisableQueue(QueueId::CONTROL_TASK_AFTER_WAKEUP_QUEUE);
+ task_queue_selector_->DisableQueue(QueueId::DEFAULT_TASK_QUEUE);
+ task_queue_selector_->DisableQueue(QueueId::IDLE_TASK_QUEUE);
+ for (size_t i = TASK_QUEUE_COUNT; i < total_task_queue_count_; i++) {
+ task_queue_selector_->DisableQueue(i);
+ }
+ // Prevent any further enabling/disabling of queues.
+ task_queue_selector_->PreShutdown();
+}
+
void SchedulerHelper::Shutdown() {
CheckOnValidThread();
task_queue_manager_.reset();
@@ -114,6 +131,11 @@ scoped_refptr<SingleThreadIdleTaskRunner> SchedulerHelper::IdleTaskRunner() {
}
scoped_refptr<base::SingleThreadTaskRunner>
+SchedulerHelper::ShutdownTaskRunner() {
+ return shutdown_task_runner_;
+}
+
+scoped_refptr<base::SingleThreadTaskRunner>
SchedulerHelper::ControlTaskRunner() {
return control_task_runner_;
}
@@ -364,6 +386,8 @@ const char* SchedulerHelper::TaskQueueIdToString(QueueId queue_id) {
return "default_tq";
case IDLE_TASK_QUEUE:
return "idle_tq";
+ case SHUTDOWN_TASK_QUEUE:
+ return "shutdown_tq";
case CONTROL_TASK_QUEUE:
return "control_tq";
case CONTROL_TASK_AFTER_WAKEUP_QUEUE:
« no previous file with comments | « components/scheduler/child/scheduler_helper.h ('k') | components/scheduler/child/scheduler_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698