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

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

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
Index: components/scheduler/child/webthread_impl_for_worker_scheduler.cc
diff --git a/components/scheduler/child/webthread_impl_for_worker_scheduler.cc b/components/scheduler/child/webthread_impl_for_worker_scheduler.cc
index c293faae69d38d46e577a76fc34758616a669aea..aec0b2eac24fc9dc3ca8f01f2ab3a446b0e9a77c 100644
--- a/components/scheduler/child/webthread_impl_for_worker_scheduler.cc
+++ b/components/scheduler/child/webthread_impl_for_worker_scheduler.cc
@@ -27,9 +27,10 @@ WebThreadImplForWorkerScheduler::WebThreadImplForWorkerScheduler(
WebThreadImplForWorkerScheduler::~WebThreadImplForWorkerScheduler() {
base::WaitableEvent completion(false, false);
- // We need to post the shutdown task on the scheduler's task queue or tasks
- // posted on the worker scheduler may not get run when the thread is deleted.
- TaskRunner()->PostTask(
+ // We need to post the shutdown task on the scheduler's shutdown task queue or
+ // other (shutdown) tasks posted on the worker scheduler may not get run when
+ // the thread is deleted.
+ worker_scheduler_->ShutdownTaskRunner()->PostTask(
FROM_HERE, base::Bind(&WebThreadImplForWorkerScheduler::ShutDownOnThread,
base::Unretained(this), &completion));
completion.Wait();
@@ -46,7 +47,8 @@ void WebThreadImplForWorkerScheduler::InitOnThread(
web_scheduler_.reset(new WebSchedulerImpl(
worker_scheduler_.get(), worker_scheduler_->IdleTaskRunner(),
worker_scheduler_->DefaultTaskRunner(),
- worker_scheduler_->DefaultTaskRunner()));
+ worker_scheduler_->DefaultTaskRunner(),
+ worker_scheduler_->ShutdownTaskRunner()));
completion->Signal();
}

Powered by Google App Engine
This is Rietveld 408576698