Properly removing bytecode caching from iOS

Reviewed By: alexeylang

Differential Revision: D4003142

fbshipit-source-id: 9decdba54417bce8240a5e8f34c0c32b16c9f494
This commit is contained in:
Dan Caspi 2016-10-13 06:46:42 -07:00 коммит произвёл Facebook Github Bot
Родитель 863459064f
Коммит ce179d4b43
3 изменённых файлов: 0 добавлений и 18 удалений

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

@ -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, ^{