Title: [229913] trunk
Revision
229913
Author
[email protected]
Date
2018-03-23 12:06:35 -0700 (Fri, 23 Mar 2018)

Log Message

Stop using dispatch_set_target_queue()
<https://webkit.org/b/183908>
<rdar://problem/33553533>

Reviewed by Daniel Bates.

Source/ThirdParty/libwebrtc:

* Source/webrtc/rtc_base/task_queue_gcd.cc: Remove use of
dispatch_set_target_queue() by changing dispatch_queue_create()
to dispatch_queue_create_with_target().
* WebKit/0009-Remove-dispatch_set_target_queue.patch: Add patch.
Filed this to track upstreaming the change:
<https://bugs.chromium.org/p/webrtc/issues/detail?id=9055>
* WebKit/patch-libwebrtc: Delete empty patch file.

Source/WebCore:

No new tests since no change in behavior.

* platform/mediastream/mac/AVMediaCaptureSource.mm:
(WebCore::globaVideoCaptureSerialQueue): Remove use of
dispatch_set_target_queue() by changing dispatch_queue_create()
to dispatch_queue_create_with_target().

Source/WebKit:

* NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
(WebKit::NetworkCache::IOChannel::IOChannel): Remove the call to
dispatch_set_target_queue() since this is handled in the
dispatch_io_create() call above.

Source/WTF:

* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::WorkQueue::platformInitialize): Remove !HAVE(QOS_CLASSES)
code path since it's never used now that HAVE(QOS_CLASSES) is
equivalent to PLATFORM(COCOA) in <wtf/Platform.h>.

Tools:

* Scripts/webkitpy/style/checkers/cpp.py:
(check_language): Add check for use of
dispatch_set_target_queue().
(CppChecker): Add 'runtime/dispatch_set_target_queue' category.
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(CppStyleTest): Add test.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (229912 => 229913)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2018-03-23 18:55:26 UTC (rev 229912)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2018-03-23 19:06:35 UTC (rev 229913)
@@ -1,3 +1,19 @@
+2018-03-23  David Kilzer  <[email protected]>
+
+        Stop using dispatch_set_target_queue()
+        <https://webkit.org/b/183908>
+        <rdar://problem/33553533>
+
+        Reviewed by Daniel Bates.
+
+        * Source/webrtc/rtc_base/task_queue_gcd.cc: Remove use of
+        dispatch_set_target_queue() by changing dispatch_queue_create()
+        to dispatch_queue_create_with_target().
+        * WebKit/0009-Remove-dispatch_set_target_queue.patch: Add patch.
+        Filed this to track upstreaming the change:
+        <https://bugs.chromium.org/p/webrtc/issues/detail?id=9055>
+        * WebKit/patch-libwebrtc: Delete empty patch file.
+
 2018-03-23  Youenn Fablet  <[email protected]>
 
         Use libwebrtc ObjectiveC H264 encoder and decoder

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/task_queue_gcd.cc (229912 => 229913)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/task_queue_gcd.cc	2018-03-23 18:55:26 UTC (rev 229912)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/task_queue_gcd.cc	2018-03-23 19:06:35 UTC (rev 229913)
@@ -139,7 +139,7 @@
 TaskQueue::Impl::Impl(const char* queue_name,
                       TaskQueue* task_queue,
                       Priority priority)
-    : queue_(dispatch_queue_create(queue_name, DISPATCH_QUEUE_SERIAL)),
+    : queue_(dispatch_queue_create_with_target(queue_name, DISPATCH_QUEUE_SERIAL, dispatch_get_global_queue(TaskQueuePriorityToGCD(priority), 0))),
       context_(new QueueContext(task_queue)) {
   RTC_DCHECK(queue_name);
   RTC_CHECK(queue_);
@@ -148,9 +148,6 @@
   // 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::Impl::~Impl() {

Added: trunk/Source/ThirdParty/libwebrtc/WebKit/0009-Remove-dispatch_set_target_queue.patch (0 => 229913)


--- trunk/Source/ThirdParty/libwebrtc/WebKit/0009-Remove-dispatch_set_target_queue.patch	                        (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/WebKit/0009-Remove-dispatch_set_target_queue.patch	2018-03-23 19:06:35 UTC (rev 229913)
@@ -0,0 +1,23 @@
+diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/task_queue_gcd.cc b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/task_queue_gcd.cc
+index a13e088ede6..675b8005722 100644
+--- a/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/task_queue_gcd.cc
++++ b/Source/ThirdParty/libwebrtc/Source/webrtc/rtc_base/task_queue_gcd.cc
+@@ -139,7 +139,7 @@ class TaskQueue::Impl : public RefCountInterface {
+ TaskQueue::Impl::Impl(const char* queue_name,
+                       TaskQueue* task_queue,
+                       Priority priority)
+-    : queue_(dispatch_queue_create(queue_name, DISPATCH_QUEUE_SERIAL)),
++    : queue_(dispatch_queue_create_with_target(queue_name, DISPATCH_QUEUE_SERIAL, dispatch_get_global_queue(TaskQueuePriorityToGCD(priority), 0))),
+       context_(new QueueContext(task_queue)) {
+   RTC_DCHECK(queue_name);
+   RTC_CHECK(queue_);
+@@ -148,9 +148,6 @@ TaskQueue::Impl::Impl(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::Impl::~Impl() {

Deleted: trunk/Source/ThirdParty/libwebrtc/WebKit/patch-libwebrtc ( => )


Modified: trunk/Source/WTF/ChangeLog
===================================================================
--- trunk/Source/WTF/ChangeLog	2018-03-23 18:55:26 UTC (rev 229912)
+++ trunk/Source/WTF/ChangeLog	2018-03-23 19:06:35 UTC (rev 229913)
@@ -1,3 +1,16 @@
+2018-03-23  David Kilzer  <[email protected]>
+
+        Stop using dispatch_set_target_queue()
+        <https://webkit.org/b/183908>
+        <rdar://problem/33553533>
+
+        Reviewed by Daniel Bates.
+
+        * wtf/cocoa/WorkQueueCocoa.cpp:
+        (WTF::WorkQueue::platformInitialize): Remove !HAVE(QOS_CLASSES)
+        code path since it's never used now that HAVE(QOS_CLASSES) is
+        equivalent to PLATFORM(COCOA) in <wtf/Platform.h>.
+
 2018-03-23  Carlos Alberto Lopez Perez  <[email protected]>
 
         WebProcess memory monitor thresholds should be better tuned for embedded systems.

Modified: trunk/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp (229912 => 229913)


--- trunk/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp	2018-03-23 18:55:26 UTC (rev 229912)
+++ trunk/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp	2018-03-23 19:06:35 UTC (rev 229913)
@@ -82,16 +82,8 @@
 void WorkQueue::platformInitialize(const char* name, Type type, QOS qos)
 {
     dispatch_queue_attr_t attr = type == Type::Concurrent ? DISPATCH_QUEUE_CONCURRENT : DISPATCH_QUEUE_SERIAL;
-#if HAVE(QOS_CLASSES)
     attr = dispatch_queue_attr_make_with_qos_class(attr, dispatchQOSClass(qos), 0);
-#else
-    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);
 }
 

Modified: trunk/Source/WebCore/ChangeLog (229912 => 229913)


--- trunk/Source/WebCore/ChangeLog	2018-03-23 18:55:26 UTC (rev 229912)
+++ trunk/Source/WebCore/ChangeLog	2018-03-23 19:06:35 UTC (rev 229913)
@@ -1,3 +1,18 @@
+2018-03-23  David Kilzer  <[email protected]>
+
+        Stop using dispatch_set_target_queue()
+        <https://webkit.org/b/183908>
+        <rdar://problem/33553533>
+
+        Reviewed by Daniel Bates.
+
+        No new tests since no change in behavior.
+
+        * platform/mediastream/mac/AVMediaCaptureSource.mm:
+        (WebCore::globaVideoCaptureSerialQueue): Remove use of
+        dispatch_set_target_queue() by changing dispatch_queue_create()
+        to dispatch_queue_create_with_target().
+
 2018-03-23  Youenn Fablet  <[email protected]>
 
         Use libwebrtc ObjectiveC H264 encoder and decoder

Modified: trunk/Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm (229912 => 229913)


--- trunk/Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm	2018-03-23 18:55:26 UTC (rev 229912)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm	2018-03-23 19:06:35 UTC (rev 229913)
@@ -130,8 +130,7 @@
     static dispatch_queue_t globalQueue;
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
-        globalQueue = dispatch_queue_create("WebCoreAVMediaCaptureSource video capture queue", DISPATCH_QUEUE_SERIAL);
-        dispatch_set_target_queue(globalQueue, dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_HIGH, 0));
+        globalQueue = dispatch_queue_create_with_target("WebCoreAVMediaCaptureSource video capture queue", DISPATCH_QUEUE_SERIAL, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0));
     });
     return globalQueue;
 }

Modified: trunk/Source/WebKit/ChangeLog (229912 => 229913)


--- trunk/Source/WebKit/ChangeLog	2018-03-23 18:55:26 UTC (rev 229912)
+++ trunk/Source/WebKit/ChangeLog	2018-03-23 19:06:35 UTC (rev 229913)
@@ -1,3 +1,16 @@
+2018-03-23  David Kilzer  <[email protected]>
+
+        Stop using dispatch_set_target_queue()
+        <https://webkit.org/b/183908>
+        <rdar://problem/33553533>
+
+        Reviewed by Daniel Bates.
+
+        * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
+        (WebKit::NetworkCache::IOChannel::IOChannel): Remove the call to
+        dispatch_set_target_queue() since this is handled in the
+        dispatch_io_create() call above.
+
 2018-03-23  Youenn Fablet  <[email protected]>
 
         CacheStorage::Engine should not ref itself when hopping to a background thread

Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm (229912 => 229913)


--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm	2018-03-23 18:55:26 UTC (rev 229912)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm	2018-03-23 19:06:35 UTC (rev 229913)
@@ -74,11 +74,6 @@
 
     // This makes the channel read/write all data before invoking the handlers.
     dispatch_io_set_low_water(m_dispatchIO.get(), std::numeric_limits<size_t>::max());
-
-    if (useLowIOPriority) {
-        // The target queue of a dispatch I/O channel specifies the priority of the global queue where its I/O operations are executed.
-        dispatch_set_target_queue(m_dispatchIO.get(), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0));
-    }
 }
 
 IOChannel::~IOChannel()

Modified: trunk/Tools/ChangeLog (229912 => 229913)


--- trunk/Tools/ChangeLog	2018-03-23 18:55:26 UTC (rev 229912)
+++ trunk/Tools/ChangeLog	2018-03-23 19:06:35 UTC (rev 229913)
@@ -1,3 +1,18 @@
+2018-03-23  David Kilzer  <[email protected]>
+
+        Stop using dispatch_set_target_queue()
+        <https://webkit.org/b/183908>
+        <rdar://problem/33553533>
+
+        Reviewed by Daniel Bates.
+
+        * Scripts/webkitpy/style/checkers/cpp.py:
+        (check_language): Add check for use of
+        dispatch_set_target_queue().
+        (CppChecker): Add 'runtime/dispatch_set_target_queue' category.
+        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+        (CppStyleTest): Add test.
+
 2018-03-23  Youenn Fablet  <[email protected]>
 
         Allow fully whitelisted plug-ins to match non HTTP URLs

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (229912 => 229913)


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2018-03-23 18:55:26 UTC (rev 229912)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2018-03-23 19:06:35 UTC (rev 229913)
@@ -3224,6 +3224,10 @@
         error(line_number, 'security/temp_file', 5,
               'Never use mktemp.  Use mkstemp or mkostemp instead.')
 
+    if search(r'\bdispatch_set_target_queue\b', line):
+        error(line_number, 'runtime/dispatch_set_target_queue', 5,
+              'Never use dispatch_set_target_queue.  Use dispatch_queue_create_with_target instead.')
+
     # Check for suspicious usage of "if" like
     # } if (a == b) {
     if search(r'\}\s*if\s*\(', line):
@@ -3941,6 +3945,7 @@
         'runtime/bitfields',
         'runtime/casting',
         'runtime/ctype_function',
+        'runtime/dispatch_set_target_queue',
         'runtime/enum_bitfields',
         'runtime/explicit',
         'runtime/init',

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (229912 => 229913)


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2018-03-23 18:55:26 UTC (rev 229912)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2018-03-23 19:06:35 UTC (rev 229913)
@@ -1588,6 +1588,15 @@
         self.assert_lint('mkstemp(template);', '')
         self.assert_lint('mkostemp(template);', '')
 
+    def test_dispatch_set_target_queue(self):
+        self.assert_lint(
+            '''\
+            globalQueue = dispatch_queue_create("My Serial Queue", DISPATCH_QUEUE_SERIAL);
+            dispatch_set_target_queue(globalQueue, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0));''',
+            'Never use dispatch_set_target_queue.  Use dispatch_queue_create_with_target instead.'
+            '  [runtime/dispatch_set_target_queue] [5]')
+        self.assert_lint('globalQueue = dispatch_queue_create_with_target("My Serial Queue", DISPATCH_QUEUE_SERIAL, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0));', '')
+
     # Variable-length arrays are not permitted.
     def test_variable_length_array_detection(self):
         errmsg = ('Do not use variable-length arrays.  Use an appropriately named '
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to