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

Unified Diff: base/threading/sequenced_worker_pool.cc

Issue 2330303003: Disallow single-threaded SequencedWorkerPools. (Closed)
Patch Set: merge up to r419443 Created 4 years, 3 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
« no previous file with comments | « base/threading/sequenced_worker_pool.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/sequenced_worker_pool.cc
diff --git a/base/threading/sequenced_worker_pool.cc b/base/threading/sequenced_worker_pool.cc
index 56e4fb92261d1f179535e49e276b6ea51f461bff..01f3329599fce0e3e077e4c1995222a997045054 100644
--- a/base/threading/sequenced_worker_pool.cc
+++ b/base/threading/sequenced_worker_pool.cc
@@ -652,7 +652,9 @@ SequencedWorkerPool::Inner::Inner(SequencedWorkerPool* worker_pool,
cleanup_idlers_(0),
cleanup_cv_(&lock_),
testing_observer_(observer),
- task_priority_(task_priority) {}
+ task_priority_(task_priority) {
+ DCHECK_GT(max_threads_, 1U);
+}
SequencedWorkerPool::Inner::~Inner() {
// You must call Shutdown() before destroying the pool.
@@ -848,22 +850,6 @@ SequencedWorkerPool::Inner::GetTaskSchedulerTaskRunner(
if (!task_runner) {
ExecutionMode execution_mode =
sequence_token_id ? ExecutionMode::SEQUENCED : ExecutionMode::PARALLEL;
-
- if (max_threads_ == 1U) {
- // Tasks posted to single-threaded pools can assume thread affinity.
- execution_mode = ExecutionMode::SINGLE_THREADED;
-
- // Disallow posting tasks with different sequence tokens to single-
- // threaded pools since the TaskScheduler can't force different sequences
- // to run on the same thread.
- DCHECK_LE(sequenced_task_runner_map_.size(), 1U);
-
- // Disallow posting tasks without a sequence token to a single-threaded
- // pool. No users do that currently and we don't want to support new use
- // cases.
- DCHECK(sequence_token_id);
- }
-
task_runner = CreateTaskRunnerWithTraits(traits, execution_mode);
}
« no previous file with comments | « base/threading/sequenced_worker_pool.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698