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

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

Issue 2890513002: Revert of Split iOS sdk in to separate targets (Closed)
Patch Set: Created 3 years, 7 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
(Empty)
1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #import "RTCDispatcher+Private.h"
12
13 static dispatch_queue_t kAudioSessionQueue = nil;
14 static dispatch_queue_t kCaptureSessionQueue = nil;
15
16 @implementation RTCDispatcher
17
18 + (void)initialize {
19 static dispatch_once_t onceToken;
20 dispatch_once(&onceToken, ^{
21 kAudioSessionQueue = dispatch_queue_create(
22 "org.webrtc.RTCDispatcherAudioSession",
23 DISPATCH_QUEUE_SERIAL);
24 kCaptureSessionQueue = dispatch_queue_create(
25 "org.webrtc.RTCDispatcherCaptureSession",
26 DISPATCH_QUEUE_SERIAL);
27 });
28 }
29
30 + (void)dispatchAsyncOnType:(RTCDispatcherQueueType)dispatchType
31 block:(dispatch_block_t)block {
32 dispatch_queue_t queue = [self dispatchQueueForType:dispatchType];
33 dispatch_async(queue, block);
34 }
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
47 #pragma mark - Private
48
49 + (dispatch_queue_t)dispatchQueueForType:(RTCDispatcherQueueType)dispatchType {
50 switch (dispatchType) {
51 case RTCDispatcherTypeMain:
52 return dispatch_get_main_queue();
53 case RTCDispatcherTypeCaptureSession:
54 return kCaptureSessionQueue;
55 case RTCDispatcherTypeAudioSession:
56 return kAudioSessionQueue;
57 }
58 }
59
60 @end
61
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698