mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 15:45:32 +00:00
Properly removing bytecode caching from iOS
Reviewed By: alexeylang Differential Revision: D4003142 fbshipit-source-id: 9decdba54417bce8240a5e8f34c0c32b16c9f494
This commit is contained in:
parent
863459064f
commit
ce179d4b43
@ -344,7 +344,6 @@ static NSThread *newJavaScriptThread(void)
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:RCTJavaScriptContextCreatedNotification
|
||||
object:context];
|
||||
|
||||
configureCacheOnContext(context, self->_jscWrapper);
|
||||
installBasicSynchronousHooksOnContext(context);
|
||||
}
|
||||
|
||||
@ -434,18 +433,6 @@ static NSThread *newJavaScriptThread(void)
|
||||
}];
|
||||
}
|
||||
|
||||
/** If configureJSContextForIOS is available on jscWrapper, calls it with the correct parameters. */
|
||||
static void configureCacheOnContext(JSContext *context, RCTJSCWrapper *jscWrapper)
|
||||
{
|
||||
if (jscWrapper->configureJSContextForIOS != NULL) {
|
||||
NSString *cachesPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
|
||||
RCTAssert(cachesPath != nil, @"cachesPath should not be nil");
|
||||
if (cachesPath) {
|
||||
jscWrapper->configureJSContextForIOS(context.JSGlobalContextRef, [cachesPath UTF8String]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Installs synchronous hooks that don't require a weak reference back to the RCTJSCExecutor. */
|
||||
static void installBasicSynchronousHooksOnContext(JSContext *context)
|
||||
{
|
||||
@ -964,7 +951,6 @@ RCT_EXPORT_METHOD(setContextName:(nonnull NSString *)name)
|
||||
{
|
||||
_jscWrapper = RCTJSCWrapperCreate(_useCustomJSCLibrary);
|
||||
_context = [_jscWrapper->JSContext new];
|
||||
configureCacheOnContext(_context, _jscWrapper);
|
||||
installBasicSynchronousHooksOnContext(_context);
|
||||
dispatch_semaphore_signal(_semaphore);
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ typedef JSStringRef (*JSValueCreateJSONStringFuncType)(JSContextRef, JSValueRef,
|
||||
typedef bool (*JSValueIsUndefinedFuncType)(JSContextRef, JSValueRef);
|
||||
typedef bool (*JSValueIsNullFuncType)(JSContextRef, JSValueRef);
|
||||
typedef JSValueRef (*JSEvaluateScriptFuncType)(JSContextRef, JSStringRef, JSObjectRef, JSStringRef, int, JSValueRef *);
|
||||
typedef void (*configureJSContextForIOSFuncType)(JSContextRef ctx, const char *cacheDir);
|
||||
|
||||
typedef struct RCTJSCWrapper {
|
||||
JSStringCreateWithCFStringFuncType JSStringCreateWithCFString;
|
||||
@ -44,7 +43,6 @@ typedef struct RCTJSCWrapper {
|
||||
JSEvaluateScriptFuncType JSEvaluateScript;
|
||||
Class JSContext;
|
||||
Class JSValue;
|
||||
configureJSContextForIOSFuncType configureJSContextForIOS;
|
||||
} RCTJSCWrapper;
|
||||
|
||||
RCT_EXTERN RCTJSCWrapper *RCTJSCWrapperCreate(BOOL useCustomJSC);
|
||||
|
@ -59,7 +59,6 @@ static void RCTSetUpSystemLibraryPointers(RCTJSCWrapper *wrapper)
|
||||
wrapper->JSEvaluateScript = JSEvaluateScript;
|
||||
wrapper->JSContext = [JSContext class];
|
||||
wrapper->JSValue = [JSValue class];
|
||||
wrapper->configureJSContextForIOS = NULL;
|
||||
}
|
||||
|
||||
static void RCTSetUpCustomLibraryPointers(RCTJSCWrapper *wrapper)
|
||||
@ -86,7 +85,6 @@ static void RCTSetUpCustomLibraryPointers(RCTJSCWrapper *wrapper)
|
||||
wrapper->JSEvaluateScript = (JSEvaluateScriptFuncType)dlsym(libraryHandle, "JSEvaluateScript");
|
||||
wrapper->JSContext = (__bridge Class)dlsym(libraryHandle, "OBJC_CLASS_$_JSContext");
|
||||
wrapper->JSValue = (__bridge Class)dlsym(libraryHandle, "OBJC_CLASS_$_JSValue");
|
||||
wrapper->configureJSContextForIOS = NULL;
|
||||
|
||||
static dispatch_once_t once;
|
||||
dispatch_once(&once, ^{
|
||||
|
Loading…
x
Reference in New Issue
Block a user