1edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc/* 2edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc * Copyright 2015 The WebRTC project authors. All Rights Reserved. 3edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc * 4edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc * Use of this source code is governed by a BSD-style license 5edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc * that can be found in the LICENSE file in the root of the source 6edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc * tree. An additional intellectual property rights grant can be found 7edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc * in the file PATENTS. All contributing project authors may 8edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc * be found in the AUTHORS file in the root of the source tree. 9edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc */ 10edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc 11edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc#import <Foundation/Foundation.h> 12edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc 13edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysctypedef NS_ENUM(NSInteger, RTCDispatcherQueueType) { 14edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc // Main dispatcher queue. 15edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc RTCDispatcherTypeMain, 16edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc // Used for starting/stopping AVCaptureSession, and assigning 17edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc // capture session to AVCaptureVideoPreviewLayer. 18edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc RTCDispatcherTypeCaptureSession, 19edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc}; 20edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc 21edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc/** Dispatcher that asynchronously dispatches blocks to a specific 22edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc * shared dispatch queue. 23edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc */ 24edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc@interface RTCDispatcher : NSObject 25edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc 26edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc- (instancetype)init NS_UNAVAILABLE; 27edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc 28edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc/** Dispatch the block asynchronously on the queue for dispatchType. 29edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc * @param dispatchType The queue type to dispatch on. 30edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc * @param block The block to dispatch asynchronously. 31edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc */ 32edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc+ (void)dispatchAsyncOnType:(RTCDispatcherQueueType)dispatchType 33edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc block:(dispatch_block_t)block; 34edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc 35edd8fefa9b31f903eefe1e9fcabb09a5d6fc1ad1haysc@end 36