Index: base/threading/sequenced_worker_pool.cc |
diff --git a/base/threading/sequenced_worker_pool.cc b/base/threading/sequenced_worker_pool.cc |
index 57961b5cd5538306ea00a4b354966e32b20d4e0c..62084a7eafa06584354dd54e1219e27dbc8b4426 100644 |
--- a/base/threading/sequenced_worker_pool.cc |
+++ b/base/threading/sequenced_worker_pool.cc |
@@ -292,8 +292,10 @@ class SequencedWorkerPool::Inner { |
public: |
// Take a raw pointer to |worker| to avoid cycles (since we're owned |
// by it). |
- Inner(SequencedWorkerPool* worker_pool, size_t max_threads, |
+ Inner(SequencedWorkerPool* worker_pool, |
+ size_t max_threads, |
const std::string& thread_name_prefix, |
+ base::TaskPriority task_priority, |
TestingObserver* observer); |
~Inner(); |
@@ -497,6 +499,10 @@ class SequencedWorkerPool::Inner { |
TestingObserver* const testing_observer_; |
+ // The TaskPriority to be used for SequencedWorkerPool tasks redirected to the |
+ // TaskScheduler as an experiment (unused otherwise). |
+ const base::TaskPriority task_priority_; |
+ |
DISALLOW_COPY_AND_ASSIGN(Inner); |
}; |
@@ -552,11 +558,11 @@ LazyInstance<ThreadLocalPointer<SequencedWorkerPool::Worker>>::Leaky |
// Inner definitions --------------------------------------------------------- |
-SequencedWorkerPool::Inner::Inner( |
- SequencedWorkerPool* worker_pool, |
- size_t max_threads, |
- const std::string& thread_name_prefix, |
- TestingObserver* observer) |
+SequencedWorkerPool::Inner::Inner(SequencedWorkerPool* worker_pool, |
+ size_t max_threads, |
+ const std::string& thread_name_prefix, |
+ base::TaskPriority task_priority, |
+ TestingObserver* observer) |
: worker_pool_(worker_pool), |
lock_(), |
has_work_cv_(&lock_), |
@@ -574,7 +580,8 @@ SequencedWorkerPool::Inner::Inner( |
cleanup_state_(CLEANUP_DONE), |
cleanup_idlers_(0), |
cleanup_cv_(&lock_), |
- testing_observer_(observer) {} |
+ testing_observer_(observer), |
+ task_priority_(task_priority) {} |
SequencedWorkerPool::Inner::~Inner() { |
// You must call Shutdown() before destroying the pool. |
@@ -1254,17 +1261,31 @@ SequencedWorkerPool::GetSequencedTaskRunnerForCurrentThread() { |
} |
SequencedWorkerPool::SequencedWorkerPool(size_t max_threads, |
- const std::string& thread_name_prefix) |
+ const std::string& thread_name_prefix, |
+ base::TaskPriority task_priority) |
: constructor_task_runner_(ThreadTaskRunnerHandle::Get()), |
- inner_(new Inner(this, max_threads, thread_name_prefix, NULL)) { |
-} |
+ inner_(new Inner(this, |
+ max_threads, |
+ thread_name_prefix, |
+ task_priority, |
+ NULL)) {} |
+ |
+SequencedWorkerPool::SequencedWorkerPool(size_t max_threads, |
+ const std::string& thread_name_prefix) |
+ : SequencedWorkerPool(max_threads, |
+ thread_name_prefix, |
+ base::TaskPriority::USER_VISIBLE) {} |
SequencedWorkerPool::SequencedWorkerPool(size_t max_threads, |
const std::string& thread_name_prefix, |
+ base::TaskPriority task_priority, |
TestingObserver* observer) |
: constructor_task_runner_(ThreadTaskRunnerHandle::Get()), |
- inner_(new Inner(this, max_threads, thread_name_prefix, observer)) { |
-} |
+ inner_(new Inner(this, |
+ max_threads, |
+ thread_name_prefix, |
+ task_priority, |
+ observer)) {} |
SequencedWorkerPool::~SequencedWorkerPool() {} |