Skip to content

Commit 9ff4d31

Browse files
javacheFacebook Github Bot 9
authored andcommitted
Remove unnecessary JSContextGetGlobalContext call
Reviewed By: majak, alexeylang Differential Revision: D3871178 fbshipit-source-id: 4a6dff7cce233e9bc2e2a80858774a2e6af6b67d
1 parent 228f104 commit 9ff4d31

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

React/Executors/RCTJSCExecutor.mm

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,15 +582,14 @@ - (void)_executeJSCall:(NSString *)method
582582

583583
RCTJSCWrapper *jscWrapper = strongSelf->_jscWrapper;
584584
JSContext *context = strongSelf->_context.context;
585-
JSGlobalContextRef ctx = context.JSGlobalContextRef;
586-
JSGlobalContextRef contextJSRef = jscWrapper->JSContextGetGlobalContext(ctx);
585+
JSGlobalContextRef contextJSRef = context.JSGlobalContextRef;
587586

588587
// get the BatchedBridge object
589588
JSValueRef errorJSRef = NULL;
590589
JSValueRef batchedBridgeRef = strongSelf->_batchedBridgeRef;
591590
if (!batchedBridgeRef) {
592591
JSStringRef moduleNameJSStringRef = jscWrapper->JSStringCreateWithUTF8CString("__fbBatchedBridge");
593-
JSObjectRef globalObjectJSRef = jscWrapper->JSContextGetGlobalObject(ctx);
592+
JSObjectRef globalObjectJSRef = jscWrapper->JSContextGetGlobalObject(contextJSRef);
594593
batchedBridgeRef = jscWrapper->JSObjectGetProperty(contextJSRef, globalObjectJSRef, moduleNameJSStringRef, &errorJSRef);
595594
jscWrapper->JSStringRelease(moduleNameJSStringRef);
596595
strongSelf->_batchedBridgeRef = batchedBridgeRef;

React/Executors/RCTJSCWrapper.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@
1111

1212
#import "RCTDefines.h"
1313

14-
typedef JSStringRef (*JSValueToStringCopyFuncType)(JSContextRef, JSValueRef, JSValueRef *);
1514
typedef JSStringRef (*JSStringCreateWithCFStringFuncType)(CFStringRef);
16-
typedef CFStringRef (*JSStringCopyCFStringFuncType)(CFAllocatorRef, JSStringRef);
1715
typedef JSStringRef (*JSStringCreateWithUTF8CStringFuncType)(const char *);
1816
typedef void (*JSStringReleaseFuncType)(JSStringRef);
1917
typedef void (*JSGlobalContextSetNameFuncType)(JSGlobalContextRef, JSStringRef);
20-
typedef JSGlobalContextRef (*JSContextGetGlobalContextFuncType)(JSContextRef);
2118
typedef void (*JSObjectSetPropertyFuncType)(JSContextRef, JSObjectRef, JSStringRef, JSValueRef, JSPropertyAttributes, JSValueRef *);
2219
typedef JSObjectRef (*JSContextGetGlobalObjectFuncType)(JSContextRef);
2320
typedef JSValueRef (*JSObjectGetPropertyFuncType)(JSContextRef, JSObjectRef, JSStringRef, JSValueRef *);
@@ -31,13 +28,10 @@ typedef JSValueRef (*JSEvaluateScriptFuncType)(JSContextRef, JSStringRef, JSObje
3128
typedef void (*configureJSContextForIOSFuncType)(JSContextRef ctx, const char *cacheDir);
3229

3330
typedef struct RCTJSCWrapper {
34-
JSValueToStringCopyFuncType JSValueToStringCopy;
3531
JSStringCreateWithCFStringFuncType JSStringCreateWithCFString;
36-
JSStringCopyCFStringFuncType JSStringCopyCFString;
3732
JSStringCreateWithUTF8CStringFuncType JSStringCreateWithUTF8CString;
3833
JSStringReleaseFuncType JSStringRelease;
3934
JSGlobalContextSetNameFuncType JSGlobalContextSetName;
40-
JSContextGetGlobalContextFuncType JSContextGetGlobalContext;
4135
JSObjectSetPropertyFuncType JSObjectSetProperty;
4236
JSContextGetGlobalObjectFuncType JSContextGetGlobalObject;
4337
JSObjectGetPropertyFuncType JSObjectGetProperty;

React/Executors/RCTJSCWrapper.mm

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,10 @@
4444

4545
static void RCTSetUpSystemLibraryPointers(RCTJSCWrapper *wrapper)
4646
{
47-
wrapper->JSValueToStringCopy = JSValueToStringCopy;
4847
wrapper->JSStringCreateWithCFString = JSStringCreateWithCFString;
49-
wrapper->JSStringCopyCFString = JSStringCopyCFString;
5048
wrapper->JSStringCreateWithUTF8CString = JSStringCreateWithUTF8CString;
5149
wrapper->JSStringRelease = JSStringRelease;
5250
wrapper->JSGlobalContextSetName = JSGlobalContextSetName;
53-
wrapper->JSContextGetGlobalContext = JSContextGetGlobalContext;
5451
wrapper->JSObjectSetProperty = JSObjectSetProperty;
5552
wrapper->JSContextGetGlobalObject = JSContextGetGlobalObject;
5653
wrapper->JSObjectGetProperty = JSObjectGetProperty;
@@ -74,13 +71,10 @@ static void RCTSetUpCustomLibraryPointers(RCTJSCWrapper *wrapper)
7471
return;
7572
}
7673

77-
wrapper->JSValueToStringCopy = (JSValueToStringCopyFuncType)dlsym(libraryHandle, "JSValueToStringCopy");
7874
wrapper->JSStringCreateWithCFString = (JSStringCreateWithCFStringFuncType)dlsym(libraryHandle, "JSStringCreateWithCFString");
79-
wrapper->JSStringCopyCFString = (JSStringCopyCFStringFuncType)dlsym(libraryHandle, "JSStringCopyCFString");
8075
wrapper->JSStringCreateWithUTF8CString = (JSStringCreateWithUTF8CStringFuncType)dlsym(libraryHandle, "JSStringCreateWithUTF8CString");
8176
wrapper->JSStringRelease = (JSStringReleaseFuncType)dlsym(libraryHandle, "JSStringRelease");
8277
wrapper->JSGlobalContextSetName = (JSGlobalContextSetNameFuncType)dlsym(libraryHandle, "JSGlobalContextSetName");
83-
wrapper->JSContextGetGlobalContext = (JSContextGetGlobalContextFuncType)dlsym(libraryHandle, "JSContextGetGlobalContext");
8478
wrapper->JSObjectSetProperty = (JSObjectSetPropertyFuncType)dlsym(libraryHandle, "JSObjectSetProperty");
8579
wrapper->JSContextGetGlobalObject = (JSContextGetGlobalObjectFuncType)dlsym(libraryHandle, "JSContextGetGlobalObject");
8680
wrapper->JSObjectGetProperty = (JSObjectGetPropertyFuncType)dlsym(libraryHandle, "JSObjectGetProperty");

0 commit comments

Comments
 (0)