You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
750 B
42 lines
750 B
//
|
|
// Created by Aaron Levine on 10/16/17.
|
|
//
|
|
|
|
#import "SCCapturerTokenProvider.h"
|
|
|
|
#import "SCCapturerToken.h"
|
|
|
|
#import <SCBase/SCAssignment.h>
|
|
#import <SCFoundation/SCAssertWrapper.h>
|
|
|
|
@implementation SCCapturerTokenProvider {
|
|
SCCapturerToken *_Nullable _token;
|
|
}
|
|
|
|
+ (instancetype)providerWithToken:(SCCapturerToken *)token
|
|
{
|
|
return [[self alloc] initWithToken:token];
|
|
}
|
|
|
|
- (instancetype)initWithToken:(SCCapturerToken *)token
|
|
{
|
|
self = [super init];
|
|
if (self) {
|
|
_token = token;
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
- (nullable SCCapturerToken *)getTokenAndInvalidate
|
|
{
|
|
// ensure serial access by requiring calls be on the main thread
|
|
SCAssertMainThread();
|
|
|
|
let token = _token;
|
|
_token = nil;
|
|
|
|
return token;
|
|
}
|
|
|
|
@end
|