Skip to content
Permalink
Browse files
Support WorkQueue QOS classes on Mavericks
https://bugs.webkit.org/show_bug.cgi?id=142328

Reviewed by Anders Carlsson.

"The priority of a dispatch queue is inherited from its target queue.  In order to
change the priority of a queue created with dispatch_queue_create(), use the
dispatch_get_global_queue() function to obtain a target queue of the desired prior-
ity."

* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::targetQueueForQOSClass):
(WTF::WorkQueue::platformInitialize):


Canonical link: https://commits.webkit.org/160375@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181080 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
anttijk committed Mar 5, 2015
1 parent 2b48c21 commit c069c55cb59c229d62491281bd5f27964965314f
Showing with 37 additions and 0 deletions.
  1. +16 −0 Source/WTF/ChangeLog
  2. +21 −0 Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp
@@ -1,3 +1,19 @@
2015-03-05 Antti Koivisto <antti@apple.com>

Support WorkQueue QOS classes on Mavericks
https://bugs.webkit.org/show_bug.cgi?id=142328

Reviewed by Anders Carlsson.

"The priority of a dispatch queue is inherited from its target queue. In order to
change the priority of a queue created with dispatch_queue_create(), use the
dispatch_get_global_queue() function to obtain a target queue of the desired prior-
ity."

* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::targetQueueForQOSClass):
(WTF::WorkQueue::platformInitialize):

2015-03-03 Anders Carlsson <andersca@apple.com>

Remove unused compression code
@@ -62,6 +62,23 @@ static dispatch_qos_class_t dispatchQOSClass(WorkQueue::QOS qos)
return QOS_CLASS_BACKGROUND;
}
}
#else
static dispatch_queue_t targetQueueForQOSClass(WorkQueue::QOS qos)
{
switch (qos) {
case WorkQueue::QOS::UserInteractive:
case WorkQueue::QOS::UserInitiated:
return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
case WorkQueue::QOS::Utility:
return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0);
case WorkQueue::QOS::Background:
return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0);
case WorkQueue::QOS::Default:
ASSERT_NOT_REACHED();
return nullptr;
}
ASSERT_NOT_REACHED();
}
#endif

void WorkQueue::platformInitialize(const char* name, Type type, QOS qos)
@@ -73,6 +90,10 @@ void WorkQueue::platformInitialize(const char* name, Type type, QOS qos)
UNUSED_PARAM(qos);
#endif
m_dispatchQueue = dispatch_queue_create(name, attr);
#if !HAVE(QOS_CLASSES)
if (qos != WorkQueue::QOS::Default)
dispatch_set_target_queue(m_dispatchQueue, targetQueueForQOSClass(qos));
#endif
dispatch_set_context(m_dispatchQueue, this);
}

0 comments on commit c069c55

Please sign in to comment.