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

Unified Diff: base/threading/sequenced_worker_pool.cc

Issue 2574403002: Add a TaskPriority cap to the SWP redirection to experiment with no redirections at USER_BLOCKING. (Closed)
Patch Set: Created 4 years 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: base/threading/sequenced_worker_pool.cc
diff --git a/base/threading/sequenced_worker_pool.cc b/base/threading/sequenced_worker_pool.cc
index b7e93bb72ab92dbade351dbfd73768ce77c5e0da..56bbb62dd09f58bb92f05340598a109e715c5aee 100644
--- a/base/threading/sequenced_worker_pool.cc
+++ b/base/threading/sequenced_worker_pool.cc
@@ -75,6 +75,8 @@ enum class AllPoolsState {
// debug::DumpWithoutCrashing() in case of waterfall failures.
AllPoolsState g_all_pools_state = AllPoolsState::USE_WORKER_POOL;
+TaskPriority g_max_task_priority = TaskPriority::HIGHEST;
+
struct SequencedTask : public TrackingInfo {
SequencedTask()
: sequence_token_id(0),
@@ -644,7 +646,10 @@ SequencedWorkerPool::Inner::Inner(SequencedWorkerPool* worker_pool,
cleanup_idlers_(0),
cleanup_cv_(&lock_),
testing_observer_(observer),
- task_priority_(task_priority) {
+ task_priority_(static_cast<int>(task_priority) <=
+ static_cast<int>(g_max_task_priority)
dcheng 2016/12/15 21:20:49 Yay, C++.
+ ? task_priority
+ : g_max_task_priority) {
DCHECK_GT(max_threads_, 1U);
}
@@ -1422,13 +1427,15 @@ void SequencedWorkerPool::EnableForProcess() {
}
// static
-void SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess() {
+void SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess(
+ TaskPriority max_task_priority) {
// TODO(fdoray): Uncomment this line. It is initially commented to avoid a
// revert of the CL that adds debug::DumpWithoutCrashing() in case of
// waterfall failures.
// DCHECK_EQ(AllPoolsState::POST_TASK_DISABLED, g_all_pools_state);
DCHECK(TaskScheduler::GetInstance());
g_all_pools_state = AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER;
+ g_max_task_priority = max_task_priority;
}
// static
« no previous file with comments | « base/threading/sequenced_worker_pool.h ('k') | components/task_scheduler_util/variations/browser_variations_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698