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 |