format OC code
This commit is contained in:
@@ -8,25 +8,25 @@
|
||||
#import "DoricContextManager.h"
|
||||
#import "DoricContext.h"
|
||||
|
||||
@interface DoricContextManager()
|
||||
@interface DoricContextManager ()
|
||||
|
||||
@property (nonatomic) NSInteger counter;
|
||||
@property (nonatomic,strong) NSMutableDictionary *doricContextMap;
|
||||
@property (nonatomic,strong) dispatch_queue_t mapQueue;
|
||||
@property(nonatomic) NSInteger counter;
|
||||
@property(nonatomic, strong) NSMutableDictionary *doricContextMap;
|
||||
@property(nonatomic, strong) dispatch_queue_t mapQueue;
|
||||
@end
|
||||
|
||||
@implementation DoricContextManager
|
||||
|
||||
|
||||
- (instancetype)init {
|
||||
if(self = [super init]){
|
||||
if (self = [super init]) {
|
||||
_doricContextMap = [[NSMutableDictionary alloc] init];
|
||||
_counter = 0;
|
||||
_mapQueue = dispatch_queue_create("doric.contextmap", DISPATCH_QUEUE_SERIAL);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype)instance{
|
||||
|
||||
+ (instancetype)instance {
|
||||
static DoricContextManager *_instance;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
@@ -36,9 +36,9 @@ + (instancetype)instance{
|
||||
}
|
||||
|
||||
- (void)createContext:(DoricContext *)context script:(NSString *)script source:(NSString *)source {
|
||||
context.contextId = [NSString stringWithFormat:@"%ld", (long)self.counter++];
|
||||
context.contextId = [NSString stringWithFormat:@"%ld", (long) self.counter++];
|
||||
[context.driver createContext:context.contextId script:script source:source];
|
||||
dispatch_sync(self.mapQueue, ^(){
|
||||
dispatch_sync(self.mapQueue, ^() {
|
||||
NSValue *value = [NSValue valueWithNonretainedObject:context];
|
||||
[self.doricContextMap setValue:value forKey:context.contextId];
|
||||
});
|
||||
@@ -56,7 +56,7 @@ - (DoricContext *)getContext:(NSString *)contextId {
|
||||
- (void)destroyContext:(DoricContext *)context {
|
||||
NSString *contextId = context.contextId;
|
||||
[context.driver destroyContext:contextId].finishCallback = ^{
|
||||
dispatch_sync(self.mapQueue, ^(){
|
||||
dispatch_sync(self.mapQueue, ^() {
|
||||
[self.doricContextMap removeObjectForKey:contextId];
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user