Commit 3b6b1f56 authored by Francois Doray's avatar Francois Doray Committed by Commit Bot

TaskScheduler: Stop checking is_running_task when entering/exiting blocking calls.

Previously, we had logic to avoid handling ScopedBlockingCalls
outside of blocking tasks. This logic is redundant now that the
WaitableEvents used by SchedulerWorkers are marked as
"only used while idle"
(https://chromium-review.googlesource.com/c/chromium/src/+/1305891/22/base/task/task_scheduler/scheduler_worker.cc)

Change-Id: Ie349c868dc89b0e806c9d22937cd95b4e06c5824
Reviewed-on: https://chromium-review.googlesource.com/c/1450044
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#628447}
parent 40a54e68
......@@ -840,10 +840,7 @@ void SchedulerWorkerPoolImpl::SchedulerWorkerDelegateImpl::OnMainExit(
void SchedulerWorkerPoolImpl::SchedulerWorkerDelegateImpl::BlockingStarted(
BlockingType blocking_type) {
DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_);
// Blocking calls made outside of tasks should not influence the max tasks.
if (!worker_only().is_running_task)
return;
DCHECK(worker_only().is_running_task);
switch (blocking_type) {
case BlockingType::MAY_BLOCK:
......@@ -858,6 +855,7 @@ void SchedulerWorkerPoolImpl::SchedulerWorkerDelegateImpl::BlockingStarted(
void SchedulerWorkerPoolImpl::SchedulerWorkerDelegateImpl::
BlockingTypeUpgraded() {
DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_);
DCHECK(worker_only().is_running_task);
{
AutoSchedulerLock auto_lock(outer_->lock_);
......@@ -882,10 +880,7 @@ void SchedulerWorkerPoolImpl::SchedulerWorkerDelegateImpl::
void SchedulerWorkerPoolImpl::SchedulerWorkerDelegateImpl::BlockingEnded() {
DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_);
// Ignore blocking calls made outside of tasks.
if (!worker_only().is_running_task)
return;
DCHECK(worker_only().is_running_task);
AutoSchedulerLock auto_lock(outer_->lock_);
if (incremented_max_tasks_since_blocked_) {
......@@ -904,6 +899,7 @@ void SchedulerWorkerPoolImpl::SchedulerWorkerDelegateImpl::BlockingEnded() {
void SchedulerWorkerPoolImpl::SchedulerWorkerDelegateImpl::MayBlockEntered() {
DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_);
DCHECK(worker_only().is_running_task);
bool must_schedule_adjust_max_tasks = false;
{
......@@ -925,6 +921,7 @@ void SchedulerWorkerPoolImpl::SchedulerWorkerDelegateImpl::MayBlockEntered() {
void SchedulerWorkerPoolImpl::SchedulerWorkerDelegateImpl::WillBlockEntered() {
DCHECK_CALLED_ON_VALID_THREAD(worker_thread_checker_);
DCHECK(worker_only().is_running_task);
bool must_schedule_adjust_max_tasks = false;
SchedulerWorkerActionExecutor executor(outer_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment