Skip to content
This repository has been archived by the owner on Feb 18, 2019. It is now read-only.

Commit

Permalink
Remove unusued RCTJSCExecutor methods
Browse files Browse the repository at this point in the history
Reviewed By: majak

Differential Revision: D2916155

fb-gh-sync-id: fc07d9518b4135c165fc5e8a5ce904c6b0f4b050
shipit-source-id: fc07d9518b4135c165fc5e8a5ce904c6b0f4b050
  • Loading branch information
javache authored and Facebook Github Bot 1 committed Mar 16, 2016
1 parent bebd9c4 commit 92b5db0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 53 deletions.
13 changes: 0 additions & 13 deletions React/Executors/RCTJSCExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
52 changes: 12 additions & 40 deletions React/Executors/RCTJSCExecutor.m
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down

0 comments on commit 92b5db0

Please sign in to comment.