Remove unusued RCTJSCExecutor methods

Reviewed By: majak

Differential Revision: D2916155

fb-gh-sync-id: fc07d9518b4135c165fc5e8a5ce904c6b0f4b050
shipit-source-id: fc07d9518b4135c165fc5e8a5ce904c6b0f4b050
This commit is contained in:
Pieter De Baets 2016-03-16 10:22:38 -07:00 коммит произвёл Facebook Github Bot 1
Родитель bebd9c423f
Коммит 92b5db00e0
2 изменённых файлов: 14 добавлений и 55 удалений

Просмотреть файл

@ -30,17 +30,4 @@ RCT_EXTERN NSString *const RCTJavaScriptContextCreatedNotification;
*/
@interface RCTJSCExecutor : NSObject <RCTJavaScriptExecutor>
/**
* 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

Просмотреть файл

@ -182,54 +182,26 @@ static void RCTInstallJSCProfiler(RCTBridge *bridge, JSContextRef context)
- (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];
return [self initWithJavaScriptThread:javaScriptThread context:nil];
}
- (instancetype)initWithJavaScriptThread:(NSThread *)javaScriptThread
context:(JSContext *)context
{
RCTAssert(javaScriptThread != nil,
@"Can't initialize RCTJSCExecutor without a javaScriptThread");
if ((self = [super init])) {
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 = [[NSThread alloc] initWithTarget:[self class]
selector:@selector(runRunLoopThread)
object:nil];
_javaScriptThread.name = @"com.facebook.React.JavaScript";
if ([_javaScriptThread respondsToSelector:@selector(setQualityOfService:)]) {
[_javaScriptThread setQualityOfService:NSOperationQualityOfServiceUserInteractive];
} else {
_javaScriptThread.threadPriority = [NSThread mainThread].threadPriority;
}
[_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.");