From 92b5db00e081b658ce3fe9b06c6dd46b3d00a445 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Wed, 16 Mar 2016 10:22:38 -0700 Subject: [PATCH] Remove unusued RCTJSCExecutor methods Reviewed By: majak Differential Revision: D2916155 fb-gh-sync-id: fc07d9518b4135c165fc5e8a5ce904c6b0f4b050 shipit-source-id: fc07d9518b4135c165fc5e8a5ce904c6b0f4b050 --- React/Executors/RCTJSCExecutor.h | 13 -------- React/Executors/RCTJSCExecutor.m | 52 ++++++++------------------------ 2 files changed, 12 insertions(+), 53 deletions(-) diff --git a/React/Executors/RCTJSCExecutor.h b/React/Executors/RCTJSCExecutor.h index f8beaa67373f5a..997811adfaafa9 100644 --- a/React/Executors/RCTJSCExecutor.h +++ b/React/Executors/RCTJSCExecutor.h @@ -30,17 +30,4 @@ RCT_EXTERN NSString *const RCTJavaScriptContextCreatedNotification; */ @interface RCTJSCExecutor : NSObject -/** - * Configures the executor to run JavaScript on a specific thread with a given JS context. - * You probably don't want to use this; use -init instead. - */ -- (instancetype)initWithJavaScriptThread:(NSThread *)javaScriptThread - context:(JSContext *)context NS_DESIGNATED_INITIALIZER; - -/** - * Like -[initWithJavaScriptThread:context:] but uses JSGlobalContextRef from JavaScriptCore's C API. - */ -- (instancetype)initWithJavaScriptThread:(NSThread *)javaScriptThread - globalContextRef:(JSGlobalContextRef)contextRef; - @end diff --git a/React/Executors/RCTJSCExecutor.m b/React/Executors/RCTJSCExecutor.m index 8c12fdd5409f75..5db8a5cbcb0002 100644 --- a/React/Executors/RCTJSCExecutor.m +++ b/React/Executors/RCTJSCExecutor.m @@ -182,54 +182,26 @@ + (void)runRunLoopThread - (instancetype)init { - NSThread *javaScriptThread = [[NSThread alloc] initWithTarget:[self class] - selector:@selector(runRunLoopThread) - object:nil]; - javaScriptThread.name = RCTJSCThreadName; - - if ([javaScriptThread respondsToSelector:@selector(setQualityOfService:)]) { - [javaScriptThread setQualityOfService:NSOperationQualityOfServiceUserInteractive]; - } else { - javaScriptThread.threadPriority = [NSThread mainThread].threadPriority; - } - - [javaScriptThread start]; + if (self = [super init]) { + _valid = YES; - return [self initWithJavaScriptThread:javaScriptThread context:nil]; -} + _javaScriptThread = [[NSThread alloc] initWithTarget:[self class] + selector:@selector(runRunLoopThread) + object:nil]; + _javaScriptThread.name = @"com.facebook.React.JavaScript"; -- (instancetype)initWithJavaScriptThread:(NSThread *)javaScriptThread - context:(JSContext *)context -{ - RCTAssert(javaScriptThread != nil, - @"Can't initialize RCTJSCExecutor without a javaScriptThread"); + if ([_javaScriptThread respondsToSelector:@selector(setQualityOfService:)]) { + [_javaScriptThread setQualityOfService:NSOperationQualityOfServiceUserInteractive]; + } else { + _javaScriptThread.threadPriority = [NSThread mainThread].threadPriority; + } - if ((self = [super init])) { - _valid = YES; - _javaScriptThread = javaScriptThread; - __weak RCTJSCExecutor *weakSelf = self; - [self executeBlockOnJavaScriptQueue: ^{ - RCTJSCExecutor *strongSelf = weakSelf; - if (!strongSelf) { - return; - } - // Assumes that no other JS tasks are scheduled before. - if (context) { - strongSelf->_context = [[RCTJavaScriptContext alloc] initWithJSContext:context]; - } - }]; + [_javaScriptThread start]; } return self; } -- (instancetype)initWithJavaScriptThread:(NSThread *)javaScriptThread - globalContextRef:(JSGlobalContextRef)contextRef -{ - JSContext *context = contextRef ? [JSContext contextWithJSGlobalContextRef:contextRef] : nil; - return [self initWithJavaScriptThread:javaScriptThread context:context]; -} - - (RCTJavaScriptContext *)context { RCTAssertThread(_javaScriptThread, @"Must be called on JS thread.");