Commit 7be0aa98 authored by Etienne Pierre-doray's avatar Etienne Pierre-doray Committed by Commit Bot

[ThreadPool]: Reduce lock scope in ThreadGroupImpl::Start

DCHECK is triggered in base::internal::CheckedLockImpl::Acquire from:
base::FeatureList::IsFeatureEnabled(base::Feature const &)
base::FeatureList::IsEnabled(base::Feature const &)
base::internal::ThreadGroupImpl::Start

This is probably related to MayBlockWithoutDelay feature recently
enabled on canary.

Fix: Move lock's scope to exclude IsEnabled.


Bug: 1027333
Change-Id: I7663ee109a4c26b0ca500760394748da2572802d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1929865Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Commit-Queue: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718632}
parent 8a369581
......@@ -387,12 +387,6 @@ void ThreadGroupImpl::Start(
Optional<TimeDelta> may_block_threshold) {
DCHECK(!replacement_thread_group_);
ScopedWorkersExecutor executor(this);
CheckedAutoLock auto_lock(lock_);
DCHECK(workers_.empty());
in_start().may_block_without_delay =
FeatureList::IsEnabled(kMayBlockWithoutDelay) &&
priority_hint_ == ThreadPriority::NORMAL;
......@@ -405,6 +399,10 @@ void ThreadGroupImpl::Start(
priority_hint_ == ThreadPriority::NORMAL ? kForegroundBlockedWorkersPoll
: kBackgroundBlockedWorkersPoll;
ScopedWorkersExecutor executor(this);
CheckedAutoLock auto_lock(lock_);
DCHECK(workers_.empty());
max_tasks_ = max_tasks;
DCHECK_GE(max_tasks_, 1U);
in_start().initial_max_tasks = max_tasks_;
......
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