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

Unified Diff: components/scheduler/child/prioritizing_task_queue_selector.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/prioritizing_task_queue_selector.cc
diff --git a/components/scheduler/child/prioritizing_task_queue_selector.cc b/components/scheduler/child/prioritizing_task_queue_selector.cc
index 5275f72b65d2eda7abe4aa77b4985082215cc07b..e0634629a15f218275174d046195cc2ff087329f 100644
--- a/components/scheduler/child/prioritizing_task_queue_selector.cc
+++ b/components/scheduler/child/prioritizing_task_queue_selector.cc
@@ -11,12 +11,17 @@
namespace scheduler {
PrioritizingTaskQueueSelector::PrioritizingTaskQueueSelector()
- : starvation_count_(0), task_queue_selector_observer_(nullptr) {
+ : starvation_count_(0), task_queue_selector_observer_(nullptr),
+ pre_shutdown_(false) {
}
PrioritizingTaskQueueSelector::~PrioritizingTaskQueueSelector() {
}
+void PrioritizingTaskQueueSelector::PreShutdown() {
+ pre_shutdown_ = true;
+}
+
void PrioritizingTaskQueueSelector::RegisterWorkQueues(
const std::vector<const base::TaskQueue*>& work_queues) {
DCHECK(main_thread_checker_.CalledOnValidThread());
@@ -33,6 +38,8 @@ void PrioritizingTaskQueueSelector::RegisterWorkQueues(
void PrioritizingTaskQueueSelector::SetQueuePriority(size_t queue_index,
QueuePriority priority) {
+ if (pre_shutdown_)
+ return;
DCHECK(main_thread_checker_.CalledOnValidThread());
DCHECK_LT(queue_index, work_queues_.size());
DCHECK_LT(priority, QUEUE_PRIORITY_COUNT);
@@ -44,10 +51,14 @@ void PrioritizingTaskQueueSelector::SetQueuePriority(size_t queue_index,
void PrioritizingTaskQueueSelector::EnableQueue(size_t queue_index,
QueuePriority priority) {
+ if (pre_shutdown_)
+ return;
SetQueuePriority(queue_index, priority);
}
void PrioritizingTaskQueueSelector::DisableQueue(size_t queue_index) {
+ if (pre_shutdown_)
+ return;
DisableQueueInternal(queue_index);
}

Powered by Google App Engine
This is Rietveld 408576698