| Index: webrtc/base/task_queue_gcd.cc
|
| diff --git a/webrtc/base/task_queue_gcd.cc b/webrtc/base/task_queue_gcd.cc
|
| index 2c7d649fc9598723994189ee39f82b26e89c1111..389aeb61b9c2b4ee4f02d1ad69faf77ac6661eaa 100644
|
| --- a/webrtc/base/task_queue_gcd.cc
|
| +++ b/webrtc/base/task_queue_gcd.cc
|
| @@ -21,6 +21,19 @@
|
| #include "webrtc/base/task_queue_posix.h"
|
|
|
| namespace rtc {
|
| +namespace {
|
| +int TaskQueuePriorityToGCD(TaskQueue::Priority priority) {
|
| + switch (priority) {
|
| + case TaskQueue::NORMAL:
|
| + return DISPATCH_QUEUE_PRIORITY_DEFAULT;
|
| + case TaskQueue::HIGH:
|
| + return DISPATCH_QUEUE_PRIORITY_HIGH;
|
| + case TaskQueue::LOW:
|
| + return DISPATCH_QUEUE_PRIORITY_LOW;
|
| + }
|
| +}
|
| +}
|
| +
|
| using internal::GetQueuePtrTls;
|
| using internal::AutoSetCurrentQueuePtr;
|
|
|
| @@ -94,7 +107,7 @@ struct TaskQueue::PostTaskAndReplyContext : public TaskQueue::TaskContext {
|
| std::unique_ptr<QueuedTask> first_task;
|
| };
|
|
|
| -TaskQueue::TaskQueue(const char* queue_name)
|
| +TaskQueue::TaskQueue(const char* queue_name, Priority priority /*= NORMAL*/)
|
| : queue_(dispatch_queue_create(queue_name, DISPATCH_QUEUE_SERIAL)),
|
| context_(new QueueContext(this)) {
|
| RTC_DCHECK(queue_name);
|
| @@ -104,6 +117,9 @@ TaskQueue::TaskQueue(const char* queue_name)
|
| // to the queue is released. This may run after the TaskQueue object has
|
| // been deleted.
|
| dispatch_set_finalizer_f(queue_, &QueueContext::DeleteContext);
|
| +
|
| + dispatch_set_target_queue(
|
| + queue_, dispatch_get_global_queue(TaskQueuePriorityToGCD(priority), 0));
|
| }
|
|
|
| TaskQueue::~TaskQueue() {
|
|
|