Changeset 181080 in webkit


Ignore:
Timestamp:
Mar 5, 2015 9:06:15 AM (9 years ago)
Author:
Antti Koivisto
Message:

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):

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r180968 r181080  
     12015-03-05  Antti Koivisto  <antti@apple.com>
     2
     3        Support WorkQueue QOS classes on Mavericks
     4        https://bugs.webkit.org/show_bug.cgi?id=142328
     5
     6        Reviewed by Anders Carlsson.
     7
     8        "The priority of a dispatch queue is inherited from its target queue.  In order to
     9        change the priority of a queue created with dispatch_queue_create(), use the
     10        dispatch_get_global_queue() function to obtain a target queue of the desired prior-
     11        ity."
     12
     13        * wtf/cocoa/WorkQueueCocoa.cpp:
     14        (WTF::targetQueueForQOSClass):
     15        (WTF::WorkQueue::platformInitialize):
     16
    1172015-03-03  Anders Carlsson  <andersca@apple.com>
    218
  • trunk/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp

    r180410 r181080  
    6363    }
    6464}
     65#else
     66static dispatch_queue_t targetQueueForQOSClass(WorkQueue::QOS qos)
     67{
     68    switch (qos) {
     69    case WorkQueue::QOS::UserInteractive:
     70    case WorkQueue::QOS::UserInitiated:
     71        return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
     72    case WorkQueue::QOS::Utility:
     73        return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0);
     74    case WorkQueue::QOS::Background:
     75        return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0);
     76    case WorkQueue::QOS::Default:
     77        ASSERT_NOT_REACHED();
     78        return nullptr;
     79    }
     80    ASSERT_NOT_REACHED();
     81}
    6582#endif
    6683
     
    7491#endif
    7592    m_dispatchQueue = dispatch_queue_create(name, attr);
     93#if !HAVE(QOS_CLASSES)
     94    if (qos != WorkQueue::QOS::Default)
     95        dispatch_set_target_queue(m_dispatchQueue, targetQueueForQOSClass(qos));
     96#endif
    7697    dispatch_set_context(m_dispatchQueue, this);
    7798}
Note: See TracChangeset for help on using the changeset viewer.