Expose new methods to Custom/System JSC
Reviewed By: fkgozali Differential Revision: D7998298 fbshipit-source-id: f20d5b961db1cc31880d383a67d8bba40dd8008f
This commit is contained in:
parent
a956551af7
commit
4ef099679d
|
@ -1200,6 +1200,10 @@
|
|||
A2440AA21DF8D854006E7BFC /* RCTReloadCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */; };
|
||||
A2440AA31DF8D854006E7BFC /* RCTReloadCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = A2440AA11DF8D854006E7BFC /* RCTReloadCommand.m */; };
|
||||
A2440AA41DF8D865006E7BFC /* RCTReloadCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */; };
|
||||
A2C986DF208C7DF700C0D579 /* JSWeak.h in Headers */ = {isa = PBXBuildFile; fileRef = A2E0E69F208AA9EC007044C1 /* JSWeak.h */; };
|
||||
A2C986E0208C7DF900C0D579 /* JSWeak.h in Headers */ = {isa = PBXBuildFile; fileRef = A2E0E69F208AA9EC007044C1 /* JSWeak.h */; };
|
||||
A2C986E1208C7E9C00C0D579 /* JSWeak.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = A2E0E69F208AA9EC007044C1 /* JSWeak.h */; };
|
||||
A2C986E2208C7EA800C0D579 /* JSWeak.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = A2E0E69F208AA9EC007044C1 /* JSWeak.h */; };
|
||||
AC70D2E91DE489E4002E6351 /* RCTJavaScriptLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = AC70D2E81DE489E4002E6351 /* RCTJavaScriptLoader.mm */; };
|
||||
B233E6EA1D2D845D00BC68BA /* RCTI18nManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B233E6E91D2D845D00BC68BA /* RCTI18nManager.m */; };
|
||||
B95154321D1B34B200FE7B80 /* RCTActivityIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = B95154311D1B34B200FE7B80 /* RCTActivityIndicatorView.m */; };
|
||||
|
@ -1571,6 +1575,7 @@
|
|||
dstPath = include/jschelpers;
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
A2C986E2208C7EA800C0D579 /* JSWeak.h in Copy Headers */,
|
||||
3DA982601E5B1089004F2374 /* JSCHelpers.h in Copy Headers */,
|
||||
3DA982611E5B1089004F2374 /* noncopyable.h in Copy Headers */,
|
||||
3DA982621E5B1089004F2374 /* Unicode.h in Copy Headers */,
|
||||
|
@ -1799,6 +1804,7 @@
|
|||
dstPath = include/jschelpers;
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
A2C986E1208C7E9C00C0D579 /* JSWeak.h in Copy Headers */,
|
||||
3DA9825A1E5B1079004F2374 /* JavaScriptCore.h in Copy Headers */,
|
||||
3DA9825B1E5B1079004F2374 /* JSCHelpers.h in Copy Headers */,
|
||||
3DA9825C1E5B1079004F2374 /* JSCWrapper.h in Copy Headers */,
|
||||
|
@ -2302,6 +2308,7 @@
|
|||
9936F3361F5F2F480010BF04 /* PrivateDataBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PrivateDataBase.h; path = privatedata/PrivateDataBase.h; sourceTree = "<group>"; };
|
||||
A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTReloadCommand.h; sourceTree = "<group>"; };
|
||||
A2440AA11DF8D854006E7BFC /* RCTReloadCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTReloadCommand.m; sourceTree = "<group>"; };
|
||||
A2E0E69F208AA9EC007044C1 /* JSWeak.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeak.h; sourceTree = "<group>"; };
|
||||
AC70D2E81DE489E4002E6351 /* RCTJavaScriptLoader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJavaScriptLoader.mm; sourceTree = "<group>"; };
|
||||
AC70D2EB1DE48A22002E6351 /* JSBundleType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBundleType.cpp; sourceTree = "<group>"; };
|
||||
ACDD3FDA1BC7430D00E7DE33 /* RCTBorderStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBorderStyle.h; sourceTree = "<group>"; };
|
||||
|
@ -2760,6 +2767,7 @@
|
|||
3D4A621D1DDD3985001F41B4 /* jschelpers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A2E0E69F208AA9EC007044C1 /* JSWeak.h */,
|
||||
19DED2281E77E29200F089BB /* systemJSCWrapper.cpp */,
|
||||
3D7A27DC1DE32541002E3F95 /* JavaScriptCore.h */,
|
||||
3D92B1071E0369AD0018521A /* JSCHelpers.cpp */,
|
||||
|
@ -3376,6 +3384,7 @@
|
|||
files = (
|
||||
19F61C041E8495FF00571D81 /* JSCHelpers.h in Headers */,
|
||||
19F61C051E8495FF00571D81 /* noncopyable.h in Headers */,
|
||||
A2C986E0208C7DF900C0D579 /* JSWeak.h in Headers */,
|
||||
19F61C061E8495FF00571D81 /* Unicode.h in Headers */,
|
||||
19F61C071E8495FF00571D81 /* Value.h in Headers */,
|
||||
3D3030251DF8295E00D6DDAE /* JavaScriptCore.h in Headers */,
|
||||
|
@ -3423,6 +3432,7 @@
|
|||
files = (
|
||||
13EBC6821E28733C00880AC5 /* Value.h in Headers */,
|
||||
13EBC6811E28733C00880AC5 /* Unicode.h in Headers */,
|
||||
A2C986DF208C7DF700C0D579 /* JSWeak.h in Headers */,
|
||||
13EBC6801E28733C00880AC5 /* noncopyable.h in Headers */,
|
||||
13EBC67E1E28726000880AC5 /* JSCHelpers.h in Headers */,
|
||||
3D3CD93D1DE5FC1400167DC4 /* JavaScriptCore.h in Headers */,
|
||||
|
|
|
@ -4,6 +4,7 @@ EXPORTED_HEADERS = [
|
|||
"JavaScriptCore.h",
|
||||
"JSCHelpers.h",
|
||||
"JSCWrapper.h",
|
||||
"JSWeak.h",
|
||||
"noncopyable.h",
|
||||
"Unicode.h",
|
||||
"Value.h",
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <functional>
|
||||
#include <string>
|
||||
#include <JavaScriptCore/JavaScript.h>
|
||||
#include <jschelpers/JSWeak.h>
|
||||
|
||||
#if defined(JSCINTERNAL) || (!defined(__APPLE__))
|
||||
#define JSC_IMPORT extern "C"
|
||||
|
@ -77,6 +78,10 @@ struct JSCWrapper {
|
|||
// JSContext
|
||||
JSC_WRAPPER_METHOD(JSContextGetGlobalContext);
|
||||
JSC_WRAPPER_METHOD(JSContextGetGlobalObject);
|
||||
JSC_WRAPPER_METHOD(JSContextGetGroup);
|
||||
JSC_WRAPPER_METHOD(JSContextGroupRetain);
|
||||
JSC_WRAPPER_METHOD(JSContextGroupRelease);
|
||||
|
||||
JSC_WRAPPER_METHOD(FBJSContextStartGCTimers);
|
||||
|
||||
// JSEvaluate
|
||||
|
@ -99,6 +104,7 @@ struct JSCWrapper {
|
|||
|
||||
// JSClass
|
||||
JSC_WRAPPER_METHOD(JSClassCreate);
|
||||
JSC_WRAPPER_METHOD(JSClassRetain);
|
||||
JSC_WRAPPER_METHOD(JSClassRelease);
|
||||
|
||||
// JSObject
|
||||
|
@ -141,6 +147,12 @@ struct JSCWrapper {
|
|||
JSC_WRAPPER_METHOD(JSValueUnprotect);
|
||||
JSC_WRAPPER_METHOD(JSValueIsNull);
|
||||
|
||||
// JSWeak
|
||||
JSC_WRAPPER_METHOD(JSWeakCreate);
|
||||
JSC_WRAPPER_METHOD(JSWeakRetain);
|
||||
JSC_WRAPPER_METHOD(JSWeakRelease);
|
||||
JSC_WRAPPER_METHOD(JSWeakGetObject);
|
||||
|
||||
// Sampling profiler
|
||||
JSC_WRAPPER_METHOD(JSSamplingProfilerEnabled);
|
||||
JSC_WRAPPER_METHOD(JSPokeSamplingProfiler);
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* Copyright (c) 2016-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <JavaScriptCore/JSObjectRef.h>
|
||||
|
||||
// These Symbols are included in JSC builds but not exported as part of the public headers.
|
||||
|
||||
#ifndef JSWeakPrivate_h
|
||||
#define JSWeakPrivate_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpaqueJSWeak* JSWeakRef;
|
||||
|
||||
JSWeakRef JSWeakCreate(JSContextGroupRef, JSObjectRef);
|
||||
|
||||
void JSWeakRetain(JSContextGroupRef, JSWeakRef);
|
||||
void JSWeakRelease(JSContextGroupRef, JSWeakRef);
|
||||
|
||||
JSObjectRef JSWeakGetObject(JSWeakRef);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // JSWeakPrivate_h
|
|
@ -72,16 +72,20 @@
|
|||
#define JSC_JSGlobalContextRelease(...) __jsc_wrapper(JSGlobalContextRelease, __VA_ARGS__)
|
||||
#define JSC_JSGlobalContextSetName(...) __jsc_wrapper(JSGlobalContextSetName, __VA_ARGS__)
|
||||
|
||||
jsc_poison(JSContextGroupCreate JSContextGroupRelease JSContextGroupRetain
|
||||
JSGlobalContextCreate JSGlobalContextCreateInGroup JSGlobalContextCopyName
|
||||
JSGlobalContextRelease JSGlobalContextRetain JSGlobalContextSetName)
|
||||
jsc_poison(JSContextGroupCreate JSGlobalContextCreate JSGlobalContextCreateInGroup
|
||||
JSGlobalContextCopyName JSGlobalContextRelease JSGlobalContextRetain
|
||||
JSGlobalContextSetName)
|
||||
|
||||
// JSContext
|
||||
#define JSC_JSContextGetGlobalContext(...) __jsc_wrapper(JSContextGetGlobalContext, __VA_ARGS__)
|
||||
#define JSC_JSContextGetGlobalObject(...) __jsc_wrapper(JSContextGetGlobalObject, __VA_ARGS__)
|
||||
#define JSC_JSContextGetGroup(ctx) __jsc_wrapper(JSContextGetGroup, ctx)
|
||||
#define JSC_JSContextGroupRetain(...) __jsc_bool_wrapper(JSContextGroupRetain, __VA_ARGS__)
|
||||
#define JSC_JSContextGroupRelease(...) __jsc_bool_wrapper(JSContextGroupRelease, __VA_ARGS__)
|
||||
#define JSC_FBJSContextStartGCTimers(...) __jsc_wrapper(FBJSContextStartGCTimers, __VA_ARGS__)
|
||||
|
||||
jsc_poison(JSContextGetGlobalContext JSContextGetGlobalObject JSContextGetGroup FBJSContextStartGCTimers)
|
||||
jsc_poison(JSContextGetGlobalContext JSContextGetGlobalObject JSContextGetGroup
|
||||
JSContextGroupRelease JSContextGroupRetain FBJSContextStartGCTimers)
|
||||
|
||||
// JSEvaluate
|
||||
#define JSC_JSEvaluateScript(...) __jsc_wrapper(JSEvaluateScript, __VA_ARGS__)
|
||||
|
@ -134,6 +138,7 @@ jsc_poison(JSValueCreateJSONString JSValueGetType JSValueGetTypedArrayType JSVal
|
|||
|
||||
// JSClass
|
||||
#define JSC_JSClassCreate(...) __jsc_bool_wrapper(JSClassCreate, __VA_ARGS__)
|
||||
#define JSC_JSClassRetain(...) __jsc_bool_wrapper(JSClassRetain, __VA_ARGS__)
|
||||
#define JSC_JSClassRelease(...) __jsc_bool_wrapper(JSClassRelease, __VA_ARGS__)
|
||||
|
||||
jsc_poison(JSClassCreate JSClassRelease JSClassRetain)
|
||||
|
@ -182,6 +187,12 @@ jsc_poison(JSObjectMakeArrayBufferWithBytesNoCopy JSObjectMakeTypedArray
|
|||
JSObjectGetTypedArrayBuffer JSObjectGetTypedArrayLength
|
||||
JSObjectGetArrayBufferBytesPtr JSObjectGetArrayBufferByteLength)
|
||||
|
||||
// JSWeak
|
||||
#define JSC_JSWeakCreate(...) __jsc_bool_wrapper(JSWeakCreate, __VA_ARGS__)
|
||||
#define JSC_JSWeakRetain(...) __jsc_bool_wrapper(JSWeakRetain, __VA_ARGS__)
|
||||
#define JSC_JSWeakRelease(...) __jsc_bool_wrapper(JSWeakRelease, __VA_ARGS__)
|
||||
#define JSC_JSWeakGetObject(...) __jsc_drop_ctx_wrapper(JSWeakGetObject, __VA_ARGS__)
|
||||
|
||||
// Sampling profiler
|
||||
#define JSC_JSSamplingProfilerEnabled(...) __jsc_drop_ctx_wrapper(JSSamplingProfilerEnabled, __VA_ARGS__)
|
||||
#define JSC_JSPokeSamplingProfiler(...) __jsc_wrapper(JSPokeSamplingProfiler, __VA_ARGS__)
|
||||
|
|
|
@ -34,6 +34,11 @@ UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(configureJSCForIOS)
|
|||
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(FBJSContextStartGCTimers)
|
||||
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSWeakCreate)
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSWeakRetain)
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSWeakRelease)
|
||||
UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSWeakGetObject)
|
||||
|
||||
bool JSSamplingProfilerEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
@ -57,6 +62,10 @@ const JSCWrapper* systemJSCWrapper() {
|
|||
|
||||
.JSContextGetGlobalContext = JSContextGetGlobalContext,
|
||||
.JSContextGetGlobalObject = JSContextGetGlobalObject,
|
||||
.JSContextGetGroup = JSContextGetGroup,
|
||||
.JSContextGroupRetain = JSContextGroupRetain,
|
||||
.JSContextGroupRelease = JSContextGroupRelease,
|
||||
|
||||
.FBJSContextStartGCTimers =
|
||||
(decltype(&FBJSContextStartGCTimers))
|
||||
Unimplemented_FBJSContextStartGCTimers,
|
||||
|
@ -82,6 +91,7 @@ const JSCWrapper* systemJSCWrapper() {
|
|||
.JSStringRetain = JSStringRetain,
|
||||
|
||||
.JSClassCreate = JSClassCreate,
|
||||
.JSClassRetain = JSClassRetain,
|
||||
.JSClassRelease = JSClassRelease,
|
||||
|
||||
.JSObjectCallAsConstructor = JSObjectCallAsConstructor,
|
||||
|
@ -121,6 +131,19 @@ const JSCWrapper* systemJSCWrapper() {
|
|||
.JSValueUnprotect = JSValueUnprotect,
|
||||
.JSValueIsNull = JSValueIsNull,
|
||||
|
||||
.JSWeakCreate =
|
||||
(decltype(&JSWeakCreate))
|
||||
Unimplemented_JSWeakCreate,
|
||||
.JSWeakRetain =
|
||||
(decltype(&JSWeakRetain))
|
||||
Unimplemented_JSWeakRetain,
|
||||
.JSWeakRelease =
|
||||
(decltype(&JSWeakRelease))
|
||||
Unimplemented_JSWeakRelease,
|
||||
.JSWeakGetObject =
|
||||
(decltype(&JSWeakGetObject))
|
||||
Unimplemented_JSWeakGetObject,
|
||||
|
||||
.JSSamplingProfilerEnabled = JSSamplingProfilerEnabled,
|
||||
.JSPokeSamplingProfiler =
|
||||
(decltype(&JSPokeSamplingProfiler))
|
||||
|
|
Loading…
Reference in New Issue