Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/RTCDispatcher.m

Issue 2800853006: Address tkchin's comments on RTCCameraVideoCapturer. (Closed)
Patch Set: Address comments. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 15 matching lines...) Expand all
26 DISPATCH_QUEUE_SERIAL); 26 DISPATCH_QUEUE_SERIAL);
27 }); 27 });
28 } 28 }
29 29
30 + (void)dispatchAsyncOnType:(RTCDispatcherQueueType)dispatchType 30 + (void)dispatchAsyncOnType:(RTCDispatcherQueueType)dispatchType
31 block:(dispatch_block_t)block { 31 block:(dispatch_block_t)block {
32 dispatch_queue_t queue = [self dispatchQueueForType:dispatchType]; 32 dispatch_queue_t queue = [self dispatchQueueForType:dispatchType];
33 dispatch_async(queue, block); 33 dispatch_async(queue, block);
34 } 34 }
35 35
36 + (BOOL)isOnQueueForType:(RTCDispatcherQueueType)dispatchType {
37 dispatch_queue_t targetQueue = [self dispatchQueueForType:dispatchType];
38 const char* targetLabel = dispatch_queue_get_label(targetQueue);
39 const char* currentLabel = dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LAB EL);
40
41 NSAssert(strlen(targetLabel) > 0, @"Label is required for the target queue.");
42 NSAssert(strlen(currentLabel) > 0, @"Label is required for the current queue." );
43
44 return strcmp(targetLabel, currentLabel) == 0;
45 }
46
36 #pragma mark - Private 47 #pragma mark - Private
37 48
38 + (dispatch_queue_t)dispatchQueueForType:(RTCDispatcherQueueType)dispatchType { 49 + (dispatch_queue_t)dispatchQueueForType:(RTCDispatcherQueueType)dispatchType {
39 switch (dispatchType) { 50 switch (dispatchType) {
40 case RTCDispatcherTypeMain: 51 case RTCDispatcherTypeMain:
41 return dispatch_get_main_queue(); 52 return dispatch_get_main_queue();
42 case RTCDispatcherTypeCaptureSession: 53 case RTCDispatcherTypeCaptureSession:
43 return kCaptureSessionQueue; 54 return kCaptureSessionQueue;
44 case RTCDispatcherTypeAudioSession: 55 case RTCDispatcherTypeAudioSession:
45 return kAudioSessionQueue; 56 return kAudioSessionQueue;
46 } 57 }
47 } 58 }
48 59
49 @end 60 @end
50 61
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698