diff --git a/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj b/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj index 406890ccc9f9eb..2fa18295ebb46e 100644 --- a/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj +++ b/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj @@ -13,7 +13,6 @@ 2D3B5F3D1D9B165B00451313 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; }; 2D3B5F3E1D9B165B00451313 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; }; 2D3B5F401D9B165B00451313 /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; }; - 2DC5E5281F3A6CFD000EE84B /* libfishhook-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DC5E5271F3A6CFD000EE84B /* libfishhook-tvOS.a */; }; 3C86DF7C1ADF695F0047B81A /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; }; 3DBE0D141F3B185A0099AA32 /* fishhook.c in Sources */ = {isa = PBXBuildFile; fileRef = 3DBE0D121F3B185A0099AA32 /* fishhook.c */; }; 3DBE0D151F3B185A0099AA32 /* fishhook.c in Sources */ = {isa = PBXBuildFile; fileRef = 3DBE0D121F3B185A0099AA32 /* fishhook.c */; }; @@ -21,6 +20,7 @@ 3DBE0D821F3B1B0C0099AA32 /* fishhook.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3DBE0D131F3B185A0099AA32 /* fishhook.h */; }; A12E9E2E1E5DEC4E0029001B /* RCTReconnectingWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */; }; A12E9E2F1E5DEC550029001B /* RCTReconnectingWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */; }; + ED297176215062BA00B7C4FE /* libfishhook-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DBE0D0D1F3B181C0099AA32 /* libfishhook-tvOS.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -95,7 +95,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 2DC5E5281F3A6CFD000EE84B /* libfishhook-tvOS.a in Frameworks */, + ED297176215062BA00B7C4FE /* libfishhook-tvOS.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index 06b931a60134f3..9eff9cec5d4c6b 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -14,20 +14,22 @@ PODS: - Folly (= 2016.10.31.00) - React/Core - React/cxxreact + - React/jsiexecutor - React/cxxreact (1000.0.0): - boost-for-react-native (= 1.63.0) - Folly (= 2016.10.31.00) - - React/jschelpers - React/jsinspector - React/DevSupport (1000.0.0): - React/Core - React/RCTWebSocket - React/fishhook (1000.0.0) - - React/jschelpers (1000.0.0): + - React/jsi (1000.0.0): - Folly (= 2016.10.31.00) - - React/PrivateDatabase + - React/jsiexecutor (1000.0.0): + - Folly (= 2016.10.31.00) + - React/cxxreact + - React/jsi - React/jsinspector (1000.0.0) - - React/PrivateDatabase (1000.0.0) - React/RCTActionSheet (1000.0.0): - React/Core - React/RCTAnimation (1000.0.0): @@ -103,8 +105,8 @@ SPEC CHECKSUMS: boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c DoubleConversion: bb338842f62ab1d708ceb63ec3d999f0f3d98ecd Folly: c89ac2d5c6ab169cd7397ef27485c44f35f742c7 - glog: e8acf0ebbf99759d3ff18c86c292a5898282dcde - React: 1fe0eb13d90b625d94c3b117c274dcfd2e760e11 + glog: 848747cb7af3aac910395f03626d7f63636e8ce6 + React: 2ab9e486351bee668da0105d7aee0718f18a3ae2 yoga: b1ce48b6cf950b98deae82838f5173ea7cf89e85 PODFILE CHECKSUM: 7af77fbc34af9646e8c6389e7e2c0b4663bb16d9 diff --git a/RNTester/RNTester.xcodeproj/project.pbxproj b/RNTester/RNTester.xcodeproj/project.pbxproj index 51cef6ad024e3c..59f27525d126ce 100644 --- a/RNTester/RNTester.xcodeproj/project.pbxproj +++ b/RNTester/RNTester.xcodeproj/project.pbxproj @@ -131,6 +131,8 @@ C654F0B31EB34A73000B7A9A /* RNTesterTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = C654F0B21EB34A73000B7A9A /* RNTesterTestModule.m */; }; C654F17E1EB34D24000B7A9A /* RNTesterTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = C654F0B21EB34A73000B7A9A /* RNTesterTestModule.m */; }; D85B829E1AB6D5D7003F4FE2 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D85B829C1AB6D5CE003F4FE2 /* libRCTVibration.a */; }; + ED2970992150247000B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2970982150247000B7C4FE /* JavaScriptCore.framework */; }; + EDEBC856214C774100DD5AC8 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDEBC7DA214C681C00DD5AC8 /* JavaScriptCore.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -218,20 +220,6 @@ remoteGlobalIDString = 2DD3238F1DA2DD8A000FE1B8; remoteInfo = "RNTester-tvOS"; }; - 2D609F0C1F84BD7E00D65B08 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 9936F3131F5F2E4B0010BF04; - remoteInfo = privatedata; - }; - 2D609F0E1F84BD7E00D65B08 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 9936F32F1F5F2E5B0010BF04; - remoteInfo = "privatedata-tvOS"; - }; 2D66FF641ECA405900F0A767 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 2D66FF5F1ECA405900F0A767 /* ART.xcodeproj */; @@ -351,20 +339,6 @@ remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4; remoteInfo = "cxxreact-tvOS"; }; - 3D05748F1DE6008900184BB4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD90B1DE5FBD600167DC4; - remoteInfo = jschelpers; - }; - 3D0574911DE6008900184BB4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4; - remoteInfo = "jschelpers-tvOS"; - }; 3D13F84B1D6F6B5F00E69E0E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; @@ -463,8 +437,49 @@ remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; remoteInfo = RCTVibration; }; + ED2970942150246200B7C4FE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = ED296FB6214C9A0900B7C4FE; + remoteInfo = "jsi-tvOS"; + }; + ED2970962150246200B7C4FE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = ED296FEE214C9CF800B7C4FE; + remoteInfo = "jsiexecutor-tvOS"; + }; + EDEBC6FB214B402000DD5AC8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = EDEBC6D6214B3E7000DD5AC8; + remoteInfo = jsi; + }; + EDEBC7C9214C503A00DD5AC8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = EDEBC73B214B45A300DD5AC8; + remoteInfo = jsiexecutor; + }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + EDEBC7DE214C68E400DD5AC8 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 12; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 001BFCE31D838343008E587E /* RCTMultipartStreamReaderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMultipartStreamReaderTests.m; sourceTree = ""; }; 004D289E1AAF61C70097A701 /* RNTesterUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterUnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -549,6 +564,8 @@ BC9C033F1DC9F1D600B1C635 /* RCTDevMenuTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDevMenuTests.m; sourceTree = ""; }; C654F0B21EB34A73000B7A9A /* RNTesterTestModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTesterTestModule.m; sourceTree = ""; }; D85B82911AB6D5CE003F4FE2 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = ../Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = ""; }; + ED2970982150247000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; + EDEBC7DA214C681C00DD5AC8 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -577,6 +594,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + EDEBC856214C774100DD5AC8 /* JavaScriptCore.framework in Frameworks */, 3D0E379D1F1CC77200DCAC9F /* libReact.a in Frameworks */, 52C11BBB1EEACA7100C1A058 /* libRCTBlob.a in Frameworks */, 2D66FF8F1ECA406D00F0A767 /* libART.a in Frameworks */, @@ -615,6 +633,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + ED2970992150247000B7C4FE /* JavaScriptCore.framework in Frameworks */, 52C11BE11EEACA7800C1A058 /* libRCTBlob-tvOS.a in Frameworks */, 2D66FF901ECA407E00F0A767 /* libART-tvOS.a in Frameworks */, 2DD323EA1DA2DE3F000FE1B8 /* libReact.a in Frameworks */, @@ -843,16 +862,16 @@ 3D3C08831DE3424E00C268FA /* libyoga.a */, 3D05748C1DE6008900184BB4 /* libcxxreact.a */, 3D05748E1DE6008900184BB4 /* libcxxreact.a */, - 3D0574901DE6008900184BB4 /* libjschelpers.a */, - 3D0574921DE6008900184BB4 /* libjschelpers.a */, 3DCE53221FEAB1C500613583 /* libjsinspector.a */, 3DCE53241FEAB1C500613583 /* libjsinspector-tvOS.a */, 3D507F421EBC88B700B56834 /* libthird-party.a */, 2D66FF8C1ECA405900F0A767 /* libthird-party.a */, 3D507F441EBC88B700B56834 /* libdouble-conversion.a */, 2D66FF8E1ECA405900F0A767 /* libdouble-conversion.a */, - 2D609F0D1F84BD7E00D65B08 /* libprivatedata.a */, - 2D609F0F1F84BD7E00D65B08 /* libprivatedata-tvOS.a */, + EDEBC6FC214B402000DD5AC8 /* libjsi.a */, + EDEBC7CA214C503A00DD5AC8 /* libjsiexecutor.a */, + ED2970952150246200B7C4FE /* libjsi-tvOS.a */, + ED2970972150246200B7C4FE /* libjsiexecutor-tvOS.a */, ); name = Products; sourceTree = ""; @@ -920,6 +939,8 @@ 2DE7E7D81FB2A4F3009E225D /* Frameworks */ = { isa = PBXGroup; children = ( + ED2970982150247000B7C4FE /* JavaScriptCore.framework */, + EDEBC7DA214C681C00DD5AC8 /* JavaScriptCore.framework */, ); name = Frameworks; sourceTree = ""; @@ -1039,6 +1060,7 @@ 13B07F8C1A680F5B00A75B9A /* Frameworks */, 13B07F8E1A680F5B00A75B9A /* Resources */, 68CD48B71D2BCB2C007E06A9 /* Run Script */, + EDEBC7DE214C68E400DD5AC8 /* Embed Frameworks */, ); buildRules = ( ); @@ -1151,7 +1173,7 @@ CreatedOnToolsVersion = 6.1.1; }; 13B07F861A680F5B00A75B9A = { - DevelopmentTeam = V9WTTPBFK9; + DevelopmentTeam = VYK7DLU38Z; }; 143BC5941B21E3E100462512 = { CreatedOnToolsVersion = 6.3.2; @@ -1332,20 +1354,6 @@ remoteRef = 14DC67F01AB71876001358AB /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 2D609F0D1F84BD7E00D65B08 /* libprivatedata.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libprivatedata.a; - remoteRef = 2D609F0C1F84BD7E00D65B08 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 2D609F0F1F84BD7E00D65B08 /* libprivatedata-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libprivatedata-tvOS.a"; - remoteRef = 2D609F0E1F84BD7E00D65B08 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 2D66FF651ECA405900F0A767 /* libART.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -1465,20 +1473,6 @@ remoteRef = 3D05748D1DE6008900184BB4 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 3D0574901DE6008900184BB4 /* libjschelpers.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libjschelpers.a; - remoteRef = 3D05748F1DE6008900184BB4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3D0574921DE6008900184BB4 /* libjschelpers.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libjschelpers.a; - remoteRef = 3D0574911DE6008900184BB4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 3D3C08811DE3424E00C268FA /* libyoga.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -1570,6 +1564,34 @@ remoteRef = D85B829B1AB6D5CE003F4FE2 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + ED2970952150246200B7C4FE /* libjsi-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libjsi-tvOS.a"; + remoteRef = ED2970942150246200B7C4FE /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + ED2970972150246200B7C4FE /* libjsiexecutor-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libjsiexecutor-tvOS.a"; + remoteRef = ED2970962150246200B7C4FE /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + EDEBC6FC214B402000DD5AC8 /* libjsi.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libjsi.a; + remoteRef = EDEBC6FB214B402000DD5AC8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + EDEBC7CA214C503A00DD5AC8 /* libjsiexecutor.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libjsiexecutor.a; + remoteRef = EDEBC7C9214C503A00DD5AC8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ @@ -1850,9 +1872,10 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = V9WTTPBFK9; + DEVELOPMENT_TEAM = VYK7DLU38Z; INFOPLIST_FILE = "$(SRCROOT)/RNTester/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.react.uiapp; PRODUCT_NAME = RNTester; @@ -1864,9 +1887,10 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = V9WTTPBFK9; + DEVELOPMENT_TEAM = VYK7DLU38Z; INFOPLIST_FILE = "$(SRCROOT)/RNTester/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.react.uiapp; PRODUCT_NAME = RNTester; diff --git a/React.podspec b/React.podspec index 7f03a6350e7de5..22e282b24f522b 100644 --- a/React.podspec +++ b/React.podspec @@ -76,6 +76,7 @@ Pod::Spec.new do |s| ss.dependency "Folly", folly_version ss.dependency "React/Core" ss.dependency "React/cxxreact" + ss.dependency "React/jsiexecutor" ss.compiler_flags = folly_compiler_flags ss.private_header_files = "React/Cxx*/*.h" ss.source_files = "React/Cxx*/*.{h,m,mm}" @@ -105,19 +106,29 @@ Pod::Spec.new do |s| ss.source_files = "React/**/RCTTV*.{h,m}" end - s.subspec "jschelpers" do |ss| + s.subspec "jsinspector" do |ss| + ss.source_files = "ReactCommon/jsinspector/*.{cpp,h}" + ss.private_header_files = "ReactCommon/jsinspector/*.h" + ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" } + end + + s.subspec "jsiexecutor" do |ss| + ss.dependency "React/cxxreact" + ss.dependency "React/jsi" ss.dependency "Folly", folly_version - ss.dependency "React/PrivateDatabase" ss.compiler_flags = folly_compiler_flags - ss.source_files = "ReactCommon/jschelpers/*.{cpp,h}" - ss.private_header_files = "ReactCommon/jschelpers/*.h" + ss.source_files = "ReactCommon/jsiexecutor/{*.cpp,jsireact/*.h}" + ss.private_header_files = "ReactCommon/jsiexecutor/jsireact/*.h" + ss.header_dir = "jsireact" ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" } - ss.framework = "JavaScriptCore" end - s.subspec "jsinspector" do |ss| - ss.source_files = "ReactCommon/jsinspector/*.{cpp,h}" - ss.private_header_files = "ReactCommon/jsinspector/*.h" + s.subspec "jsi" do |ss| + ss.dependency "Folly", folly_version + ss.compiler_flags = folly_compiler_flags + ss.source_files = "ReactCommon/jsi/*.{cpp,h}" + ss.private_header_files = "ReactCommon/jsi/*.h" + ss.framework = "JavaScriptCore" ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" } end @@ -128,7 +139,6 @@ Pod::Spec.new do |s| end s.subspec "cxxreact" do |ss| - ss.dependency "React/jschelpers" ss.dependency "React/jsinspector" ss.dependency "boost-for-react-native", "1.63.0" ss.dependency "Folly", folly_version diff --git a/React/Base/RCTBridge+Private.h b/React/Base/RCTBridge+Private.h index 08163f3cb0c8c9..0e4ef5762b2295 100644 --- a/React/Base/RCTBridge+Private.h +++ b/React/Base/RCTBridge+Private.h @@ -5,9 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -#import -#import - #import @class RCTModuleData; @@ -15,8 +12,6 @@ RCT_EXTERN NSArray *RCTGetModuleClasses(void); -RCT_EXTERN __attribute__((weak)) void RCTFBQuickPerformanceLoggerConfigureHooks(JSGlobalContextRef ctx); - #if RCT_DEBUG RCT_EXTERN void RCTVerifyAllModulesExported(NSArray *extraModules); #endif @@ -141,15 +136,6 @@ RCT_EXTERN void RCTRegisterModule(Class); @end -@interface RCTBridge (JavaScriptCore) - -/** - * The raw JSGlobalContextRef used by the bridge. - */ -@property (nonatomic, readonly, assign) JSGlobalContextRef jsContextRef; - -@end - @interface RCTBridge (Inspector) @property (nonatomic, readonly, getter=isInspectable) BOOL inspectable; diff --git a/React/Base/RCTBridge.h b/React/Base/RCTBridge.h index 776a03bdedcd5e..3af1a19767cb8d 100644 --- a/React/Base/RCTBridge.h +++ b/React/Base/RCTBridge.h @@ -169,11 +169,6 @@ RCT_EXTERN void RCTEnableJSINativeModule(BOOL enabled); */ - (BOOL)moduleIsInitialized:(Class)moduleClass; -/** - * Retrieve an extra module that gets bound to the JS context, if any. - */ -- (id)jsBoundExtraModuleForClass:(Class)moduleClass; - /** * All registered bridge module classes. */ diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index ba588876b6d974..5171f2ae220fd7 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -44,8 +44,6 @@ return result; } -void RCTFBQuickPerformanceLoggerConfigureHooks(__unused JSGlobalContextRef ctx) { } - /** * Register the given class as a bridge module. All modules must be registered * prior to the first bridge initialization. @@ -272,11 +270,6 @@ - (BOOL)moduleIsInitialized:(Class)moduleClass return [self.batchedBridge moduleIsInitialized:moduleClass]; } -- (id)jsBoundExtraModuleForClass:(Class)moduleClass -{ - return [self.batchedBridge jsBoundExtraModuleForClass:moduleClass]; -} - - (void)reload { #if RCT_ENABLE_INSPECTOR @@ -392,9 +385,4 @@ - (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path [self.batchedBridge registerSegmentWithId:segmentId path:path]; } -- (JSGlobalContextRef)jsContextRef -{ - return [self.batchedBridge jsContextRef]; -} - @end diff --git a/React/Base/RCTJSCErrorHandling.h b/React/Base/RCTJSCErrorHandling.h deleted file mode 100644 index a48f8f5996038b..00000000000000 --- a/React/Base/RCTJSCErrorHandling.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -/** - Translates a given exception into an NSError. - - @param exception The JavaScript exception object to translate into an NSError. This must be - a JavaScript Error object, otherwise no stack trace information will be available. - - @return The translated NSError object - - - The JS exception's name property is incorporated in the NSError's localized description - - The JS exception's message property is the NSError's failure reason - - The JS exception's unsymbolicated stack trace is available via the NSError userInfo's RCTJSExceptionUnsymbolicatedStackTraceKey - */ -RCT_EXTERN NSError *RCTNSErrorFromJSError(JSValue *exception); - -/** - Translates a given exception into an NSError. - - @see RCTNSErrorFromJSError for details - */ -RCT_EXTERN NSError *RCTNSErrorFromJSErrorRef(JSValueRef exceptionRef, JSGlobalContextRef ctx); diff --git a/React/Base/RCTJSCErrorHandling.mm b/React/Base/RCTJSCErrorHandling.mm deleted file mode 100644 index f6d57427e91211..00000000000000 --- a/React/Base/RCTJSCErrorHandling.mm +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RCTJSCErrorHandling.h" - -#import - -#import "RCTAssert.h" -#import "RCTJSStackFrame.h" -#import "RCTLog.h" - -NSString *const RCTJSExceptionUnsymbolicatedStackTraceKey = @"RCTJSExceptionUnsymbolicatedStackTraceKey"; - -NSError *RCTNSErrorFromJSError(JSValue *exception) -{ - NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; - userInfo[NSLocalizedDescriptionKey] = [NSString stringWithFormat:@"Unhandled JS Exception: %@", [exception[@"name"] toString] ?: @"Unknown"]; - NSString *const exceptionMessage = [exception[@"message"] toString]; - if ([exceptionMessage length]) { - userInfo[NSLocalizedFailureReasonErrorKey] = exceptionMessage; - } - NSString *const stack = [exception[@"stack"] toString]; - if ([@"undefined" isEqualToString:stack]) { - RCTLogWarn(@"Couldn't get stack trace for %@:%@", exception[@"sourceURL"], exception[@"line"]); - } else if ([stack length]) { - NSArray *const unsymbolicatedFrames = [RCTJSStackFrame stackFramesWithLines:stack]; - userInfo[RCTJSStackTraceKey] = unsymbolicatedFrames; - } - return [NSError errorWithDomain:RCTErrorDomain code:1 userInfo:userInfo]; -} - -NSError *RCTNSErrorFromJSErrorRef(JSValueRef exceptionRef, JSGlobalContextRef ctx) -{ - JSContext *context = [JSC_JSContext(ctx) contextWithJSGlobalContextRef:ctx]; - JSValue *exception = [JSC_JSValue(ctx) valueWithJSValueRef:exceptionRef inContext:context]; - return RCTNSErrorFromJSError(exception); -} diff --git a/React/Base/RCTJavaScriptExecutor.h b/React/Base/RCTJavaScriptExecutor.h index 45382ad74c9eed..d3739cb663dddb 100644 --- a/React/Base/RCTJavaScriptExecutor.h +++ b/React/Base/RCTJavaScriptExecutor.h @@ -7,8 +7,6 @@ #import -#import - #import #import diff --git a/React/Base/RCTJavaScriptLoader.mm b/React/Base/RCTJavaScriptLoader.mm index 4e707f3bafb946..5f14bd22ac4d60 100755 --- a/React/Base/RCTJavaScriptLoader.mm +++ b/React/Base/RCTJavaScriptLoader.mm @@ -10,7 +10,6 @@ #import #import -#import #import "RCTBridge.h" #import "RCTConvert.h" @@ -20,6 +19,8 @@ NSString *const RCTJavaScriptLoaderErrorDomain = @"RCTJavaScriptLoaderErrorDomain"; +static const int32_t JSNoBytecodeFileFormatVersion = -1; + @interface RCTSource() { @public diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index efc8a30589190c..9626673537fd39 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -29,15 +29,14 @@ #import #import #import -#import #import #import -#import #import -#import +#import +#import +#import #import "NSDataBigString.h" -#import "RCTJSCHelpers.h" #import "RCTMessageThread.h" #import "RCTObjcExecutor.h" @@ -57,6 +56,7 @@ typedef void (^RCTPendingCall)(); +using namespace facebook::jsc; using namespace facebook::react; /** @@ -178,18 +178,6 @@ @implementation RCTCxxBridge @synthesize performanceLogger = _performanceLogger; @synthesize valid = _valid; -+ (void)initialize -{ - if (self == [RCTCxxBridge class]) { - RCTPrepareJSCExecutor(); - } -} - -- (JSGlobalContextRef)jsContextRef -{ - return (JSGlobalContextRef)(_reactInstance ? _reactInstance->getJavaScriptContext() : nullptr); -} - - (std::shared_ptr)jsMessageThread { return _jsMessageThread; @@ -328,22 +316,13 @@ - (void)start executorFactory = [cxxDelegate jsExecutorFactoryForBridge:self]; } if (!executorFactory) { - BOOL useCustomJSC = - [self.delegate respondsToSelector:@selector(shouldBridgeUseCustomJSC:)] && - [self.delegate shouldBridgeUseCustomJSC:self]; - // We use the name of the device and the app for debugging & metrics - NSString *deviceName = [[UIDevice currentDevice] name]; - NSString *appName = [[NSBundle mainBundle] bundleIdentifier]; - // The arg is a cache dir. It's not used with standard JSC. - executorFactory.reset(new JSCExecutorFactory(folly::dynamic::object - ("OwnerIdentity", "ReactNative") - ("AppIdentity", [(appName ?: @"unknown") UTF8String]) - ("DeviceIdentity", [(deviceName ?: @"unknown") UTF8String]) - ("UseCustomJSC", (bool)useCustomJSC) - #if RCT_PROFILE - ("StartSamplingProfilerOnInit", (bool)self.devSettings.startSamplingProfilerOnLaunch) - #endif - )); + executorFactory = std::make_shared( + makeJSCRuntime(), + [](const std::string &message, unsigned int logLevel) { + _RCTLogJavaScriptInternal( + static_cast(logLevel), + [NSString stringWithUTF8String:message.c_str()]); + }, nullptr); } } else { id objcExecutor = [self moduleForClass:self.executorClass]; @@ -461,18 +440,6 @@ - (BOOL)moduleIsInitialized:(Class)moduleClass return _moduleDataByName[RCTBridgeModuleNameForClass(moduleClass)].hasInstance; } -- (id)jsBoundExtraModuleForClass:(Class)moduleClass -{ - if ([self.delegate conformsToProtocol:@protocol(RCTCxxBridgeDelegate)]) { - id cxxDelegate = (id) self.delegate; - if ([cxxDelegate respondsToSelector:@selector(jsBoundExtraModuleForClass:)]) { - return [cxxDelegate jsBoundExtraModuleForClass:moduleClass]; - } - } - - return nil; -} - - (std::shared_ptr)_buildModuleRegistry { if (!self.valid) { @@ -534,8 +501,6 @@ - (void)_initializeBridge:(std::shared_ptr)executorFactory std::make_unique("true")); } #endif - - [self installExtraJSBinding]; } RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); @@ -634,16 +599,6 @@ - (void)registerExtraModules RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); } -- (void)installExtraJSBinding -{ - if ([self.delegate conformsToProtocol:@protocol(RCTCxxBridgeDelegate)]) { - id cxxDelegate = (id) self.delegate; - if ([cxxDelegate respondsToSelector:@selector(installExtraJSBinding:)]) { - [cxxDelegate installExtraJSBinding:self.jsContextRef]; - } - } -} - - (NSArray *)_initializeModules:(NSArray> *)modules withDispatchGroup:(dispatch_group_t)dispatchGroup lazilyDiscovered:(BOOL)lazilyDiscovered diff --git a/React/CxxBridge/RCTCxxBridgeDelegate.h b/React/CxxBridge/RCTCxxBridgeDelegate.h index fdceb3b72ad9f7..cc75608b0ac2fd 100644 --- a/React/CxxBridge/RCTCxxBridgeDelegate.h +++ b/React/CxxBridge/RCTCxxBridgeDelegate.h @@ -8,7 +8,6 @@ #include #import -#import namespace facebook { namespace react { @@ -26,21 +25,9 @@ class JSExecutorFactory; /** * In the RCTCxxBridge, if this method is implemented, return a * ExecutorFactory instance which can be used to create the executor. - * If not implemented, or returns an empty pointer, JSCExecutorFactory - * will be used. + * If not implemented, or returns an empty pointer, JSIExecutorFactory + * will be used with a JSCRuntime. */ - (std::unique_ptr)jsExecutorFactoryForBridge:(RCTBridge *)bridge; -@optional - -/** - * Experimental: Perform installation of extra JS binding on the given JS context, as appropriate. - */ -- (void)installExtraJSBinding:(JSGlobalContextRef)jsContextRef; - -/** - * Experimental: Get the instance of the extra module/class which gets bound via `installExtraJSBinding:` - */ -- (id)jsBoundExtraModuleForClass:(Class)moduleClass; - @end diff --git a/React/CxxBridge/RCTJSCHelpers.h b/React/CxxBridge/RCTJSCHelpers.h deleted file mode 100644 index 0ef272c8d1136e..00000000000000 --- a/React/CxxBridge/RCTJSCHelpers.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -/** - * This must be invoked on iOS to set up platform dependencies before - * creating an instance of JSCExecutor. - */ - -void RCTPrepareJSCExecutor(); diff --git a/React/CxxBridge/RCTJSCHelpers.mm b/React/CxxBridge/RCTJSCHelpers.mm deleted file mode 100644 index 2bdbcd7cdd624f..00000000000000 --- a/React/CxxBridge/RCTJSCHelpers.mm +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "RCTJSCHelpers.h" - -#import - -#import -#import -#import -#import -#import - -using namespace facebook::react; - -namespace { - -JSValueRef nativeLoggingHook( - JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, - const JSValueRef arguments[], JSValueRef *exception) { - RCTLogLevel level = RCTLogLevelInfo; - if (argumentCount > 1) { - level = MAX(level, (RCTLogLevel)Value(ctx, arguments[1]).asNumber()); - } - if (argumentCount > 0) { - JSContext *contextObj = contextForGlobalContextRef(JSC_JSContextGetGlobalContext(ctx)); - JSValue *msg = [JSC_JSValue(ctx) valueWithJSValueRef:arguments[0] inContext:contextObj]; - _RCTLogJavaScriptInternal(level, [msg toString]); - } - return Value::makeUndefined(ctx); -} - -JSValueRef nativePerformanceNow( - JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, - const JSValueRef arguments[], JSValueRef *exception) { - return Value::makeNumber(ctx, CACurrentMediaTime() * 1000); -} - -} - -void RCTPrepareJSCExecutor() { - ReactMarker::logTaggedMarker = [](const ReactMarker::ReactMarkerId, const char *tag) {}; - JSCNativeHooks::loggingHook = nativeLoggingHook; - JSCNativeHooks::nowHook = nativePerformanceNow; - JSCNativeHooks::installPerfHooks = RCTFBQuickPerformanceLoggerConfigureHooks; -} diff --git a/React/CxxBridge/RCTMessageThread.mm b/React/CxxBridge/RCTMessageThread.mm index 767c11cf40d1d8..5017bbb4e35fdc 100644 --- a/React/CxxBridge/RCTMessageThread.mm +++ b/React/CxxBridge/RCTMessageThread.mm @@ -12,7 +12,6 @@ #import #import -#include // A note about the implementation: This class is not used // generically. It's a thin wrapper around a run loop which diff --git a/React/CxxModule/RCTCxxUtils.h b/React/CxxModule/RCTCxxUtils.h index a558494e0f445f..ac24636e9a1df6 100644 --- a/React/CxxModule/RCTCxxUtils.h +++ b/React/CxxModule/RCTCxxUtils.h @@ -5,12 +5,10 @@ * LICENSE file in the root directory of this source tree. */ +#include #include -#import - -#import -#import +#import @class RCTBridge; @class RCTModuleData; @@ -19,19 +17,10 @@ namespace facebook { namespace react { class Instance; +class NativeModule; std::vector> createNativeModules(NSArray *modules, RCTBridge *bridge, const std::shared_ptr &instance); -JSContext *contextForGlobalContextRef(JSGlobalContextRef contextRef); - -template<> -struct JSCValueEncoder { - static Value toJSCValue(JSGlobalContextRef ctx, id obj) { - JSValue *value = [JSC_JSValue(ctx) valueWithObject:obj inContext:contextForGlobalContextRef(ctx)]; - return {ctx, [value JSValueRef]}; - } -}; - NSError *tryAndReturnError(const std::function& func); NSString *deriveSourceURL(NSURL *url); diff --git a/React/CxxModule/RCTCxxUtils.mm b/React/CxxModule/RCTCxxUtils.mm index 8859d5563bdd7c..72dfa60ce69619 100644 --- a/React/CxxModule/RCTCxxUtils.mm +++ b/React/CxxModule/RCTCxxUtils.mm @@ -11,7 +11,7 @@ #import #import #import -#import +#import #import "DispatchMessageQueueThread.h" #import "RCTCxxModule.h" @@ -20,6 +20,8 @@ namespace facebook { namespace react { +using facebook::jsi::JSError; + std::vector> createNativeModules(NSArray *modules, RCTBridge *bridge, const std::shared_ptr &instance) { std::vector> nativeModules; @@ -37,39 +39,14 @@ return nativeModules; } -JSContext *contextForGlobalContextRef(JSGlobalContextRef contextRef) -{ - static std::mutex s_mutex; - static NSMapTable *s_contextCache; - - if (!contextRef) { - return nil; - } - - // Adding our own lock here, since JSC internal ones are insufficient - std::lock_guard lock(s_mutex); - if (!s_contextCache) { - NSPointerFunctionsOptions keyOptions = NSPointerFunctionsOpaqueMemory | NSPointerFunctionsOpaquePersonality; - NSPointerFunctionsOptions valueOptions = NSPointerFunctionsWeakMemory | NSPointerFunctionsObjectPersonality; - s_contextCache = [[NSMapTable alloc] initWithKeyOptions:keyOptions valueOptions:valueOptions capacity:0]; - } - - JSContext *ctx = [s_contextCache objectForKey:(__bridge id)contextRef]; - if (!ctx) { - ctx = [JSC_JSContext(contextRef) contextWithJSGlobalContextRef:contextRef]; - [s_contextCache setObject:ctx forKey:(__bridge id)contextRef]; - } - return ctx; -} - static NSError *errorWithException(const std::exception &e) { NSString *msg = @(e.what()); NSMutableDictionary *errorInfo = [NSMutableDictionary dictionary]; - const JSException *jsException = dynamic_cast(&e); - if (jsException) { - errorInfo[RCTJSRawStackTraceKey] = @(jsException->getStack().c_str()); + const auto *jsError = dynamic_cast(&e); + if (jsError) { + errorInfo[RCTJSRawStackTraceKey] = @(jsError->getStack().c_str()); msg = [@"Unhandled JS Exception: " stringByAppendingString:msg]; } diff --git a/React/DevSupport/RCTDevMenu.m b/React/DevSupport/RCTDevMenu.m index 5c85837aaa9fef..48dda3f1fe74af 100644 --- a/React/DevSupport/RCTDevMenu.m +++ b/React/DevSupport/RCTDevMenu.m @@ -269,12 +269,6 @@ - (void)addItem:(RCTDevMenuItem *)item }]]; } - if (devSettings.isJSCSamplingProfilerAvailable) { - [items addObject:[RCTDevMenuItem buttonItemWithTitle:@"Start / Stop JS Sampling Profiler" handler:^{ - [devSettings toggleJSCSamplingProfiler]; - }]]; - } - [items addObject:[RCTDevMenuItem buttonItemWithTitleBlock:^NSString *{ return @"Toggle Inspector"; } handler:^{ diff --git a/React/DevSupport/RCTInspectorDevServerHelper.h b/React/DevSupport/RCTInspectorDevServerHelper.h index ac91707fb77a36..c718dfd3b55e77 100644 --- a/React/DevSupport/RCTInspectorDevServerHelper.h +++ b/React/DevSupport/RCTInspectorDevServerHelper.h @@ -4,7 +4,6 @@ // LICENSE file in the root directory of this source tree. #import -#import #import #import diff --git a/React/DevSupport/RCTInspectorDevServerHelper.mm b/React/DevSupport/RCTInspectorDevServerHelper.mm index 0a3c1bfc1cdbf5..7aad19bc286404 100644 --- a/React/DevSupport/RCTInspectorDevServerHelper.mm +++ b/React/DevSupport/RCTInspectorDevServerHelper.mm @@ -2,15 +2,12 @@ #if RCT_DEV -#import #import #import #import "RCTDefines.h" #import "RCTInspectorPackagerConnection.h" -using namespace facebook::react; - static NSString *const kDebuggerMsgDisable = @"{ \"id\":1,\"method\":\"Debugger.disable\" }"; static NSString *getServerHost(NSURL *bundleURL, NSNumber *port) diff --git a/React/Fabric/RCTSurfacePresenter.mm b/React/Fabric/RCTSurfacePresenter.mm index 59891c02497f97..fb313817f81138 100644 --- a/React/Fabric/RCTSurfacePresenter.mm +++ b/React/Fabric/RCTSurfacePresenter.mm @@ -234,12 +234,3 @@ - (RCTBridge *)bridge_DO_NOT_USE } @end - -@implementation RCTBridge (RCTSurfacePresenter) - -- (RCTSurfacePresenter *)surfacePresenter -{ - return [self jsBoundExtraModuleForClass:[RCTSurfacePresenter class]]; -} - -@end diff --git a/React/Inspector/RCTInspector.mm b/React/Inspector/RCTInspector.mm index 0bb83db45675ab..79c1431f0faa00 100644 --- a/React/Inspector/RCTInspector.mm +++ b/React/Inspector/RCTInspector.mm @@ -3,7 +3,6 @@ #if RCT_DEV -#include #include #import "RCTDefines.h" diff --git a/React/Modules/RCTDevSettings.h b/React/Modules/RCTDevSettings.h index 8ca64e406c77ce..24c14a4cbc28c0 100644 --- a/React/Modules/RCTDevSettings.h +++ b/React/Modules/RCTDevSettings.h @@ -71,11 +71,6 @@ */ - (void)toggleElementInspector; -/** - * Toggle JSC's sampling profiler. - */ -- (void)toggleJSCSamplingProfiler; - /** * Enables starting of profiling sampler on launch */ diff --git a/React/Modules/RCTDevSettings.mm b/React/Modules/RCTDevSettings.mm index da2b29474df065..70454aebc1147e 100644 --- a/React/Modules/RCTDevSettings.mm +++ b/React/Modules/RCTDevSettings.mm @@ -9,14 +9,9 @@ #import -#import - -#import - #import "RCTBridge+Private.h" #import "RCTBridgeModule.h" #import "RCTEventDispatcher.h" -#import "RCTJSCSamplingProfiler.h" #import "RCTLog.h" #import "RCTProfile.h" #import "RCTUtils.h" @@ -29,7 +24,6 @@ static NSString *const kRCTDevSettingExecutorOverrideClass = @"executor-override"; static NSString *const kRCTDevSettingShakeToShowDevMenu = @"shakeToShow"; static NSString *const kRCTDevSettingIsPerfMonitorShown = @"RCTPerfMonitorKey"; -static NSString *const kRCTDevSettingStartSamplingProfilerOnLaunch = @"startSamplingProfilerOnLaunch"; static NSString *const kRCTDevSettingsUserDefaultsKey = @"RCTDevMenu"; @@ -40,7 +34,6 @@ #if RCT_ENABLE_INSPECTOR #import "RCTInspectorDevServerHelper.h" -#import #endif #if RCT_DEV @@ -112,7 +105,6 @@ @interface RCTDevSettings () BOOL _isJSLoaded; #if ENABLE_PACKAGER_CONNECTION RCTHandlerToken _reloadToken; - RCTHandlerToken _pokeSamplingProfilerToken; #endif } @@ -177,14 +169,6 @@ - (void)setBridge:(RCTBridge *)bridge } queue:dispatch_get_main_queue() forMethod:@"reload"]; - - _pokeSamplingProfilerToken = - [[RCTPackagerConnection sharedPackagerConnection] - addRequestHandler:^(NSDictionary *params, RCTPackagerClientResponder *responder) { - pokeSamplingProfiler(weakBridge, responder); - } - queue:dispatch_get_main_queue() - forMethod:@"pokeSamplingProfiler"]; #endif #if RCT_ENABLE_INSPECTOR @@ -201,32 +185,6 @@ - (void)setBridge:(RCTBridge *)bridge #endif } -#if ENABLE_PACKAGER_CONNECTION -static void pokeSamplingProfiler(RCTBridge *const bridge, RCTPackagerClientResponder *const responder) -{ - if (!bridge) { - [responder respondWithError:@"The bridge is nil. Try again."]; - return; - } - - JSGlobalContextRef globalContext = bridge.jsContextRef; - if (!JSC_JSSamplingProfilerEnabled(globalContext)) { - [responder respondWithError:@"The JSSamplingProfiler is disabled. See 'iOS specific setup' section here https://fburl.com/u4lw7xeq for some help"]; - return; - } - - // JSPokeSamplingProfiler() toggles the profiling process - JSValueRef jsResult = JSC_JSPokeSamplingProfiler(globalContext); - if (JSC_JSValueGetType(globalContext, jsResult) == kJSTypeNull) { - [responder respondWithResult:@"started"]; - } else { - JSContext *context = [JSC_JSContext(globalContext) contextWithJSGlobalContextRef:globalContext]; - NSString *results = [[JSC_JSValue(globalContext) valueWithJSValueRef:jsResult inContext:context] toObject]; - [responder respondWithResult:results]; - } -} -#endif - - (dispatch_queue_t)methodQueue { return dispatch_get_main_queue(); @@ -237,7 +195,6 @@ - (void)invalidate [_liveReloadUpdateTask cancel]; #if ENABLE_PACKAGER_CONNECTION [[RCTPackagerConnection sharedPackagerConnection] removeHandler:_reloadToken]; - [[RCTPackagerConnection sharedPackagerConnection] removeHandler:_pokeSamplingProfilerToken]; #endif [[NSNotificationCenter defaultCenter] removeObserver:self]; } @@ -277,11 +234,6 @@ - (BOOL)isLiveReloadAvailable return (_liveReloadURL != nil); } -- (BOOL)isJSCSamplingProfilerAvailable -{ - return JSC_JSSamplingProfilerEnabled(_bridge.jsContextRef); -} - RCT_EXPORT_METHOD(reload) { [_bridge reload]; @@ -394,20 +346,6 @@ - (BOOL)isHotLoadingEnabled } } -- (void)toggleJSCSamplingProfiler -{ - JSGlobalContextRef globalContext = _bridge.jsContextRef; - // JSPokeSamplingProfiler() toggles the profiling process - JSValueRef jsResult = JSC_JSPokeSamplingProfiler(globalContext); - - if (JSC_JSValueGetType(globalContext, jsResult) != kJSTypeNull) { - JSContext *context = [JSC_JSContext(globalContext) contextWithJSGlobalContextRef:globalContext]; - NSString *results = [[JSC_JSValue(globalContext) valueWithJSValueRef:jsResult inContext:context] toObject]; - RCTJSCSamplingProfiler *profilerModule = [_bridge moduleForClass:[RCTJSCSamplingProfiler class]]; - [profilerModule operationCompletedWithResults:results]; - } -} - - (BOOL)isElementInspectorShown { return [[self settingForKey:kRCTDevSettingIsInspectorShown] boolValue]; @@ -423,16 +361,6 @@ - (BOOL)isPerfMonitorShown return [[self settingForKey:kRCTDevSettingIsPerfMonitorShown] boolValue]; } -- (void)setStartSamplingProfilerOnLaunch:(BOOL)startSamplingProfilerOnLaunch -{ - [self _updateSettingWithValue:@(startSamplingProfilerOnLaunch) forKey:kRCTDevSettingStartSamplingProfilerOnLaunch]; -} - -- (BOOL)startSamplingProfilerOnLaunch -{ - return [[self settingForKey:kRCTDevSettingStartSamplingProfilerOnLaunch] boolValue]; -} - - (void)setExecutorClass:(Class)executorClass { _executorClass = executorClass; @@ -554,7 +482,6 @@ - (BOOL)isRemoteDebuggingAvailable { return NO; } - (id)settingForKey:(NSString *)key { return nil; } - (void)reload {} - (void)toggleElementInspector {} -- (void)toggleJSCSamplingProfiler {} @end diff --git a/React/Modules/RCTJSCSamplingProfiler.h b/React/Modules/RCTJSCSamplingProfiler.h deleted file mode 100644 index 50fb4c5b1f220f..00000000000000 --- a/React/Modules/RCTJSCSamplingProfiler.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RCTJSCSamplingProfiler : NSObject - -/** - * Receives a JSON string containing the result of a JSC CPU Profiling run, - * and sends them to the packager to be symbolicated and saved to disk. - * It is safe to call this method from any thread. - */ -- (void)operationCompletedWithResults:(NSString *)results; - -@end diff --git a/React/Modules/RCTJSCSamplingProfiler.m b/React/Modules/RCTJSCSamplingProfiler.m deleted file mode 100644 index f7fc7ebda88870..00000000000000 --- a/React/Modules/RCTJSCSamplingProfiler.m +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTJSCSamplingProfiler.h" - -#import "RCTBridge.h" -#import "RCTLog.h" - -@implementation RCTJSCSamplingProfiler - -@synthesize methodQueue = _methodQueue; -@synthesize bridge = _bridge; - -RCT_EXPORT_MODULE(RCTJSCSamplingProfiler); - -#ifdef RCT_PROFILE -RCT_EXPORT_METHOD(operationComplete:(__unused int)token result:(id)profileData error:(id)error) -{ - if (error) { - RCTLogError(@"JSC Sampling profiler ended with error: %@", error); - return; - } - - // Create a POST request with all of the datas - NSURL *url = [NSURL URLWithString:@"/jsc-profile" relativeToURL:self.bridge.bundleURL]; - NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url - cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData - timeoutInterval:60]; - [request setHTTPMethod:@"POST"]; - [request setHTTPBody:[profileData dataUsingEncoding:NSUTF8StringEncoding]]; - - // Send the request - NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]]; - NSURLSessionDataTask *sessionDataTask = [session dataTaskWithRequest:request completionHandler:^(__unused NSData *data, __unused NSURLResponse *response, NSError *sessionError) { - if (sessionError) { - RCTLogWarn(@"JS CPU Profile data failed to send. Is the packager server running locally?\nDetails: %@", error); - } else { - RCTLogInfo(@"JS CPU Profile data sent successfully."); - } - }]; - - [sessionDataTask resume]; -} - -- (void)operationCompletedWithResults:(NSString *)results -{ - // Send the results to the packager, using the module's queue. - dispatch_async(self.methodQueue, ^{ - [self operationComplete:0 result:results error:nil]; - }); -} - -#endif - -@end diff --git a/React/React.xcodeproj/project.pbxproj b/React/React.xcodeproj/project.pbxproj index 89a857edf2fdeb..b90115c4e84512 100644 --- a/React/React.xcodeproj/project.pbxproj +++ b/React/React.xcodeproj/project.pbxproj @@ -56,16 +56,6 @@ 134D63C31F1FEC4B008872B5 /* RCTCxxBridgeDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 134D63C21F1FEC4B008872B5 /* RCTCxxBridgeDelegate.h */; }; 134D63C41F1FEC65008872B5 /* RCTCxxBridgeDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 134D63C21F1FEC4B008872B5 /* RCTCxxBridgeDelegate.h */; }; 13513F3C1B1F43F400FCE529 /* RCTProgressViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13513F3B1B1F43F400FCE529 /* RCTProgressViewManager.m */; }; - 135A9BFB1E7B0EAE00587AEB /* RCTJSCErrorHandling.h in Headers */ = {isa = PBXBuildFile; fileRef = 135A9BF91E7B0EAE00587AEB /* RCTJSCErrorHandling.h */; }; - 135A9BFC1E7B0EAE00587AEB /* RCTJSCErrorHandling.mm in Sources */ = {isa = PBXBuildFile; fileRef = 135A9BFA1E7B0EAE00587AEB /* RCTJSCErrorHandling.mm */; }; - 135A9BFF1E7B0EE600587AEB /* RCTJSCHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 135A9BFD1E7B0EE600587AEB /* RCTJSCHelpers.h */; }; - 135A9C001E7B0EE600587AEB /* RCTJSCHelpers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 135A9BFE1E7B0EE600587AEB /* RCTJSCHelpers.mm */; }; - 135A9C011E7B0F4700587AEB /* systemJSCWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 19DED2281E77E29200F089BB /* systemJSCWrapper.cpp */; }; - 135A9C021E7B0F4800587AEB /* systemJSCWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 19DED2281E77E29200F089BB /* systemJSCWrapper.cpp */; }; - 135A9C031E7B0F6100587AEB /* RCTJSCErrorHandling.h in Headers */ = {isa = PBXBuildFile; fileRef = 135A9BF91E7B0EAE00587AEB /* RCTJSCErrorHandling.h */; }; - 135A9C041E7B0F6400587AEB /* RCTJSCErrorHandling.mm in Sources */ = {isa = PBXBuildFile; fileRef = 135A9BFA1E7B0EAE00587AEB /* RCTJSCErrorHandling.mm */; }; - 135A9C051E7B0F7500587AEB /* RCTJSCHelpers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 135A9BFE1E7B0EE600587AEB /* RCTJSCHelpers.mm */; }; - 135A9C061E7B0F7800587AEB /* RCTJSCHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 135A9BFD1E7B0EE600587AEB /* RCTJSCHelpers.h */; }; 13723B501A82FD3C00F88898 /* RCTStatusBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13723B4F1A82FD3C00F88898 /* RCTStatusBarManager.m */; }; 1372B70A1AB030C200659ED6 /* RCTAppState.m in Sources */ = {isa = PBXBuildFile; fileRef = 1372B7091AB030C200659ED6 /* RCTAppState.m */; }; 137327E71AA5CF210034F82E /* RCTTabBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 137327E01AA5CF210034F82E /* RCTTabBar.m */; }; @@ -133,53 +123,24 @@ 13E067571A70F44B002CDEE1 /* RCTView.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E067501A70F44B002CDEE1 /* RCTView.m */; }; 13E067591A70F44B002CDEE1 /* UIView+React.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E067541A70F44B002CDEE1 /* UIView+React.m */; }; 13E41EEB1C05CA0B00CD8DAC /* RCTProfileTrampoline-i386.S in Sources */ = {isa = PBXBuildFile; fileRef = 14BF717F1C04793D00C97D0C /* RCTProfileTrampoline-i386.S */; }; - 13EBC6711E2870DE00880AC5 /* JSCWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D7A27DD1DE32541002E3F95 /* JSCWrapper.cpp */; }; - 13EBC6731E2870DE00880AC5 /* Value.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B10C1E0369AD0018521A /* Value.cpp */; }; - 13EBC6771E2870E400880AC5 /* JSCHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B1071E0369AD0018521A /* JSCHelpers.cpp */; }; - 13EBC6781E2870E400880AC5 /* JSCWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D7A27DD1DE32541002E3F95 /* JSCWrapper.cpp */; }; - 13EBC6791E2870E400880AC5 /* Unicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B10A1E0369AD0018521A /* Unicode.cpp */; }; - 13EBC67A1E2870E400880AC5 /* Value.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B10C1E0369AD0018521A /* Value.cpp */; }; - 13EBC67B1E28723000880AC5 /* Unicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B10A1E0369AD0018521A /* Unicode.cpp */; }; - 13EBC67D1E28725900880AC5 /* JSCHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B1071E0369AD0018521A /* JSCHelpers.cpp */; }; - 13EBC67E1E28726000880AC5 /* JSCHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B1081E0369AD0018521A /* JSCHelpers.h */; }; - 13EBC6801E28733C00880AC5 /* noncopyable.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B1091E0369AD0018521A /* noncopyable.h */; }; - 13EBC6811E28733C00880AC5 /* Unicode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B10B1E0369AD0018521A /* Unicode.h */; }; - 13EBC6821E28733C00880AC5 /* Value.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B10D1E0369AD0018521A /* Value.h */; }; 13F17A851B8493E5007D4C75 /* RCTRedBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 13F17A841B8493E5007D4C75 /* RCTRedBox.m */; }; - 13F880381E296D2800C3C7A1 /* JSCWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7A27DE1DE32541002E3F95 /* JSCWrapper.h */; }; 13F887581E2971D400C3C7A1 /* Demangle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887521E2971C500C3C7A1 /* Demangle.cpp */; }; 13F887591E2971D400C3C7A1 /* StringBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887531E2971C500C3C7A1 /* StringBase.cpp */; }; 13F8875A1E2971D400C3C7A1 /* Unicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887541E2971C500C3C7A1 /* Unicode.cpp */; }; 13F8876E1E29726200C3C7A1 /* CxxNativeModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */; }; 13F887701E29726200C3C7A1 /* Instance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0AE1E03699D0018521A /* Instance.cpp */; }; 13F887711E29726200C3C7A1 /* JSBundleType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AC70D2EB1DE48A22002E6351 /* JSBundleType.cpp */; }; - 13F887721E29726200C3C7A1 /* JSCExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0B21E03699D0018521A /* JSCExecutor.cpp */; }; - 13F887741E29726200C3C7A1 /* JSCLegacyTracing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0B61E03699D0018521A /* JSCLegacyTracing.cpp */; }; - 13F887751E29726200C3C7A1 /* JSCMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0B81E03699D0018521A /* JSCMemory.cpp */; }; - 13F887761E29726200C3C7A1 /* JSCNativeModules.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0BA1E03699D0018521A /* JSCNativeModules.cpp */; }; - 13F887771E29726200C3C7A1 /* JSCPerfStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0BC1E03699D0018521A /* JSCPerfStats.cpp */; }; - 13F887781E29726200C3C7A1 /* JSCSamplingProfiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0BE1E03699D0018521A /* JSCSamplingProfiler.cpp */; }; - 13F887791E29726200C3C7A1 /* JSCUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0C21E03699D0018521A /* JSCUtils.cpp */; }; 13F8877B1E29726200C3C7A1 /* JSIndexedRAMBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0C61E03699D0018521A /* JSIndexedRAMBundle.cpp */; }; 13F8877C1E29726200C3C7A1 /* MethodCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CA1E03699D0018521A /* MethodCall.cpp */; }; 13F8877D1E29726200C3C7A1 /* ModuleRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CC1E03699D0018521A /* ModuleRegistry.cpp */; }; 13F8877E1E29726200C3C7A1 /* NativeToJsBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CF1E03699D0018521A /* NativeToJsBridge.cpp */; }; - 13F8877F1E29726200C3C7A1 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0D11E03699D0018521A /* Platform.cpp */; }; 13F887801E29726200C3C7A1 /* SampleCxxModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0D31E03699D0018521A /* SampleCxxModule.cpp */; }; 13F887821E29726300C3C7A1 /* CxxNativeModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */; }; 13F887841E29726300C3C7A1 /* Instance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0AE1E03699D0018521A /* Instance.cpp */; }; - 13F887851E29726300C3C7A1 /* JSCExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0B21E03699D0018521A /* JSCExecutor.cpp */; }; - 13F887871E29726300C3C7A1 /* JSCLegacyTracing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0B61E03699D0018521A /* JSCLegacyTracing.cpp */; }; - 13F887881E29726300C3C7A1 /* JSCMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0B81E03699D0018521A /* JSCMemory.cpp */; }; - 13F887891E29726300C3C7A1 /* JSCNativeModules.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0BA1E03699D0018521A /* JSCNativeModules.cpp */; }; - 13F8878A1E29726300C3C7A1 /* JSCPerfStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0BC1E03699D0018521A /* JSCPerfStats.cpp */; }; - 13F8878B1E29726300C3C7A1 /* JSCSamplingProfiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0BE1E03699D0018521A /* JSCSamplingProfiler.cpp */; }; - 13F8878C1E29726300C3C7A1 /* JSCUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0C21E03699D0018521A /* JSCUtils.cpp */; }; 13F8878E1E29726300C3C7A1 /* JSIndexedRAMBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0C61E03699D0018521A /* JSIndexedRAMBundle.cpp */; }; 13F8878F1E29726300C3C7A1 /* MethodCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CA1E03699D0018521A /* MethodCall.cpp */; }; 13F887901E29726300C3C7A1 /* ModuleRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CC1E03699D0018521A /* ModuleRegistry.cpp */; }; 13F887911E29726300C3C7A1 /* NativeToJsBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0CF1E03699D0018521A /* NativeToJsBridge.cpp */; }; - 13F887921E29726300C3C7A1 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0D11E03699D0018521A /* Platform.cpp */; }; 13F887931E29726300C3C7A1 /* SampleCxxModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D92B0D31E03699D0018521A /* SampleCxxModule.cpp */; }; 13F8879F1E29741900C3C7A1 /* BitsFunctexcept.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F8879C1E29740700C3C7A1 /* BitsFunctexcept.cpp */; }; 13F887A21E2977FF00C3C7A1 /* MallocImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13F887A01E2977D800C3C7A1 /* MallocImpl.cpp */; }; @@ -209,30 +170,18 @@ 19F61C011E8495CD00571D81 /* ieee.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E471E25C5A300323FB7 /* ieee.h */; }; 19F61C021E8495CD00571D81 /* strtod.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E491E25C5A300323FB7 /* strtod.h */; }; 19F61C031E8495CD00571D81 /* utils.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 139D7E4A1E25C5A300323FB7 /* utils.h */; }; - 19F61C041E8495FF00571D81 /* JSCHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B1081E0369AD0018521A /* JSCHelpers.h */; }; - 19F61C051E8495FF00571D81 /* noncopyable.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B1091E0369AD0018521A /* noncopyable.h */; }; - 19F61C061E8495FF00571D81 /* Unicode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B10B1E0369AD0018521A /* Unicode.h */; }; - 19F61C071E8495FF00571D81 /* Value.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B10D1E0369AD0018521A /* Value.h */; }; 27595AA41E575C7800CCE2B1 /* CxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; }; 27595AA51E575C7800CCE2B1 /* CxxNativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A91E03699D0018521A /* CxxNativeModule.h */; }; 27595AA61E575C7800CCE2B1 /* JSExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* JSExecutor.h */; }; 27595AA91E575C7800CCE2B1 /* Instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AF1E03699D0018521A /* Instance.h */; }; 27595AAA1E575C7800CCE2B1 /* JsArgumentHelpers-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */; }; 27595AAB1E575C7800CCE2B1 /* JsArgumentHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; }; - 27595AAC1E575C7800CCE2B1 /* JSCExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B31E03699D0018521A /* JSCExecutor.h */; }; - 27595AAE1E575C7800CCE2B1 /* JSCLegacyTracing.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B71E03699D0018521A /* JSCLegacyTracing.h */; }; - 27595AAF1E575C7800CCE2B1 /* JSCMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B91E03699D0018521A /* JSCMemory.h */; }; - 27595AB01E575C7800CCE2B1 /* JSCNativeModules.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0BB1E03699D0018521A /* JSCNativeModules.h */; }; - 27595AB11E575C7800CCE2B1 /* JSCPerfStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0BD1E03699D0018521A /* JSCPerfStats.h */; }; - 27595AB21E575C7800CCE2B1 /* JSCSamplingProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0BF1E03699D0018521A /* JSCSamplingProfiler.h */; }; - 27595AB31E575C7800CCE2B1 /* JSCUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C31E03699D0018521A /* JSCUtils.h */; }; 27595AB51E575C7800CCE2B1 /* JSIndexedRAMBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */; }; 27595AB61E575C7800CCE2B1 /* MessageQueueThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C91E03699D0018521A /* MessageQueueThread.h */; }; 27595AB71E575C7800CCE2B1 /* MethodCall.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CB1E03699D0018521A /* MethodCall.h */; }; 27595AB81E575C7800CCE2B1 /* ModuleRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CD1E03699D0018521A /* ModuleRegistry.h */; }; 27595AB91E575C7800CCE2B1 /* NativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CE1E03699D0018521A /* NativeModule.h */; }; 27595ABA1E575C7800CCE2B1 /* NativeToJsBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D01E03699D0018521A /* NativeToJsBridge.h */; }; - 27595ABB1E575C7800CCE2B1 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D21E03699D0018521A /* Platform.h */; }; 27595ABC1E575C7800CCE2B1 /* SampleCxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D41E03699D0018521A /* SampleCxxModule.h */; }; 27595ABD1E575C7800CCE2B1 /* SystraceSection.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D51E03699D0018521A /* SystraceSection.h */; }; 27595ABF1E575C7800CCE2B1 /* CxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; }; @@ -241,25 +190,16 @@ 27595AC41E575C7800CCE2B1 /* Instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AF1E03699D0018521A /* Instance.h */; }; 27595AC51E575C7800CCE2B1 /* JsArgumentHelpers-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */; }; 27595AC61E575C7800CCE2B1 /* JsArgumentHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; }; - 27595AC71E575C7800CCE2B1 /* JSCExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B31E03699D0018521A /* JSCExecutor.h */; }; - 27595AC91E575C7800CCE2B1 /* JSCLegacyTracing.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B71E03699D0018521A /* JSCLegacyTracing.h */; }; - 27595ACA1E575C7800CCE2B1 /* JSCMemory.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B91E03699D0018521A /* JSCMemory.h */; }; - 27595ACB1E575C7800CCE2B1 /* JSCNativeModules.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0BB1E03699D0018521A /* JSCNativeModules.h */; }; - 27595ACC1E575C7800CCE2B1 /* JSCPerfStats.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0BD1E03699D0018521A /* JSCPerfStats.h */; }; - 27595ACD1E575C7800CCE2B1 /* JSCSamplingProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0BF1E03699D0018521A /* JSCSamplingProfiler.h */; }; - 27595ACE1E575C7800CCE2B1 /* JSCUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C31E03699D0018521A /* JSCUtils.h */; }; 27595AD01E575C7800CCE2B1 /* JSIndexedRAMBundle.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */; }; 27595AD11E575C7800CCE2B1 /* MessageQueueThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C91E03699D0018521A /* MessageQueueThread.h */; }; 27595AD21E575C7800CCE2B1 /* MethodCall.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CB1E03699D0018521A /* MethodCall.h */; }; 27595AD31E575C7800CCE2B1 /* ModuleRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CD1E03699D0018521A /* ModuleRegistry.h */; }; 27595AD41E575C7800CCE2B1 /* NativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CE1E03699D0018521A /* NativeModule.h */; }; 27595AD51E575C7800CCE2B1 /* NativeToJsBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D01E03699D0018521A /* NativeToJsBridge.h */; }; - 27595AD61E575C7800CCE2B1 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D21E03699D0018521A /* Platform.h */; }; 27595AD71E575C7800CCE2B1 /* SampleCxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D41E03699D0018521A /* SampleCxxModule.h */; }; 27595AD81E575C7800CCE2B1 /* SystraceSection.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D51E03699D0018521A /* SystraceSection.h */; }; 2D0EB9F32021067800CAF88A /* RCTUIUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = F1EFDA4E201F660F00EE6E4C /* RCTUIUtils.m */; }; 2D16E68E1FA4FD3900B85C8A /* RCTTVNavigationEventEmitter.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D0B842D1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.h */; }; - 2D1D83CD1F74E2CE00615550 /* libprivatedata-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9936F32F1F5F2E5B0010BF04 /* libprivatedata-tvOS.a */; }; 2D1D83CE1F74E2DA00615550 /* libdouble-conversion.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D383D621EBD27B9005632C8 /* libdouble-conversion.a */; }; 2D3B5E931D9B087300451313 /* RCTErrorInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */; }; 2D3B5E941D9B087900451313 /* RCTBundleURLProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 68EFE4ED1CF6EB3900A1DE13 /* RCTBundleURLProvider.m */; }; @@ -327,7 +267,6 @@ 2D8C2E331DA40441000EE098 /* RCTMultipartStreamReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 001BFCCF1D8381DE008E587E /* RCTMultipartStreamReader.m */; }; 2DD0EFE11DA84F2800B0C975 /* RCTStatusBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13723B4F1A82FD3C00F88898 /* RCTStatusBarManager.m */; }; 352DCFF01D19F4C20056D623 /* RCTI18nUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 352DCFEF1D19F4C20056D623 /* RCTI18nUtil.m */; }; - 369123E11DDC75850095B341 /* RCTJSCSamplingProfiler.m in Sources */ = {isa = PBXBuildFile; fileRef = 369123E01DDC75850095B341 /* RCTJSCSamplingProfiler.m */; }; 391E86A41C623EC800009732 /* RCTTouchEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 391E86A21C623EC800009732 /* RCTTouchEvent.m */; }; 39C50FF92046EACF00CEE534 /* RCTVersion.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 199B8A6E1F44DB16005DEF67 /* RCTVersion.h */; }; 39C50FFB2046EE3500CEE534 /* RCTVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = 39C50FFA2046EE3500CEE534 /* RCTVersion.m */; }; @@ -345,14 +284,10 @@ 3D0B842F1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D0B842D1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.h */; }; 3D0B84301EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D0B842E1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.m */; }; 3D0E378A1F1CC40000DCAC9F /* RCTWebSocketModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D0E37891F1CC40000DCAC9F /* RCTWebSocketModule.h */; }; - 3D0E378C1F1CC58C00DCAC9F /* RCTWebSocketObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D0E378B1F1CC58C00DCAC9F /* RCTWebSocketObserver.h */; }; - 3D0E378D1F1CC58F00DCAC9F /* RCTWebSocketObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D0E378B1F1CC58C00DCAC9F /* RCTWebSocketObserver.h */; }; 3D0E378E1F1CC59100DCAC9F /* RCTWebSocketModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D0E37891F1CC40000DCAC9F /* RCTWebSocketModule.h */; }; 3D0E378F1F1CC5CF00DCAC9F /* RCTWebSocketModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D0E37891F1CC40000DCAC9F /* RCTWebSocketModule.h */; }; 3D0E37901F1CC5E100DCAC9F /* RCTWebSocketModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D0E37891F1CC40000DCAC9F /* RCTWebSocketModule.h */; }; 3D1E68DB1CABD13900DD7465 /* RCTDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D1E68D91CABD13900DD7465 /* RCTDisplayLink.m */; }; - 3D302F1E1DF8265A00D6DDAE /* JavaScriptCore.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7A27DC1DE32541002E3F95 /* JavaScriptCore.h */; }; - 3D302F1F1DF8265A00D6DDAE /* JSCWrapper.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7A27DE1DE32541002E3F95 /* JSCWrapper.h */; }; 3D302F241DF828F800D6DDAE /* RCTImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0831DE4F3A000E03CC6 /* RCTImageLoader.h */; }; 3D302F251DF828F800D6DDAE /* RCTImageStoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0841DE4F3A000E03CC6 /* RCTImageStoreManager.h */; }; 3D302F261DF828F800D6DDAE /* RCTResizeMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D1FA0851DE4F3A000E03CC6 /* RCTResizeMode.h */; }; @@ -397,7 +332,6 @@ 3D302F4D1DF828F800D6DDAE /* RCTURLRequestDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1345A83A1B265A0E00583190 /* RCTURLRequestDelegate.h */; }; 3D302F4E1DF828F800D6DDAE /* RCTURLRequestHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; 3D302F4F1DF828F800D6DDAE /* RCTUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; - 3D302F541DF828F800D6DDAE /* RCTJSCSamplingProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 369123DF1DDC75850095B341 /* RCTJSCSamplingProfiler.h */; }; 3D302F551DF828F800D6DDAE /* RCTAccessibilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; 3D302F561DF828F800D6DDAE /* RCTAlertManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE71A69327A00A75B9A /* RCTAlertManager.h */; }; 3D302F571DF828F800D6DDAE /* RCTAppState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1372B7081AB030C200659ED6 /* RCTAppState.h */; }; @@ -453,8 +387,6 @@ 3D302F9D1DF828F800D6DDAE /* RCTWrapperViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B080231A694A8400A75B9A /* RCTWrapperViewController.h */; }; 3D302F9F1DF828F800D6DDAE /* UIView+React.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E067531A70F44B002CDEE1 /* UIView+React.h */; }; 3D3030221DF8294C00D6DDAE /* JSBundleType.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */; }; - 3D3030251DF8295E00D6DDAE /* JavaScriptCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7A27DC1DE32541002E3F95 /* JavaScriptCore.h */; }; - 3D3030261DF8295E00D6DDAE /* JSCWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7A27DE1DE32541002E3F95 /* JSCWrapper.h */; }; 3D37B5821D522B190042D5B5 /* RCTFont.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D37B5811D522B190042D5B5 /* RCTFont.mm */; }; 3D383D1F1EBD27A8005632C8 /* RCTBridge+Private.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14A43DB81C1F849600794BC8 /* RCTBridge+Private.h */; }; 3D383D201EBD27AF005632C8 /* RCTBridge+Private.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 14A43DB81C1F849600794BC8 /* RCTBridge+Private.h */; }; @@ -503,12 +435,8 @@ 3D383D5D1EBD27B9005632C8 /* strtod.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E491E25C5A300323FB7 /* strtod.h */; }; 3D383D5E1EBD27B9005632C8 /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D7E4A1E25C5A300323FB7 /* utils.h */; }; 3D383D6D1EBD2940005632C8 /* libdouble-conversion.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139D7E881E25C6D100323FB7 /* libdouble-conversion.a */; }; - 3D383D6E1EBD2940005632C8 /* libjschelpers.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D3CD90B1DE5FBD600167DC4 /* libjschelpers.a */; }; 3D383D6F1EBD2940005632C8 /* libthird-party.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139D7ECE1E25DB7D00323FB7 /* libthird-party.a */; }; - 3D383D711EBD2949005632C8 /* libjschelpers.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D3CD9181DE5FBD800167DC4 /* libjschelpers.a */; }; 3D383D721EBD2949005632C8 /* libthird-party.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D383D3C1EBD27B6005632C8 /* libthird-party.a */; }; - 3D3CD93D1DE5FC1400167DC4 /* JavaScriptCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7A27DC1DE32541002E3F95 /* JavaScriptCore.h */; }; - 3D3CD93E1DE5FC1400167DC4 /* JSCWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7A27DE1DE32541002E3F95 /* JSCWrapper.h */; }; 3D3CD9411DE5FC5300167DC4 /* libcxxreact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D3CD9251DE5FBEC00167DC4 /* libcxxreact.a */; }; 3D3CD9451DE5FC7100167DC4 /* JSBundleType.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */; }; 3D74547C1E54758900E74ADD /* JSBigString.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454781E54757500E74ADD /* JSBigString.h */; }; @@ -581,7 +509,6 @@ 3D80D9481DF6FA890028D040 /* RCTURLRequestDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1345A83A1B265A0E00583190 /* RCTURLRequestDelegate.h */; }; 3D80D9491DF6FA890028D040 /* RCTURLRequestHandler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; 3D80D94A1DF6FA890028D040 /* RCTUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; - 3D80D94F1DF6FA890028D040 /* RCTJSCSamplingProfiler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 369123DF1DDC75850095B341 /* RCTJSCSamplingProfiler.h */; }; 3D80D9501DF6FA890028D040 /* RCTAccessibilityManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; 3D80D9511DF6FA890028D040 /* RCTAlertManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE71A69327A00A75B9A /* RCTAlertManager.h */; }; 3D80D9521DF6FA890028D040 /* RCTAppState.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1372B7081AB030C200659ED6 /* RCTAppState.h */; }; @@ -684,7 +611,6 @@ 3D80DA421DF820620028D040 /* RCTURLRequestDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1345A83A1B265A0E00583190 /* RCTURLRequestDelegate.h */; }; 3D80DA431DF820620028D040 /* RCTURLRequestHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; 3D80DA441DF820620028D040 /* RCTUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; - 3D80DA491DF820620028D040 /* RCTJSCSamplingProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 369123DF1DDC75850095B341 /* RCTJSCSamplingProfiler.h */; }; 3D80DA4A1DF820620028D040 /* RCTAccessibilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; 3D80DA4B1DF820620028D040 /* RCTAlertManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE71A69327A00A75B9A /* RCTAlertManager.h */; }; 3D80DA4C1DF820620028D040 /* RCTAppState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1372B7081AB030C200659ED6 /* RCTAppState.h */; }; @@ -745,7 +671,6 @@ 3D80DA931DF820620028D040 /* UIView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F15A171B7CC46900F10295 /* UIView+Private.h */; }; 3D80DA941DF820620028D040 /* UIView+React.h in Headers */ = {isa = PBXBuildFile; fileRef = 13E067531A70F44B002CDEE1 /* UIView+React.h */; }; 3D8ED92C1E5B120100D83D20 /* libcxxreact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D3CD9321DE5FBEE00167DC4 /* libcxxreact.a */; }; - 3D8ED92D1E5B120100D83D20 /* libyoga.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D3C06751DE3340C00C268FA /* libyoga.a */; }; 3DA9819E1E5B0DBB004F2374 /* NSDataBigString.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454B31E54786200E74ADD /* NSDataBigString.h */; }; 3DA981A01E5B0E34004F2374 /* CxxModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; }; 3DA981A11E5B0E34004F2374 /* CxxNativeModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A91E03699D0018521A /* CxxNativeModule.h */; }; @@ -755,13 +680,6 @@ 3DA981A71E5B0E34004F2374 /* JsArgumentHelpers.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; }; 3DA981A81E5B0E34004F2374 /* JSBigString.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7454781E54757500E74ADD /* JSBigString.h */; }; 3DA981A91E5B0E34004F2374 /* JSBundleType.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */; }; - 3DA981AA1E5B0E34004F2374 /* JSCExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B31E03699D0018521A /* JSCExecutor.h */; }; - 3DA981AC1E5B0E34004F2374 /* JSCLegacyTracing.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B71E03699D0018521A /* JSCLegacyTracing.h */; }; - 3DA981AD1E5B0E34004F2374 /* JSCMemory.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B91E03699D0018521A /* JSCMemory.h */; }; - 3DA981AE1E5B0E34004F2374 /* JSCNativeModules.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0BB1E03699D0018521A /* JSCNativeModules.h */; }; - 3DA981AF1E5B0E34004F2374 /* JSCPerfStats.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0BD1E03699D0018521A /* JSCPerfStats.h */; }; - 3DA981B01E5B0E34004F2374 /* JSCSamplingProfiler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0BF1E03699D0018521A /* JSCSamplingProfiler.h */; }; - 3DA981B11E5B0E34004F2374 /* JSCUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C31E03699D0018521A /* JSCUtils.h */; }; 3DA981B31E5B0E34004F2374 /* JSIndexedRAMBundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */; }; 3DA981B41E5B0E34004F2374 /* JSModulesUnbundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */; }; 3DA981B51E5B0E34004F2374 /* MessageQueueThread.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C91E03699D0018521A /* MessageQueueThread.h */; }; @@ -769,7 +687,6 @@ 3DA981B71E5B0E34004F2374 /* ModuleRegistry.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CD1E03699D0018521A /* ModuleRegistry.h */; }; 3DA981B81E5B0E34004F2374 /* NativeModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CE1E03699D0018521A /* NativeModule.h */; }; 3DA981B91E5B0E34004F2374 /* NativeToJsBridge.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D01E03699D0018521A /* NativeToJsBridge.h */; }; - 3DA981BB1E5B0E34004F2374 /* Platform.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D21E03699D0018521A /* Platform.h */; }; 3DA981BC1E5B0E34004F2374 /* RecoverableError.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7454791E54757500E74ADD /* RecoverableError.h */; }; 3DA981BD1E5B0E34004F2374 /* SampleCxxModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D41E03699D0018521A /* SampleCxxModule.h */; }; 3DA981BE1E5B0E34004F2374 /* SystraceSection.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D51E03699D0018521A /* SystraceSection.h */; }; @@ -810,7 +727,6 @@ 3DA981E31E5B0F29004F2374 /* RCTURLRequestDelegate.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1345A83A1B265A0E00583190 /* RCTURLRequestDelegate.h */; }; 3DA981E41E5B0F29004F2374 /* RCTURLRequestHandler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1345A83B1B265A0E00583190 /* RCTURLRequestHandler.h */; }; 3DA981E51E5B0F29004F2374 /* RCTUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 83CBBA4F1A601E3B00E9B192 /* RCTUtils.h */; }; - 3DA981E91E5B0F7F004F2374 /* RCTJSCSamplingProfiler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 369123DF1DDC75850095B341 /* RCTJSCSamplingProfiler.h */; }; 3DA981EA1E5B0F7F004F2374 /* RCTAccessibilityManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */; }; 3DA981EB1E5B0F7F004F2374 /* RCTAlertManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13B07FE71A69327A00A75B9A /* RCTAlertManager.h */; }; 3DA981EC1E5B0F7F004F2374 /* RCTAppState.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 1372B7081AB030C200659ED6 /* RCTAppState.h */; }; @@ -879,13 +795,6 @@ 3DA982421E5B1053004F2374 /* JsArgumentHelpers.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; }; 3DA982431E5B1053004F2374 /* JSBigString.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7454781E54757500E74ADD /* JSBigString.h */; }; 3DA982441E5B1053004F2374 /* JSBundleType.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */; }; - 3DA982451E5B1053004F2374 /* JSCExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B31E03699D0018521A /* JSCExecutor.h */; }; - 3DA982471E5B1053004F2374 /* JSCLegacyTracing.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B71E03699D0018521A /* JSCLegacyTracing.h */; }; - 3DA982481E5B1053004F2374 /* JSCMemory.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B91E03699D0018521A /* JSCMemory.h */; }; - 3DA982491E5B1053004F2374 /* JSCNativeModules.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0BB1E03699D0018521A /* JSCNativeModules.h */; }; - 3DA9824A1E5B1053004F2374 /* JSCPerfStats.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0BD1E03699D0018521A /* JSCPerfStats.h */; }; - 3DA9824B1E5B1053004F2374 /* JSCSamplingProfiler.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0BF1E03699D0018521A /* JSCSamplingProfiler.h */; }; - 3DA9824C1E5B1053004F2374 /* JSCUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C31E03699D0018521A /* JSCUtils.h */; }; 3DA9824E1E5B1053004F2374 /* JSIndexedRAMBundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */; }; 3DA9824F1E5B1053004F2374 /* JSModulesUnbundle.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */; }; 3DA982501E5B1053004F2374 /* MessageQueueThread.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0C91E03699D0018521A /* MessageQueueThread.h */; }; @@ -893,20 +802,9 @@ 3DA982521E5B1053004F2374 /* ModuleRegistry.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CD1E03699D0018521A /* ModuleRegistry.h */; }; 3DA982531E5B1053004F2374 /* NativeModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0CE1E03699D0018521A /* NativeModule.h */; }; 3DA982541E5B1053004F2374 /* NativeToJsBridge.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D01E03699D0018521A /* NativeToJsBridge.h */; }; - 3DA982561E5B1053004F2374 /* Platform.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D21E03699D0018521A /* Platform.h */; }; 3DA982571E5B1053004F2374 /* RecoverableError.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7454791E54757500E74ADD /* RecoverableError.h */; }; 3DA982581E5B1053004F2374 /* SampleCxxModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D41E03699D0018521A /* SampleCxxModule.h */; }; 3DA982591E5B1053004F2374 /* SystraceSection.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D51E03699D0018521A /* SystraceSection.h */; }; - 3DA9825A1E5B1079004F2374 /* JavaScriptCore.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7A27DC1DE32541002E3F95 /* JavaScriptCore.h */; }; - 3DA9825B1E5B1079004F2374 /* JSCHelpers.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B1081E0369AD0018521A /* JSCHelpers.h */; }; - 3DA9825C1E5B1079004F2374 /* JSCWrapper.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D7A27DE1DE32541002E3F95 /* JSCWrapper.h */; }; - 3DA9825D1E5B1079004F2374 /* noncopyable.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B1091E0369AD0018521A /* noncopyable.h */; }; - 3DA9825E1E5B1079004F2374 /* Unicode.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B10B1E0369AD0018521A /* Unicode.h */; }; - 3DA9825F1E5B1079004F2374 /* Value.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B10D1E0369AD0018521A /* Value.h */; }; - 3DA982601E5B1089004F2374 /* JSCHelpers.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B1081E0369AD0018521A /* JSCHelpers.h */; }; - 3DA982611E5B1089004F2374 /* noncopyable.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B1091E0369AD0018521A /* noncopyable.h */; }; - 3DA982621E5B1089004F2374 /* Unicode.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B10B1E0369AD0018521A /* Unicode.h */; }; - 3DA982631E5B1089004F2374 /* Value.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B10D1E0369AD0018521A /* Value.h */; }; 3DC159E41E83E1AE007B1282 /* RCTRootContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59A7B9FC1E577DBF0068EDBF /* RCTRootContentView.m */; }; 3DC159E51E83E1E9007B1282 /* JSBigString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27B958731E57587D0096647A /* JSBigString.cpp */; }; 3DC159E61E83E1FA007B1282 /* JSBigString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27B958731E57587D0096647A /* JSBigString.cpp */; }; @@ -918,14 +816,9 @@ 3DCE53291FEAB23100613583 /* RCTDatePicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 133CAE8D1B8E5CFD00F6AD92 /* RCTDatePicker.m */; }; 3DCE532A1FEAB23100613583 /* RCTDatePickerManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 58C571C01AA56C1900CDF9C8 /* RCTDatePickerManager.h */; }; 3DCE532B1FEAB23100613583 /* RCTDatePickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 58C571BF1AA56C1900CDF9C8 /* RCTDatePickerManager.m */; }; - 3DDEC1521DDCE0CA0020BBDF /* RCTJSCSamplingProfiler.m in Sources */ = {isa = PBXBuildFile; fileRef = 369123E01DDC75850095B341 /* RCTJSCSamplingProfiler.m */; }; 3DE4F8681DF85D8E00B9E5A0 /* YGEnums.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130A77031DF767AF001F9587 /* YGEnums.h */; }; 3DE4F8691DF85D8E00B9E5A0 /* YGMacros.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130A77041DF767AF001F9587 /* YGMacros.h */; }; 3DE4F86A1DF85D8E00B9E5A0 /* Yoga.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130A77081DF767AF001F9587 /* Yoga.h */; }; - 3DF1BE821F26576400068F1A /* JSCTracing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3DF1BE801F26576400068F1A /* JSCTracing.cpp */; }; - 3DF1BE831F26576400068F1A /* JSCTracing.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DF1BE811F26576400068F1A /* JSCTracing.h */; }; - 3DF1BE841F26577000068F1A /* JSCTracing.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DF1BE811F26576400068F1A /* JSCTracing.h */; }; - 3DF1BE851F26577300068F1A /* JSCTracing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3DF1BE801F26576400068F1A /* JSCTracing.cpp */; }; 3DFE0D161DF8574D00459392 /* YGEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = 130A77031DF767AF001F9587 /* YGEnums.h */; }; 3DFE0D171DF8574D00459392 /* YGMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 130A77041DF767AF001F9587 /* YGMacros.h */; }; 3DFE0D191DF8574D00459392 /* Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 130A77081DF767AF001F9587 /* Yoga.h */; }; @@ -1033,8 +926,6 @@ 597633381F4E021D005BE8A4 /* RCTShadowView+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 597633351F4E021D005BE8A4 /* RCTShadowView+Internal.h */; }; 597633391F4E021D005BE8A4 /* RCTShadowView+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 597633351F4E021D005BE8A4 /* RCTShadowView+Internal.h */; }; 598FD1921F816A2A006C54CB /* RAMBundleRegistry.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = C6D380181F71D75B00621378 /* RAMBundleRegistry.h */; }; - 598FD1931F817284006C54CB /* PrivateDataBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9936F3351F5F2F480010BF04 /* PrivateDataBase.cpp */; }; - 598FD1941F8172A9006C54CB /* PrivateDataBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 9936F3361F5F2F480010BF04 /* PrivateDataBase.h */; }; 598FD1951F817335006C54CB /* RCTModalManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 91076A881F743AB00081B4FA /* RCTModalManager.h */; }; 598FD1961F817335006C54CB /* RCTModalManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 91076A871F743AB00081B4FA /* RCTModalManager.m */; }; 598FD1971F817336006C54CB /* RCTModalManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 91076A881F743AB00081B4FA /* RCTModalManager.h */; }; @@ -1099,7 +990,6 @@ 59EDBCA71FDF4E0C003573DE /* RCTScrollableProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EDBC9C1FDF4E0C003573DE /* RCTScrollableProtocol.h */; }; 59EDBCA81FDF4E0C003573DE /* RCTScrollableProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EDBC9C1FDF4E0C003573DE /* RCTScrollableProtocol.h */; }; 59EDBCA91FDF4E0C003573DE /* (null) in Headers */ = {isa = PBXBuildFile; }; - 59EDBCAA1FDF4E0C003573DE /* (null) in Headers */ = {isa = PBXBuildFile; }; 59EDBCAB1FDF4E0C003573DE /* (null) in Sources */ = {isa = PBXBuildFile; }; 59EDBCAC1FDF4E0C003573DE /* (null) in Sources */ = {isa = PBXBuildFile; }; 59EDBCAD1FDF4E0C003573DE /* RCTScrollContentView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EDBC9F1FDF4E0C003573DE /* RCTScrollContentView.h */; }; @@ -1107,7 +997,6 @@ 59EDBCAF1FDF4E0C003573DE /* RCTScrollContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EDBCA01FDF4E0C003573DE /* RCTScrollContentView.m */; }; 59EDBCB01FDF4E0C003573DE /* RCTScrollContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EDBCA01FDF4E0C003573DE /* RCTScrollContentView.m */; }; 59EDBCB11FDF4E0C003573DE /* (null) in Headers */ = {isa = PBXBuildFile; }; - 59EDBCB21FDF4E0C003573DE /* (null) in Headers */ = {isa = PBXBuildFile; }; 59EDBCB31FDF4E0C003573DE /* (null) in Sources */ = {isa = PBXBuildFile; }; 59EDBCB41FDF4E0C003573DE /* (null) in Sources */ = {isa = PBXBuildFile; }; 59EDBCB51FDF4E0C003573DE /* RCTScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EDBCA31FDF4E0C003573DE /* RCTScrollView.h */; }; @@ -1165,14 +1054,6 @@ 83CBBA981A6020BB00E9B192 /* RCTTouchHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBA971A6020BB00E9B192 /* RCTTouchHandler.m */; }; 83CBBACC1A6023D300E9B192 /* RCTConvert.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBACB1A6023D300E9B192 /* RCTConvert.m */; }; 916F9C2D1F743F57002E5920 /* RCTModalManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 91076A871F743AB00081B4FA /* RCTModalManager.m */; }; - 9936F3371F5F2F480010BF04 /* PrivateDataBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9936F3351F5F2F480010BF04 /* PrivateDataBase.cpp */; }; - 9936F3381F5F2F480010BF04 /* PrivateDataBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 9936F3361F5F2F480010BF04 /* PrivateDataBase.h */; }; - 9936F3391F5F2F5C0010BF04 /* PrivateDataBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 9936F3361F5F2F480010BF04 /* PrivateDataBase.h */; }; - 9936F33A1F5F2F7C0010BF04 /* PrivateDataBase.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 9936F3361F5F2F480010BF04 /* PrivateDataBase.h */; }; - 9936F33B1F5F2F9D0010BF04 /* PrivateDataBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9936F3351F5F2F480010BF04 /* PrivateDataBase.cpp */; }; - 9936F33C1F5F2FE70010BF04 /* PrivateDataBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 9936F3361F5F2F480010BF04 /* PrivateDataBase.h */; }; - 9936F33D1F5F2FF40010BF04 /* PrivateDataBase.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 9936F3361F5F2F480010BF04 /* PrivateDataBase.h */; }; - 9936F33E1F5F2FFC0010BF04 /* PrivateDataBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9936F3351F5F2F480010BF04 /* PrivateDataBase.cpp */; }; 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 */; }; @@ -1212,19 +1093,68 @@ EBF21BFE1FC499840052F4D5 /* InspectorInterfaces.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EBF21BBA1FC498270052F4D5 /* InspectorInterfaces.h */; }; EBF21BFF1FC4998E0052F4D5 /* InspectorInterfaces.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBF21BBB1FC498270052F4D5 /* InspectorInterfaces.cpp */; }; EBF21C001FC499A80052F4D5 /* InspectorInterfaces.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBF21BBB1FC498270052F4D5 /* InspectorInterfaces.cpp */; }; + ED296F82214C973700B7C4FE /* libjsinspector-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EBF21BFA1FC4989A0052F4D5 /* libjsinspector-tvOS.a */; }; + ED296F83214C974A00B7C4FE /* libyoga.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D3C06751DE3340C00C268FA /* libyoga.a */; }; + ED296FB7214C9A9A00B7C4FE /* JSIDynamic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC6DA214B3F6800DD5AC8 /* JSIDynamic.cpp */; }; + ED296FB8214C9A9A00B7C4FE /* jsi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC6DB214B3F6800DD5AC8 /* jsi.cpp */; }; + ED296FB9214C9AC200B7C4FE /* JSCRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC6DD214B3F6800DD5AC8 /* JSCRuntime.cpp */; }; + ED296FBC214C9B0400B7C4FE /* jsi-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6D9214B3F6800DD5AC8 /* jsi-inl.h */; }; + ED296FBF214C9B0400B7C4FE /* JSIDynamic.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DC214B3F6800DD5AC8 /* JSIDynamic.h */; }; + ED296FC1214C9B0400B7C4FE /* JSCRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DE214B3F6800DD5AC8 /* JSCRuntime.h */; }; + ED296FC3214C9B0400B7C4FE /* instrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E0214B3F6800DD5AC8 /* instrumentation.h */; }; + ED296FC4214C9B0400B7C4FE /* jsi.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E1214B3F6800DD5AC8 /* jsi.h */; }; + ED296FC5214C9B3E00B7C4FE /* jsi-inl.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6D9214B3F6800DD5AC8 /* jsi-inl.h */; }; + ED296FC6214C9B4400B7C4FE /* JSIDynamic.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DC214B3F6800DD5AC8 /* JSIDynamic.h */; }; + ED296FC7214C9B4B00B7C4FE /* instrumentation.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E0214B3F6800DD5AC8 /* instrumentation.h */; }; + ED296FC8214C9B5200B7C4FE /* jsi.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E1214B3F6800DD5AC8 /* jsi.h */; }; + ED296FCB214C9B6C00B7C4FE /* libjsi-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ED296FB6214C9A0900B7C4FE /* libjsi-tvOS.a */; }; + ED296FF3214C9D6C00B7C4FE /* JSINativeModules.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC73E214B463000DD5AC8 /* JSINativeModules.cpp */; }; + ED296FF4214C9D6C00B7C4FE /* JSIExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC73F214B463000DD5AC8 /* JSIExecutor.cpp */; }; + ED29703E2150126E00B7C4FE /* AtomicIntrusiveLinkedList.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D849C1E273B5600323FB7 /* AtomicIntrusiveLinkedList.h */; }; + ED2970402150126E00B7C4FE /* Bits.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D849E1E273B5600323FB7 /* Bits.h */; }; + ED2970422150126E00B7C4FE /* Conv.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84A01E273B5600323FB7 /* Conv.h */; }; + ED2970432150126E00B7C4FE /* dynamic-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84A11E273B5600323FB7 /* dynamic-inl.h */; }; + ED2970452150126E00B7C4FE /* dynamic.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84A31E273B5600323FB7 /* dynamic.h */; }; + ED2970462150126E00B7C4FE /* Exception.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84A41E273B5600323FB7 /* Exception.h */; }; + ED2970482150126E00B7C4FE /* json.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84A81E273B5600323FB7 /* json.h */; }; + ED2970492150126E00B7C4FE /* Memory.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84A91E273B5600323FB7 /* Memory.h */; }; + ED29704A2150126E00B7C4FE /* MoveWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84AA1E273B5600323FB7 /* MoveWrapper.h */; }; + ED29704B2150126E00B7C4FE /* Optional.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84AB1E273B5600323FB7 /* Optional.h */; }; + ED29704C2150126E00B7C4FE /* ScopeGuard.h in Headers */ = {isa = PBXBuildFile; fileRef = 139D84AC1E273B5600323FB7 /* ScopeGuard.h */; }; + ED29704F2150199F00B7C4FE /* JSCRuntime.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DE214B3F6800DD5AC8 /* JSCRuntime.h */; }; + ED297050215019B400B7C4FE /* instrumentation.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E0214B3F6800DD5AC8 /* instrumentation.h */; }; + ED297067215023D800B7C4FE /* libjsiexecutor-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ED296FEE214C9CF800B7C4FE /* libjsiexecutor-tvOS.a */; }; + ED6189692155BBF70000C9A7 /* JSIExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = ED6189672155BBF70000C9A7 /* JSIExecutor.h */; }; + ED61896A2155BBF70000C9A7 /* JSIExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = ED6189672155BBF70000C9A7 /* JSIExecutor.h */; }; + ED61896B2155BBF70000C9A7 /* JSINativeModules.h in Headers */ = {isa = PBXBuildFile; fileRef = ED6189682155BBF70000C9A7 /* JSINativeModules.h */; }; + ED61896C2155BBF70000C9A7 /* JSINativeModules.h in Headers */ = {isa = PBXBuildFile; fileRef = ED6189682155BBF70000C9A7 /* JSINativeModules.h */; }; + ED7286BC2155C62000C26ABF /* JSIExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = ED6189672155BBF70000C9A7 /* JSIExecutor.h */; }; + ED7286BD2155C62000C26ABF /* JSINativeModules.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = ED6189682155BBF70000C9A7 /* JSINativeModules.h */; }; + ED7286BE2155C62B00C26ABF /* JSIExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = ED6189672155BBF70000C9A7 /* JSIExecutor.h */; }; + ED7286BF2155C62B00C26ABF /* JSINativeModules.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = ED6189682155BBF70000C9A7 /* JSINativeModules.h */; }; + EDEBC6E2214B3F6800DD5AC8 /* jsi-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6D9214B3F6800DD5AC8 /* jsi-inl.h */; }; + EDEBC6E3214B3F6800DD5AC8 /* JSIDynamic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC6DA214B3F6800DD5AC8 /* JSIDynamic.cpp */; }; + EDEBC6E4214B3F6800DD5AC8 /* jsi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC6DB214B3F6800DD5AC8 /* jsi.cpp */; }; + EDEBC6E5214B3F6800DD5AC8 /* JSIDynamic.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DC214B3F6800DD5AC8 /* JSIDynamic.h */; }; + EDEBC6E6214B3F6800DD5AC8 /* JSCRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC6DD214B3F6800DD5AC8 /* JSCRuntime.cpp */; }; + EDEBC6E7214B3F6800DD5AC8 /* JSCRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DE214B3F6800DD5AC8 /* JSCRuntime.h */; }; + EDEBC6E8214B3F6800DD5AC8 /* instrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E0214B3F6800DD5AC8 /* instrumentation.h */; }; + EDEBC6E9214B3F6800DD5AC8 /* jsi.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E1214B3F6800DD5AC8 /* jsi.h */; }; + EDEBC71A214B40A300DD5AC8 /* libjsi.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EDEBC6D6214B3E7000DD5AC8 /* libjsi.a */; }; + EDEBC71C214B40F900DD5AC8 /* jsi-inl.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6D9214B3F6800DD5AC8 /* jsi-inl.h */; }; + EDEBC71D214B40F900DD5AC8 /* JSIDynamic.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DC214B3F6800DD5AC8 /* JSIDynamic.h */; }; + EDEBC71E214B40F900DD5AC8 /* JSCRuntime.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6DE214B3F6800DD5AC8 /* JSCRuntime.h */; }; + EDEBC71F214B40F900DD5AC8 /* jsi.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EDEBC6E1214B3F6800DD5AC8 /* jsi.h */; }; + EDEBC743214B463000DD5AC8 /* JSINativeModules.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC73E214B463000DD5AC8 /* JSINativeModules.cpp */; }; + EDEBC744214B463000DD5AC8 /* JSIExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EDEBC73F214B463000DD5AC8 /* JSIExecutor.cpp */; }; + EDEBC7DF214C705700DD5AC8 /* libjsiexecutor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EDEBC73B214B45A300DD5AC8 /* libjsiexecutor.a */; }; + EDEBC7E0214C709200DD5AC8 /* libjsinspector.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EBF21BDC1FC498900052F4D5 /* libjsinspector.a */; }; F1EFDA50201F661000EE6E4C /* RCTUIUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = F1EFDA4E201F660F00EE6E4C /* RCTUIUtils.m */; }; FEFAAC9E1FDB89B50057BBE0 /* RCTRedBoxExtraDataViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FEFAAC9C1FDB89B40057BBE0 /* RCTRedBoxExtraDataViewController.m */; }; FEFAAC9F1FDB89B50057BBE0 /* RCTRedBoxExtraDataViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = FEFAAC9D1FDB89B40057BBE0 /* RCTRedBoxExtraDataViewController.h */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 1320081A1E283DC300F0C457 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 139D7ECD1E25DB7D00323FB7; - remoteInfo = "third-party"; - }; 1320081C1E283DCB00F0C457 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; @@ -1246,13 +1176,6 @@ remoteGlobalIDString = 3D3CD9261DE5FBEE00167DC4; remoteInfo = "cxxreact-tvOS"; }; - 3D383D631EBD27CE005632C8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3D383D211EBD27B6005632C8; - remoteInfo = "third-party-tvOS"; - }; 3D383D651EBD27DB005632C8 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; @@ -1267,68 +1190,124 @@ remoteGlobalIDString = 3D3CD9191DE5FBEC00167DC4; remoteInfo = cxxreact; }; - 3D3CD94F1DE5FDB900167DC4 /* PBXContainerItemProxy */ = { + 53D123981FBF1E0C001B8A10 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; proxyType = 1; - remoteGlobalIDString = 3D3CD8FF1DE5FBD600167DC4; - remoteInfo = jschelpers; + remoteGlobalIDString = 3D3C04B91DE3340900C268FA; + remoteInfo = yoga; }; - 3DC159E71E83E2A0007B1282 /* PBXContainerItemProxy */ = { + ED296F7D214C957300B7C4FE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; proxyType = 1; - remoteGlobalIDString = 3D3CD90C1DE5FBD800167DC4; - remoteInfo = "jschelpers-tvOS"; + remoteGlobalIDString = EDEBC6BA214B3E7000DD5AC8; + remoteInfo = jsi; }; - 53D123981FBF1E0C001B8A10 /* PBXContainerItemProxy */ = { + ED296F80214C971800B7C4FE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; proxyType = 1; - remoteGlobalIDString = 3D3C04B91DE3340900C268FA; - remoteInfo = yoga; + remoteGlobalIDString = EBF21BDD1FC4989A0052F4D5; + remoteInfo = "jsinspector-tvOS"; }; - 9936F33F1F5F305D0010BF04 /* PBXContainerItemProxy */ = { + ED296F96214C996500B7C4FE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; proxyType = 1; - remoteGlobalIDString = 9936F2F81F5F2E4B0010BF04; - remoteInfo = privatedata; + remoteGlobalIDString = 3D383D3D1EBD27B9005632C8; + remoteInfo = "double-conversion-tvOS"; }; - 9936F3411F5F30640010BF04 /* PBXContainerItemProxy */ = { + ED296FC9214C9B6200B7C4FE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; proxyType = 1; - remoteGlobalIDString = 9936F3141F5F2E5B0010BF04; - remoteInfo = "privatedata-tvOS"; + remoteGlobalIDString = ED296F98214C9A0900B7C4FE; + remoteInfo = "jsi-tvOS"; }; - 9936F3431F5F30780010BF04 /* PBXContainerItemProxy */ = { + ED296FF7214C9EAA00B7C4FE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; proxyType = 1; - remoteGlobalIDString = 9936F2F81F5F2E4B0010BF04; - remoteInfo = privatedata; + remoteGlobalIDString = 3D383D211EBD27B6005632C8; + remoteInfo = "third-party-tvOS"; }; - 9936F3451F5F30830010BF04 /* PBXContainerItemProxy */ = { + ED296FFB214C9EC000B7C4FE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; proxyType = 1; - remoteGlobalIDString = 9936F3141F5F2E5B0010BF04; - remoteInfo = "privatedata-tvOS"; + remoteGlobalIDString = 3D3CD9261DE5FBEE00167DC4; + remoteInfo = "cxxreact-tvOS"; }; - EBF21C011FC499D10052F4D5 /* PBXContainerItemProxy */ = { + ED296FFD214C9EC600B7C4FE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; proxyType = 1; - remoteGlobalIDString = EBF21BBF1FC498900052F4D5; - remoteInfo = jsinspector; + remoteGlobalIDString = ED296F98214C9A0900B7C4FE; + remoteInfo = "jsi-tvOS"; }; - EBF21C031FC499D80052F4D5 /* PBXContainerItemProxy */ = { + ED29704D215012C700B7C4FE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; proxyType = 1; - remoteGlobalIDString = EBF21BDD1FC4989A0052F4D5; - remoteInfo = "jsinspector-tvOS"; + remoteGlobalIDString = 3D383D3D1EBD27B9005632C8; + remoteInfo = "double-conversion-tvOS"; + }; + ED2970652150237300B7C4FE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = ED296FD0214C9CF800B7C4FE; + remoteInfo = "jsiexecutor-tvOS"; + }; + EDEBC74A214B46A700DD5AC8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = EDEBC724214B45A300DD5AC8; + remoteInfo = jsiexecutor; + }; + EDEBC74E214B477400DD5AC8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = EDEBC6BA214B3E7000DD5AC8; + remoteInfo = jsi; + }; + EDEBC7CB214C516800DD5AC8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 139D7E871E25C6D100323FB7; + remoteInfo = "double-conversion"; + }; + EDEBC7CD214C523F00DD5AC8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3D3CD9191DE5FBEC00167DC4; + remoteInfo = cxxreact; + }; + EDEBC7D2214C528C00DD5AC8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 139D7ECD1E25DB7D00323FB7; + remoteInfo = "third-party"; + }; + EDEBC7D6214C52FD00DD5AC8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 139D7E871E25C6D100323FB7; + remoteInfo = "double-conversion"; + }; + EDEBC7D8214C628300DD5AC8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; + proxyType = 1; + remoteGlobalIDString = EBF21BBF1FC498900052F4D5; + remoteInfo = jsinspector; }; /* End PBXContainerItemProxy section */ @@ -1390,7 +1369,6 @@ 3D383D201EBD27AF005632C8 /* RCTBridge+Private.h in Copy Headers */, 3D7BFD351EA8E43F008DFB7A /* RCTDevSettings.h in Copy Headers */, 3D7BFD331EA8E433008DFB7A /* RCTPackagerClient.h in Copy Headers */, - 3DA981E91E5B0F7F004F2374 /* RCTJSCSamplingProfiler.h in Copy Headers */, 3DA981EA1E5B0F7F004F2374 /* RCTAccessibilityManager.h in Copy Headers */, 3DA981EB1E5B0F7F004F2374 /* RCTAlertManager.h in Copy Headers */, 3DA981EC1E5B0F7F004F2374 /* RCTAppState.h in Copy Headers */, @@ -1521,13 +1499,6 @@ 3DA982421E5B1053004F2374 /* JsArgumentHelpers.h in Copy Headers */, 3DA982431E5B1053004F2374 /* JSBigString.h in Copy Headers */, 3DA982441E5B1053004F2374 /* JSBundleType.h in Copy Headers */, - 3DA982451E5B1053004F2374 /* JSCExecutor.h in Copy Headers */, - 3DA982471E5B1053004F2374 /* JSCLegacyTracing.h in Copy Headers */, - 3DA982481E5B1053004F2374 /* JSCMemory.h in Copy Headers */, - 3DA982491E5B1053004F2374 /* JSCNativeModules.h in Copy Headers */, - 3DA9824A1E5B1053004F2374 /* JSCPerfStats.h in Copy Headers */, - 3DA9824B1E5B1053004F2374 /* JSCSamplingProfiler.h in Copy Headers */, - 3DA9824C1E5B1053004F2374 /* JSCUtils.h in Copy Headers */, 3DA9824E1E5B1053004F2374 /* JSIndexedRAMBundle.h in Copy Headers */, 3DA9824F1E5B1053004F2374 /* JSModulesUnbundle.h in Copy Headers */, 3DA982501E5B1053004F2374 /* MessageQueueThread.h in Copy Headers */, @@ -1535,7 +1506,6 @@ 3DA982521E5B1053004F2374 /* ModuleRegistry.h in Copy Headers */, 3DA982531E5B1053004F2374 /* NativeModule.h in Copy Headers */, 3DA982541E5B1053004F2374 /* NativeToJsBridge.h in Copy Headers */, - 3DA982561E5B1053004F2374 /* Platform.h in Copy Headers */, 3DA982571E5B1053004F2374 /* RecoverableError.h in Copy Headers */, 3DA982581E5B1053004F2374 /* SampleCxxModule.h in Copy Headers */, 3DA982591E5B1053004F2374 /* SystraceSection.h in Copy Headers */, @@ -1543,22 +1513,6 @@ name = "Copy Headers"; runOnlyForDeploymentPostprocessing = 0; }; - 3D302F1D1DF8264A00D6DDAE /* Copy Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/jschelpers; - dstSubfolderSpec = 16; - files = ( - 3DA982601E5B1089004F2374 /* JSCHelpers.h in Copy Headers */, - 3DA982611E5B1089004F2374 /* noncopyable.h in Copy Headers */, - 3DA982621E5B1089004F2374 /* Unicode.h in Copy Headers */, - 3DA982631E5B1089004F2374 /* Value.h in Copy Headers */, - 3D302F1E1DF8265A00D6DDAE /* JavaScriptCore.h in Copy Headers */, - 3D302F1F1DF8265A00D6DDAE /* JSCWrapper.h in Copy Headers */, - ); - name = "Copy Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; 3D383D491EBD27B9005632C8 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -1652,7 +1606,6 @@ 3D80D9481DF6FA890028D040 /* RCTURLRequestDelegate.h in Copy Headers */, 3D80D9491DF6FA890028D040 /* RCTURLRequestHandler.h in Copy Headers */, 3D80D94A1DF6FA890028D040 /* RCTUtils.h in Copy Headers */, - 3D80D94F1DF6FA890028D040 /* RCTJSCSamplingProfiler.h in Copy Headers */, 3D80D9501DF6FA890028D040 /* RCTAccessibilityManager.h in Copy Headers */, 3D80D9511DF6FA890028D040 /* RCTAlertManager.h in Copy Headers */, 3D80D9521DF6FA890028D040 /* RCTAppState.h in Copy Headers */, @@ -1744,13 +1697,6 @@ 3DA981A71E5B0E34004F2374 /* JsArgumentHelpers.h in Copy Headers */, 3DA981A81E5B0E34004F2374 /* JSBigString.h in Copy Headers */, 3DA981A91E5B0E34004F2374 /* JSBundleType.h in Copy Headers */, - 3DA981AA1E5B0E34004F2374 /* JSCExecutor.h in Copy Headers */, - 3DA981AC1E5B0E34004F2374 /* JSCLegacyTracing.h in Copy Headers */, - 3DA981AD1E5B0E34004F2374 /* JSCMemory.h in Copy Headers */, - 3DA981AE1E5B0E34004F2374 /* JSCNativeModules.h in Copy Headers */, - 3DA981AF1E5B0E34004F2374 /* JSCPerfStats.h in Copy Headers */, - 3DA981B01E5B0E34004F2374 /* JSCSamplingProfiler.h in Copy Headers */, - 3DA981B11E5B0E34004F2374 /* JSCUtils.h in Copy Headers */, 3DA981B31E5B0E34004F2374 /* JSIndexedRAMBundle.h in Copy Headers */, 3DA981B41E5B0E34004F2374 /* JSModulesUnbundle.h in Copy Headers */, 3DA981B51E5B0E34004F2374 /* MessageQueueThread.h in Copy Headers */, @@ -1758,7 +1704,6 @@ 3DA981B71E5B0E34004F2374 /* ModuleRegistry.h in Copy Headers */, 3DA981B81E5B0E34004F2374 /* NativeModule.h in Copy Headers */, 3DA981B91E5B0E34004F2374 /* NativeToJsBridge.h in Copy Headers */, - 3DA981BB1E5B0E34004F2374 /* Platform.h in Copy Headers */, 3DA981BC1E5B0E34004F2374 /* RecoverableError.h in Copy Headers */, 3DA981BD1E5B0E34004F2374 /* SampleCxxModule.h in Copy Headers */, 3DA981BE1E5B0E34004F2374 /* SystraceSection.h in Copy Headers */, @@ -1766,62 +1711,78 @@ name = "Copy Headers"; runOnlyForDeploymentPostprocessing = 0; }; - 3D80DABB1DF8218B0028D040 /* Copy Headers */ = { + EBF21BCB1FC498900052F4D5 /* Copy Headers */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; - dstPath = include/jschelpers; + dstPath = include/jsinspector; dstSubfolderSpec = 16; files = ( - 3DA9825A1E5B1079004F2374 /* JavaScriptCore.h in Copy Headers */, - 3DA9825B1E5B1079004F2374 /* JSCHelpers.h in Copy Headers */, - 3DA9825C1E5B1079004F2374 /* JSCWrapper.h in Copy Headers */, - 3DA9825D1E5B1079004F2374 /* noncopyable.h in Copy Headers */, - 3DA9825E1E5B1079004F2374 /* Unicode.h in Copy Headers */, - 3DA9825F1E5B1079004F2374 /* Value.h in Copy Headers */, + EBF21BFB1FC498FC0052F4D5 /* InspectorInterfaces.h in Copy Headers */, ); name = "Copy Headers"; runOnlyForDeploymentPostprocessing = 0; }; - 9936F3021F5F2E4B0010BF04 /* Copy Headers */ = { + EBF21BE91FC4989A0052F4D5 /* Copy Headers */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; - dstPath = include/privatedata; + dstPath = include/jsinspector; dstSubfolderSpec = 16; files = ( - 9936F33D1F5F2FF40010BF04 /* PrivateDataBase.h in Copy Headers */, + EBF21BFE1FC499840052F4D5 /* InspectorInterfaces.h in Copy Headers */, ); name = "Copy Headers"; runOnlyForDeploymentPostprocessing = 0; }; - 9936F31E1F5F2E5B0010BF04 /* Copy Headers */ = { + ED296FA4214C9A0900B7C4FE /* Copy Headers */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; - dstPath = include/privatedata; + dstPath = include/jsi; dstSubfolderSpec = 16; files = ( - 9936F33A1F5F2F7C0010BF04 /* PrivateDataBase.h in Copy Headers */, + ED29704F2150199F00B7C4FE /* JSCRuntime.h in Copy Headers */, + ED296FC8214C9B5200B7C4FE /* jsi.h in Copy Headers */, + ED296FC7214C9B4B00B7C4FE /* instrumentation.h in Copy Headers */, + ED296FC6214C9B4400B7C4FE /* JSIDynamic.h in Copy Headers */, + ED296FC5214C9B3E00B7C4FE /* jsi-inl.h in Copy Headers */, ); name = "Copy Headers"; runOnlyForDeploymentPostprocessing = 0; }; - EBF21BCB1FC498900052F4D5 /* Copy Headers */ = { + ED296FDC214C9CF800B7C4FE /* Copy Headers */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; - dstPath = include/jsinspector; + dstPath = include/jsireact; dstSubfolderSpec = 16; files = ( - EBF21BFB1FC498FC0052F4D5 /* InspectorInterfaces.h in Copy Headers */, + ED7286BE2155C62B00C26ABF /* JSIExecutor.h in Copy Headers */, + ED7286BF2155C62B00C26ABF /* JSINativeModules.h in Copy Headers */, ); name = "Copy Headers"; runOnlyForDeploymentPostprocessing = 0; }; - EBF21BE91FC4989A0052F4D5 /* Copy Headers */ = { + EDEBC6C6214B3E7000DD5AC8 /* Copy Headers */ = { isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = include/jsinspector; + buildActionMask = 12; + dstPath = include/jsi; dstSubfolderSpec = 16; files = ( - EBF21BFE1FC499840052F4D5 /* InspectorInterfaces.h in Copy Headers */, + ED297050215019B400B7C4FE /* instrumentation.h in Copy Headers */, + EDEBC71C214B40F900DD5AC8 /* jsi-inl.h in Copy Headers */, + EDEBC71D214B40F900DD5AC8 /* JSIDynamic.h in Copy Headers */, + EDEBC71E214B40F900DD5AC8 /* JSCRuntime.h in Copy Headers */, + EDEBC71F214B40F900DD5AC8 /* jsi.h in Copy Headers */, + ); + name = "Copy Headers"; + runOnlyForDeploymentPostprocessing = 0; + }; + EDEBC72F214B45A300DD5AC8 /* Copy Headers */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 12; + dstPath = include/jsireact; + dstSubfolderSpec = 16; + files = ( + ED7286BC2155C62000C26ABF /* JSIExecutor.h in Copy Headers */, + ED7286BD2155C62000C26ABF /* JSINativeModules.h in Copy Headers */, ); name = "Copy Headers"; runOnlyForDeploymentPostprocessing = 0; @@ -1874,10 +1835,6 @@ 134D63C21F1FEC4B008872B5 /* RCTCxxBridgeDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTCxxBridgeDelegate.h; sourceTree = ""; }; 13513F3A1B1F43F400FCE529 /* RCTProgressViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTProgressViewManager.h; sourceTree = ""; }; 13513F3B1B1F43F400FCE529 /* RCTProgressViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTProgressViewManager.m; sourceTree = ""; }; - 135A9BF91E7B0EAE00587AEB /* RCTJSCErrorHandling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJSCErrorHandling.h; sourceTree = ""; }; - 135A9BFA1E7B0EAE00587AEB /* RCTJSCErrorHandling.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJSCErrorHandling.mm; sourceTree = ""; }; - 135A9BFD1E7B0EE600587AEB /* RCTJSCHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJSCHelpers.h; sourceTree = ""; }; - 135A9BFE1E7B0EE600587AEB /* RCTJSCHelpers.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJSCHelpers.mm; sourceTree = ""; }; 13723B4E1A82FD3C00F88898 /* RCTStatusBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTStatusBarManager.h; sourceTree = ""; }; 13723B4F1A82FD3C00F88898 /* RCTStatusBarManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTStatusBarManager.m; sourceTree = ""; }; 1372B7081AB030C200659ED6 /* RCTAppState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAppState.h; sourceTree = ""; }; @@ -2037,13 +1994,10 @@ 191E3EBF1C29DC3800C180A6 /* RCTRefreshControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTRefreshControl.h; sourceTree = ""; }; 191E3EC01C29DC3800C180A6 /* RCTRefreshControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRefreshControl.m; sourceTree = ""; }; 199B8A6E1F44DB16005DEF67 /* RCTVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTVersion.h; sourceTree = ""; }; - 19DED2281E77E29200F089BB /* systemJSCWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = systemJSCWrapper.cpp; sourceTree = ""; }; 27B958731E57587D0096647A /* JSBigString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBigString.cpp; sourceTree = ""; }; 2D2A28131D9B038B00D4039D /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; }; 352DCFEE1D19F4C20056D623 /* RCTI18nUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTI18nUtil.h; sourceTree = ""; }; 352DCFEF1D19F4C20056D623 /* RCTI18nUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTI18nUtil.m; sourceTree = ""; }; - 369123DF1DDC75850095B341 /* RCTJSCSamplingProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJSCSamplingProfiler.h; sourceTree = ""; }; - 369123E01DDC75850095B341 /* RCTJSCSamplingProfiler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJSCSamplingProfiler.m; sourceTree = ""; }; 391E86A21C623EC800009732 /* RCTTouchEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTouchEvent.m; sourceTree = ""; }; 391E86A31C623EC800009732 /* RCTTouchEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTouchEvent.h; sourceTree = ""; }; 39C50FFA2046EE3500CEE534 /* RCTVersion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTVersion.m; sourceTree = ""; }; @@ -2052,7 +2006,6 @@ 3D0B842D1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTVNavigationEventEmitter.h; sourceTree = ""; }; 3D0B842E1EC0B51200B2BD8E /* RCTTVNavigationEventEmitter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTVNavigationEventEmitter.m; sourceTree = ""; }; 3D0E37891F1CC40000DCAC9F /* RCTWebSocketModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTWebSocketModule.h; path = WebSocket/RCTWebSocketModule.h; sourceTree = ""; }; - 3D0E378B1F1CC58C00DCAC9F /* RCTWebSocketObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTWebSocketObserver.h; path = WebSocket/RCTWebSocketObserver.h; sourceTree = ""; }; 3D1E68D81CABD13900DD7465 /* RCTDisplayLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDisplayLink.h; sourceTree = ""; }; 3D1E68D91CABD13900DD7465 /* RCTDisplayLink.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDisplayLink.m; sourceTree = ""; }; 3D1FA07A1DE4F2EA00E03CC6 /* RCTNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTNetworking.h; sourceTree = ""; }; @@ -2069,8 +2022,6 @@ 3D3C059A1DE3340900C268FA /* libyoga.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libyoga.a; sourceTree = BUILT_PRODUCTS_DIR; }; 3D3C06751DE3340C00C268FA /* libyoga.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libyoga.a; sourceTree = BUILT_PRODUCTS_DIR; }; 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBundleType.h; sourceTree = ""; }; - 3D3CD90B1DE5FBD600167DC4 /* libjschelpers.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libjschelpers.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 3D3CD9181DE5FBD800167DC4 /* libjschelpers.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libjschelpers.a; sourceTree = BUILT_PRODUCTS_DIR; }; 3D3CD9251DE5FBEC00167DC4 /* libcxxreact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcxxreact.a; sourceTree = BUILT_PRODUCTS_DIR; }; 3D3CD9321DE5FBEE00167DC4 /* libcxxreact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcxxreact.a; sourceTree = BUILT_PRODUCTS_DIR; }; 3D7454781E54757500E74ADD /* JSBigString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBigString.h; sourceTree = ""; }; @@ -2079,9 +2030,6 @@ 3D7749421DC1065C007EC8D8 /* RCTPlatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPlatform.h; sourceTree = ""; }; 3D7749431DC1065C007EC8D8 /* RCTPlatform.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPlatform.m; sourceTree = ""; }; 3D788F841EBD2D240063D616 /* third-party.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "third-party.xcconfig"; sourceTree = ""; }; - 3D7A27DC1DE32541002E3F95 /* JavaScriptCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptCore.h; sourceTree = ""; }; - 3D7A27DD1DE32541002E3F95 /* JSCWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCWrapper.cpp; sourceTree = ""; }; - 3D7A27DE1DE32541002E3F95 /* JSCWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCWrapper.h; sourceTree = ""; }; 3D7AA9C31E548CD5001955CF /* NSDataBigString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NSDataBigString.mm; sourceTree = ""; }; 3D7BFD0B1EA8E351008DFB7A /* RCTPackagerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPackagerClient.h; sourceTree = ""; }; 3D7BFD0C1EA8E351008DFB7A /* RCTPackagerClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPackagerClient.m; sourceTree = ""; }; @@ -2097,20 +2045,6 @@ 3D92B0AF1E03699D0018521A /* Instance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Instance.h; sourceTree = ""; }; 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JsArgumentHelpers-inl.h"; sourceTree = ""; }; 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JsArgumentHelpers.h; sourceTree = ""; }; - 3D92B0B21E03699D0018521A /* JSCExecutor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCExecutor.cpp; sourceTree = ""; }; - 3D92B0B31E03699D0018521A /* JSCExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCExecutor.h; sourceTree = ""; }; - 3D92B0B61E03699D0018521A /* JSCLegacyTracing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCLegacyTracing.cpp; sourceTree = ""; }; - 3D92B0B71E03699D0018521A /* JSCLegacyTracing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCLegacyTracing.h; sourceTree = ""; }; - 3D92B0B81E03699D0018521A /* JSCMemory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCMemory.cpp; sourceTree = ""; }; - 3D92B0B91E03699D0018521A /* JSCMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCMemory.h; sourceTree = ""; }; - 3D92B0BA1E03699D0018521A /* JSCNativeModules.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCNativeModules.cpp; sourceTree = ""; }; - 3D92B0BB1E03699D0018521A /* JSCNativeModules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCNativeModules.h; sourceTree = ""; }; - 3D92B0BC1E03699D0018521A /* JSCPerfStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCPerfStats.cpp; sourceTree = ""; }; - 3D92B0BD1E03699D0018521A /* JSCPerfStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCPerfStats.h; sourceTree = ""; }; - 3D92B0BE1E03699D0018521A /* JSCSamplingProfiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSamplingProfiler.cpp; sourceTree = ""; }; - 3D92B0BF1E03699D0018521A /* JSCSamplingProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSamplingProfiler.h; sourceTree = ""; }; - 3D92B0C21E03699D0018521A /* JSCUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCUtils.cpp; sourceTree = ""; }; - 3D92B0C31E03699D0018521A /* JSCUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCUtils.h; sourceTree = ""; }; 3D92B0C61E03699D0018521A /* JSIndexedRAMBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIndexedRAMBundle.cpp; sourceTree = ""; }; 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIndexedRAMBundle.h; sourceTree = ""; }; 3D92B0C81E03699D0018521A /* JSModulesUnbundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSModulesUnbundle.h; sourceTree = ""; }; @@ -2122,20 +2056,9 @@ 3D92B0CE1E03699D0018521A /* NativeModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeModule.h; sourceTree = ""; }; 3D92B0CF1E03699D0018521A /* NativeToJsBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NativeToJsBridge.cpp; sourceTree = ""; }; 3D92B0D01E03699D0018521A /* NativeToJsBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeToJsBridge.h; sourceTree = ""; }; - 3D92B0D11E03699D0018521A /* Platform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Platform.cpp; sourceTree = ""; }; - 3D92B0D21E03699D0018521A /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = ""; }; 3D92B0D31E03699D0018521A /* SampleCxxModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SampleCxxModule.cpp; sourceTree = ""; }; 3D92B0D41E03699D0018521A /* SampleCxxModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SampleCxxModule.h; sourceTree = ""; }; 3D92B0D51E03699D0018521A /* SystraceSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystraceSection.h; sourceTree = ""; }; - 3D92B1071E0369AD0018521A /* JSCHelpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCHelpers.cpp; sourceTree = ""; }; - 3D92B1081E0369AD0018521A /* JSCHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCHelpers.h; sourceTree = ""; }; - 3D92B1091E0369AD0018521A /* noncopyable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = noncopyable.h; sourceTree = ""; }; - 3D92B10A1E0369AD0018521A /* Unicode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Unicode.cpp; sourceTree = ""; }; - 3D92B10B1E0369AD0018521A /* Unicode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Unicode.h; sourceTree = ""; }; - 3D92B10C1E0369AD0018521A /* Value.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Value.cpp; sourceTree = ""; }; - 3D92B10D1E0369AD0018521A /* Value.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Value.h; sourceTree = ""; }; - 3DF1BE801F26576400068F1A /* JSCTracing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCTracing.cpp; sourceTree = ""; }; - 3DF1BE811F26576400068F1A /* JSCTracing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCTracing.h; sourceTree = ""; }; 3EDCA8A21D3591E700450C31 /* RCTErrorCustomizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTErrorCustomizer.h; sourceTree = ""; }; 3EDCA8A31D3591E700450C31 /* RCTErrorInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTErrorInfo.h; sourceTree = ""; }; 3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTErrorInfo.m; sourceTree = ""; }; @@ -2264,10 +2187,6 @@ 83F15A171B7CC46900F10295 /* UIView+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+Private.h"; sourceTree = ""; }; 91076A871F743AB00081B4FA /* RCTModalManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTModalManager.m; sourceTree = ""; }; 91076A881F743AB00081B4FA /* RCTModalManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTModalManager.h; sourceTree = ""; }; - 9936F3131F5F2E4B0010BF04 /* libprivatedata.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libprivatedata.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 9936F32F1F5F2E5B0010BF04 /* libprivatedata-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libprivatedata-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 9936F3351F5F2F480010BF04 /* PrivateDataBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PrivateDataBase.cpp; path = privatedata/PrivateDataBase.cpp; sourceTree = ""; }; - 9936F3361F5F2F480010BF04 /* PrivateDataBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PrivateDataBase.h; path = privatedata/PrivateDataBase.h; sourceTree = ""; }; A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTReloadCommand.h; sourceTree = ""; }; A2440AA11DF8D854006E7BFC /* RCTReloadCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTReloadCommand.m; sourceTree = ""; }; AC70D2E81DE489E4002E6351 /* RCTJavaScriptLoader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJavaScriptLoader.mm; sourceTree = ""; }; @@ -2294,6 +2213,28 @@ EBF21BBB1FC498270052F4D5 /* InspectorInterfaces.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorInterfaces.cpp; sourceTree = ""; }; EBF21BDC1FC498900052F4D5 /* libjsinspector.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libjsinspector.a; sourceTree = BUILT_PRODUCTS_DIR; }; EBF21BFA1FC4989A0052F4D5 /* libjsinspector-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libjsinspector-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + ED296FB6214C9A0900B7C4FE /* libjsi-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libjsi-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + ED296FEE214C9CF800B7C4FE /* libjsiexecutor-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libjsiexecutor-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + ED6189672155BBF70000C9A7 /* JSIExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSIExecutor.h; path = jsireact/JSIExecutor.h; sourceTree = ""; }; + ED6189682155BBF70000C9A7 /* JSINativeModules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSINativeModules.h; path = jsireact/JSINativeModules.h; sourceTree = ""; }; + EDEBC6D6214B3E7000DD5AC8 /* libjsi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libjsi.a; sourceTree = BUILT_PRODUCTS_DIR; }; + EDEBC6D9214B3F6800DD5AC8 /* jsi-inl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "jsi-inl.h"; sourceTree = ""; }; + EDEBC6DA214B3F6800DD5AC8 /* JSIDynamic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDynamic.cpp; sourceTree = ""; }; + EDEBC6DB214B3F6800DD5AC8 /* jsi.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsi.cpp; sourceTree = ""; }; + EDEBC6DC214B3F6800DD5AC8 /* JSIDynamic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDynamic.h; sourceTree = ""; }; + EDEBC6DD214B3F6800DD5AC8 /* JSCRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCRuntime.cpp; sourceTree = ""; }; + EDEBC6DE214B3F6800DD5AC8 /* JSCRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCRuntime.h; sourceTree = ""; }; + EDEBC6DF214B3F6800DD5AC8 /* BUCK */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BUCK; sourceTree = ""; }; + EDEBC6E0214B3F6800DD5AC8 /* instrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = instrumentation.h; sourceTree = ""; }; + EDEBC6E1214B3F6800DD5AC8 /* jsi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsi.h; sourceTree = ""; }; + EDEBC73B214B45A300DD5AC8 /* libjsiexecutor.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libjsiexecutor.a; sourceTree = BUILT_PRODUCTS_DIR; }; + EDEBC73E214B463000DD5AC8 /* JSINativeModules.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSINativeModules.cpp; sourceTree = ""; }; + EDEBC73F214B463000DD5AC8 /* JSIExecutor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIExecutor.cpp; sourceTree = ""; }; + EDEBC740214B463000DD5AC8 /* BUCK */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BUCK; sourceTree = ""; }; + EDEBC750214B47E100DD5AC8 /* JSDeltaBundleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeltaBundleClient.cpp; sourceTree = ""; }; + EDEBC751214B47E100DD5AC8 /* JSDeltaBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDeltaBundleClient.h; sourceTree = ""; }; + EDEBC752214B47E100DD5AC8 /* SharedProxyCxxModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedProxyCxxModule.h; sourceTree = ""; }; + EDEBC757214C284000DD5AC8 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; F1EFDA4E201F660F00EE6E4C /* RCTUIUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIUtils.m; sourceTree = ""; }; F1EFDA4F201F660F00EE6E4C /* RCTUIUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUIUtils.h; sourceTree = ""; }; FEFAAC9C1FDB89B40057BBE0 /* RCTRedBoxExtraDataViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTRedBoxExtraDataViewController.m; sourceTree = ""; }; @@ -2305,11 +2246,13 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + EDEBC7E0214C709200DD5AC8 /* libjsinspector.a in Frameworks */, + 3D3CD9411DE5FC5300167DC4 /* libcxxreact.a in Frameworks */, + EDEBC71A214B40A300DD5AC8 /* libjsi.a in Frameworks */, + EDEBC7DF214C705700DD5AC8 /* libjsiexecutor.a in Frameworks */, 53D123971FBF1DF5001B8A10 /* libyoga.a in Frameworks */, 3D383D6D1EBD2940005632C8 /* libdouble-conversion.a in Frameworks */, - 3D383D6E1EBD2940005632C8 /* libjschelpers.a in Frameworks */, 3D383D6F1EBD2940005632C8 /* libthird-party.a in Frameworks */, - 3D3CD9411DE5FC5300167DC4 /* libcxxreact.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2317,12 +2260,41 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + ED297067215023D800B7C4FE /* libjsiexecutor-tvOS.a in Frameworks */, + ED296FCB214C9B6C00B7C4FE /* libjsi-tvOS.a in Frameworks */, + ED296F83214C974A00B7C4FE /* libyoga.a in Frameworks */, + ED296F82214C973700B7C4FE /* libjsinspector-tvOS.a in Frameworks */, 2D1D83CE1F74E2DA00615550 /* libdouble-conversion.a in Frameworks */, - 2D1D83CD1F74E2CE00615550 /* libprivatedata-tvOS.a in Frameworks */, - 3D383D711EBD2949005632C8 /* libjschelpers.a in Frameworks */, 3D383D721EBD2949005632C8 /* libthird-party.a in Frameworks */, 3D8ED92C1E5B120100D83D20 /* libcxxreact.a in Frameworks */, - 3D8ED92D1E5B120100D83D20 /* libyoga.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + ED296FCE214C9CB400B7C4FE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + ED296FF5214C9E7C00B7C4FE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + EDEBC756214C283300DD5AC8 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + EDEBC79A214C2A7000DD5AC8 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2373,8 +2345,6 @@ 3D7454B31E54786200E74ADD /* NSDataBigString.h */, 3D7AA9C31E548CD5001955CF /* NSDataBigString.mm */, 13134C741E296B2A00B9F3CB /* RCTCxxBridge.mm */, - 135A9BFD1E7B0EE600587AEB /* RCTJSCHelpers.h */, - 135A9BFE1E7B0EE600587AEB /* RCTJSCHelpers.mm */, 13134C771E296B2A00B9F3CB /* RCTMessageThread.h */, 13134C781E296B2A00B9F3CB /* RCTMessageThread.mm */, 13134C7B1E296B2A00B9F3CB /* RCTObjcExecutor.h */, @@ -2510,8 +2480,6 @@ B233E6E91D2D845D00BC68BA /* RCTI18nManager.m */, 352DCFEE1D19F4C20056D623 /* RCTI18nUtil.h */, 352DCFEF1D19F4C20056D623 /* RCTI18nUtil.m */, - 369123DF1DDC75850095B341 /* RCTJSCSamplingProfiler.h */, - 369123E01DDC75850095B341 /* RCTJSCSamplingProfiler.m */, 13D9FEEC1CDCD93000158BD7 /* RCTKeyboardObserver.h */, 13D9FEED1CDCD93000158BD7 /* RCTKeyboardObserver.m */, 5960C1B11F0804A00066FD5B /* RCTLayoutAnimation.h */, @@ -2664,10 +2632,10 @@ 3D10A3C71DDF3CED004A0F9D /* ReactCommon */ = { isa = PBXGroup; children = ( - 9936F3341F5F2F360010BF04 /* privatedata */, + EDEBC73C214B463000DD5AC8 /* jsiexecutor */, + EDEBC6D8214B3F6800DD5AC8 /* jsi */, 130A77021DF767AF001F9587 /* yoga */, AC70D2EA1DE489FC002E6351 /* cxxreact */, - 3D4A621D1DDD3985001F41B4 /* jschelpers */, EBF21BB91FC497DA0052F4D5 /* jsinspector */, ); name = ReactCommon; @@ -2722,24 +2690,6 @@ name = PushNotificationIOS; sourceTree = ""; }; - 3D4A621D1DDD3985001F41B4 /* jschelpers */ = { - isa = PBXGroup; - children = ( - 19DED2281E77E29200F089BB /* systemJSCWrapper.cpp */, - 3D7A27DC1DE32541002E3F95 /* JavaScriptCore.h */, - 3D92B1071E0369AD0018521A /* JSCHelpers.cpp */, - 3D92B1081E0369AD0018521A /* JSCHelpers.h */, - 3D7A27DD1DE32541002E3F95 /* JSCWrapper.cpp */, - 3D7A27DE1DE32541002E3F95 /* JSCWrapper.h */, - 3D92B1091E0369AD0018521A /* noncopyable.h */, - 3D92B10A1E0369AD0018521A /* Unicode.cpp */, - 3D92B10B1E0369AD0018521A /* Unicode.h */, - 3D92B10C1E0369AD0018521A /* Value.cpp */, - 3D92B10D1E0369AD0018521A /* Value.h */, - ); - path = jschelpers; - sourceTree = ""; - }; 3D7BFD0A1EA8E2D1008DFB7A /* DevSupport */ = { isa = PBXGroup; children = ( @@ -2760,7 +2710,6 @@ 3D7BFD2A1EA8E3D3008DFB7A /* WebSocket */ = { isa = PBXGroup; children = ( - 3D0E378B1F1CC58C00DCAC9F /* RCTWebSocketObserver.h */, 3D0E37891F1CC40000DCAC9F /* RCTWebSocketModule.h */, 3D7BFD2B1EA8E3FA008DFB7A /* RCTReconnectingWebSocket.h */, 3D7BFD2C1EA8E3FA008DFB7A /* RCTSRWebSocket.h */, @@ -2781,6 +2730,7 @@ 53D123821FBF1D49001B8A10 /* Frameworks */ = { isa = PBXGroup; children = ( + EDEBC757214C284000DD5AC8 /* JavaScriptCore.framework */, 53D123831FBF1D49001B8A10 /* libyoga.a */, ); name = Frameworks; @@ -2885,18 +2835,18 @@ 2D2A28131D9B038B00D4039D /* libReact.a */, 3D3C059A1DE3340900C268FA /* libyoga.a */, 3D3C06751DE3340C00C268FA /* libyoga.a */, - 3D3CD90B1DE5FBD600167DC4 /* libjschelpers.a */, - 3D3CD9181DE5FBD800167DC4 /* libjschelpers.a */, 3D3CD9251DE5FBEC00167DC4 /* libcxxreact.a */, 3D3CD9321DE5FBEE00167DC4 /* libcxxreact.a */, 139D7E881E25C6D100323FB7 /* libdouble-conversion.a */, 139D7ECE1E25DB7D00323FB7 /* libthird-party.a */, 3D383D3C1EBD27B6005632C8 /* libthird-party.a */, 3D383D621EBD27B9005632C8 /* libdouble-conversion.a */, - 9936F3131F5F2E4B0010BF04 /* libprivatedata.a */, - 9936F32F1F5F2E5B0010BF04 /* libprivatedata-tvOS.a */, EBF21BDC1FC498900052F4D5 /* libjsinspector.a */, EBF21BFA1FC4989A0052F4D5 /* libjsinspector-tvOS.a */, + EDEBC6D6214B3E7000DD5AC8 /* libjsi.a */, + EDEBC73B214B45A300DD5AC8 /* libjsiexecutor.a */, + ED296FB6214C9A0900B7C4FE /* libjsi-tvOS.a */, + ED296FEE214C9CF800B7C4FE /* libjsiexecutor-tvOS.a */, ); name = Products; sourceTree = ""; @@ -2951,8 +2901,6 @@ 83CBBA631A601ECA00E9B192 /* RCTJavaScriptExecutor.h */, 14200DA81AC179B3008EE6BA /* RCTJavaScriptLoader.h */, AC70D2E81DE489E4002E6351 /* RCTJavaScriptLoader.mm */, - 135A9BF91E7B0EAE00587AEB /* RCTJSCErrorHandling.h */, - 135A9BFA1E7B0EAE00587AEB /* RCTJSCErrorHandling.mm */, 008341F51D1DB34400876D9A /* RCTJSStackFrame.h */, 008341F41D1DB34400876D9A /* RCTJSStackFrame.m */, 13A1F71C1A75392D00D3D453 /* RCTKeyCommands.h */, @@ -3001,18 +2949,12 @@ path = Base; sourceTree = ""; }; - 9936F3341F5F2F360010BF04 /* privatedata */ = { - isa = PBXGroup; - children = ( - 9936F3351F5F2F480010BF04 /* PrivateDataBase.cpp */, - 9936F3361F5F2F480010BF04 /* PrivateDataBase.h */, - ); - name = privatedata; - sourceTree = ""; - }; AC70D2EA1DE489FC002E6351 /* cxxreact */ = { isa = PBXGroup; children = ( + EDEBC750214B47E100DD5AC8 /* JSDeltaBundleClient.cpp */, + EDEBC751214B47E100DD5AC8 /* JSDeltaBundleClient.h */, + EDEBC752214B47E100DD5AC8 /* SharedProxyCxxModule.h */, 13DA8A302097A90B00276ED4 /* ReactMarker.cpp */, 13DA8A2F2097A90A00276ED4 /* ReactMarker.h */, E223624320875A8000108244 /* JSExecutor.cpp */, @@ -3027,22 +2969,6 @@ 3D7454781E54757500E74ADD /* JSBigString.h */, AC70D2EB1DE48A22002E6351 /* JSBundleType.cpp */, 3D3CD8F51DE5FB2300167DC4 /* JSBundleType.h */, - 3D92B0B21E03699D0018521A /* JSCExecutor.cpp */, - 3D92B0B31E03699D0018521A /* JSCExecutor.h */, - 3D92B0B61E03699D0018521A /* JSCLegacyTracing.cpp */, - 3D92B0B71E03699D0018521A /* JSCLegacyTracing.h */, - 3D92B0B81E03699D0018521A /* JSCMemory.cpp */, - 3D92B0B91E03699D0018521A /* JSCMemory.h */, - 3D92B0BA1E03699D0018521A /* JSCNativeModules.cpp */, - 3D92B0BB1E03699D0018521A /* JSCNativeModules.h */, - 3D92B0BC1E03699D0018521A /* JSCPerfStats.cpp */, - 3D92B0BD1E03699D0018521A /* JSCPerfStats.h */, - 3D92B0BE1E03699D0018521A /* JSCSamplingProfiler.cpp */, - 3D92B0BF1E03699D0018521A /* JSCSamplingProfiler.h */, - 3DF1BE801F26576400068F1A /* JSCTracing.cpp */, - 3DF1BE811F26576400068F1A /* JSCTracing.h */, - 3D92B0C21E03699D0018521A /* JSCUtils.cpp */, - 3D92B0C31E03699D0018521A /* JSCUtils.h */, 3D92B0AB1E03699D0018521A /* JSExecutor.h */, 3D92B0C61E03699D0018521A /* JSIndexedRAMBundle.cpp */, 3D92B0C71E03699D0018521A /* JSIndexedRAMBundle.h */, @@ -3055,8 +2981,6 @@ 3D92B0CE1E03699D0018521A /* NativeModule.h */, 3D92B0CF1E03699D0018521A /* NativeToJsBridge.cpp */, 3D92B0D01E03699D0018521A /* NativeToJsBridge.h */, - 3D92B0D11E03699D0018521A /* Platform.cpp */, - 3D92B0D21E03699D0018521A /* Platform.h */, C6D380191F71D75B00621378 /* RAMBundleRegistry.cpp */, C6D380181F71D75B00621378 /* RAMBundleRegistry.h */, 3D7454791E54757500E74ADD /* RecoverableError.h */, @@ -3076,6 +3000,42 @@ path = jsinspector; sourceTree = ""; }; + ED6189662155BBDD0000C9A7 /* jsireact */ = { + isa = PBXGroup; + children = ( + ED6189672155BBF70000C9A7 /* JSIExecutor.h */, + ED6189682155BBF70000C9A7 /* JSINativeModules.h */, + ); + name = jsireact; + sourceTree = ""; + }; + EDEBC6D8214B3F6800DD5AC8 /* jsi */ = { + isa = PBXGroup; + children = ( + EDEBC6D9214B3F6800DD5AC8 /* jsi-inl.h */, + EDEBC6DA214B3F6800DD5AC8 /* JSIDynamic.cpp */, + EDEBC6DB214B3F6800DD5AC8 /* jsi.cpp */, + EDEBC6DC214B3F6800DD5AC8 /* JSIDynamic.h */, + EDEBC6DD214B3F6800DD5AC8 /* JSCRuntime.cpp */, + EDEBC6DE214B3F6800DD5AC8 /* JSCRuntime.h */, + EDEBC6DF214B3F6800DD5AC8 /* BUCK */, + EDEBC6E0214B3F6800DD5AC8 /* instrumentation.h */, + EDEBC6E1214B3F6800DD5AC8 /* jsi.h */, + ); + path = jsi; + sourceTree = ""; + }; + EDEBC73C214B463000DD5AC8 /* jsiexecutor */ = { + isa = PBXGroup; + children = ( + ED6189662155BBDD0000C9A7 /* jsireact */, + EDEBC73E214B463000DD5AC8 /* JSINativeModules.cpp */, + EDEBC73F214B463000DD5AC8 /* JSIExecutor.cpp */, + EDEBC740214B463000DD5AC8 /* BUCK */, + ); + path = jsiexecutor; + sourceTree = ""; + }; F1EFDA4D201F660F00EE6E4C /* UIUtils */ = { isa = PBXGroup; children = ( @@ -3112,11 +3072,9 @@ 3DA982391E5B0F8A004F2374 /* UIView+Private.h in Headers */, 13134C8D1E296B2A00B9F3CB /* RCTMessageThread.h in Headers */, 130443DE1E401B0D00D93A67 /* RCTTVView.h in Headers */, - 598FD1941F8172A9006C54CB /* PrivateDataBase.h in Headers */, 3D7AA9C51E548CDB001955CF /* NSDataBigString.h in Headers */, 5960C1BA1F0804A00066FD5B /* RCTLayoutAnimationGroup.h in Headers */, 13134C991E296B2A00B9F3CB /* RCTCxxMethod.h in Headers */, - 3D0E378D1F1CC58F00DCAC9F /* RCTWebSocketObserver.h in Headers */, 3D302F471DF828F800D6DDAE /* RCTPlatform.h in Headers */, 13134C951E296B2A00B9F3CB /* RCTObjcExecutor.h in Headers */, 590D7BFE1EBD458B00D8A370 /* RCTShadowView+Layout.h in Headers */, @@ -3150,7 +3108,6 @@ 3D302F351DF828F800D6DDAE /* RCTErrorCustomizer.h in Headers */, 3D302F361DF828F800D6DDAE /* RCTErrorInfo.h in Headers */, 3D302F371DF828F800D6DDAE /* RCTEventDispatcher.h in Headers */, - 59EDBCAA1FDF4E0C003573DE /* (null) in Headers */, 594F0A371FD23228007FBE96 /* RCTSurfaceSizeMeasureMode.h in Headers */, 3D302F381DF828F800D6DDAE /* RCTFrameUpdate.h in Headers */, 3D302F391DF828F800D6DDAE /* RCTImageSource.h in Headers */, @@ -3163,7 +3120,6 @@ 599FAA491FB274980058CCF6 /* RCTSurfaceView+Internal.h in Headers */, 59EDBCB61FDF4E0C003573DE /* RCTScrollView.h in Headers */, 3D302F3E1DF828F800D6DDAE /* RCTKeyCommands.h in Headers */, - 135A9C031E7B0F6100587AEB /* RCTJSCErrorHandling.h in Headers */, 599FAA411FB274980058CCF6 /* RCTSurfaceRootShadowViewDelegate.h in Headers */, 3D302F3F1DF828F800D6DDAE /* RCTLog.h in Headers */, 599FAA431FB274980058CCF6 /* RCTSurfaceRootView.h in Headers */, @@ -3179,7 +3135,6 @@ 3D302F481DF828F800D6DDAE /* RCTRootView.h in Headers */, 3D302F491DF828F800D6DDAE /* RCTRootViewDelegate.h in Headers */, 3D302F4A1DF828F800D6DDAE /* RCTRootViewInternal.h in Headers */, - 59EDBCB21FDF4E0C003573DE /* (null) in Headers */, 3D302F4B1DF828F800D6DDAE /* RCTTouchEvent.h in Headers */, 591F78DD202ADB22004A668C /* RCTLayout.h in Headers */, 59D031F21F8353D3008361F0 /* RCTSafeAreaView.h in Headers */, @@ -3189,7 +3144,6 @@ 59500D441F71C63F00B122B7 /* RCTUIManagerUtils.h in Headers */, 3D302F4F1DF828F800D6DDAE /* RCTUtils.h in Headers */, 59D031FA1F8353D3008361F0 /* RCTSafeAreaViewManager.h in Headers */, - 3D302F541DF828F800D6DDAE /* RCTJSCSamplingProfiler.h in Headers */, 3D302F551DF828F800D6DDAE /* RCTAccessibilityManager.h in Headers */, 3D302F561DF828F800D6DDAE /* RCTAlertManager.h in Headers */, 3D302F571DF828F800D6DDAE /* RCTAppState.h in Headers */, @@ -3218,7 +3172,6 @@ 3D302F661DF828F800D6DDAE /* RCTFPSGraph.h in Headers */, 3D302F681DF828F800D6DDAE /* RCTMacros.h in Headers */, 3D302F691DF828F800D6DDAE /* RCTProfile.h in Headers */, - 3DF1BE841F26577000068F1A /* JSCTracing.h in Headers */, 3D302F6A1DF828F800D6DDAE /* RCTActivityIndicatorView.h in Headers */, 3D302F6B1DF828F800D6DDAE /* RCTActivityIndicatorViewManager.h in Headers */, 3D7BFD301EA8E3FA008DFB7A /* RCTSRWebSocket.h in Headers */, @@ -3240,7 +3193,6 @@ 594F0A331FD23228007FBE96 /* RCTSurfaceHostingView.h in Headers */, 130443DD1E401AF500D93A67 /* RCTConvert+Transform.h in Headers */, 134D63C41F1FEC65008872B5 /* RCTCxxBridgeDelegate.h in Headers */, - 135A9C061E7B0F7800587AEB /* RCTJSCHelpers.h in Headers */, 3D302F841DF828F800D6DDAE /* RCTPointerEvents.h in Headers */, 59EB6DBC1EBD6FC90072A5E7 /* RCTUIManagerObserverCoordinator.h in Headers */, 657734941EE8356100A0E9EA /* RCTInspectorPackagerConnection.h in Headers */, @@ -3305,44 +3257,23 @@ 27595AD51E575C7800CCE2B1 /* NativeToJsBridge.h in Headers */, 27595AC41E575C7800CCE2B1 /* Instance.h in Headers */, 27595AD11E575C7800CCE2B1 /* MessageQueueThread.h in Headers */, - 27595ACE1E575C7800CCE2B1 /* JSCUtils.h in Headers */, 3D7454811E5475AF00E74ADD /* RecoverableError.h in Headers */, 27595AC51E575C7800CCE2B1 /* JsArgumentHelpers-inl.h in Headers */, - 27595AC91E575C7800CCE2B1 /* JSCLegacyTracing.h in Headers */, - 27595AD61E575C7800CCE2B1 /* Platform.h in Headers */, 27595AD81E575C7800CCE2B1 /* SystraceSection.h in Headers */, 27595AC61E575C7800CCE2B1 /* JsArgumentHelpers.h in Headers */, 27595AD71E575C7800CCE2B1 /* SampleCxxModule.h in Headers */, 27595AD21E575C7800CCE2B1 /* MethodCall.h in Headers */, 3D3030221DF8294C00D6DDAE /* JSBundleType.h in Headers */, - 27595ACA1E575C7800CCE2B1 /* JSCMemory.h in Headers */, 3D74547D1E54758900E74ADD /* JSBigString.h in Headers */, - 27595AC71E575C7800CCE2B1 /* JSCExecutor.h in Headers */, - 27595ACD1E575C7800CCE2B1 /* JSCSamplingProfiler.h in Headers */, 27595ABF1E575C7800CCE2B1 /* CxxModule.h in Headers */, 27595AD41E575C7800CCE2B1 /* NativeModule.h in Headers */, - 27595ACB1E575C7800CCE2B1 /* JSCNativeModules.h in Headers */, 27595AC01E575C7800CCE2B1 /* CxxNativeModule.h in Headers */, 27595AD01E575C7800CCE2B1 /* JSIndexedRAMBundle.h in Headers */, 27595AD31E575C7800CCE2B1 /* ModuleRegistry.h in Headers */, - 27595ACC1E575C7800CCE2B1 /* JSCPerfStats.h in Headers */, 27595AC11E575C7800CCE2B1 /* JSExecutor.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - 3D3030241DF8295800D6DDAE /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 19F61C041E8495FF00571D81 /* JSCHelpers.h in Headers */, - 19F61C051E8495FF00571D81 /* noncopyable.h in Headers */, - 19F61C061E8495FF00571D81 /* Unicode.h in Headers */, - 19F61C071E8495FF00571D81 /* Value.h in Headers */, - 3D3030251DF8295E00D6DDAE /* JavaScriptCore.h in Headers */, - 3D3030261DF8295E00D6DDAE /* JSCWrapper.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 3D383D541EBD27B9005632C8 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -3377,19 +3308,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 3D3CD9001DE5FBD600167DC4 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 13EBC6821E28733C00880AC5 /* Value.h in Headers */, - 13EBC6811E28733C00880AC5 /* Unicode.h in Headers */, - 13EBC6801E28733C00880AC5 /* noncopyable.h in Headers */, - 13EBC67E1E28726000880AC5 /* JSCHelpers.h in Headers */, - 3D3CD93D1DE5FC1400167DC4 /* JavaScriptCore.h in Headers */, - 3D3CD93E1DE5FC1400167DC4 /* JSCWrapper.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 3D3CD91A1DE5FBEC00167DC4 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -3400,27 +3318,19 @@ 27595ABA1E575C7800CCE2B1 /* NativeToJsBridge.h in Headers */, 27595AA91E575C7800CCE2B1 /* Instance.h in Headers */, 27595AB61E575C7800CCE2B1 /* MessageQueueThread.h in Headers */, - 27595AB31E575C7800CCE2B1 /* JSCUtils.h in Headers */, 3D7454801E5475AF00E74ADD /* RecoverableError.h in Headers */, 27595AAA1E575C7800CCE2B1 /* JsArgumentHelpers-inl.h in Headers */, - 27595AAE1E575C7800CCE2B1 /* JSCLegacyTracing.h in Headers */, - 27595ABB1E575C7800CCE2B1 /* Platform.h in Headers */, 27595ABD1E575C7800CCE2B1 /* SystraceSection.h in Headers */, 27595AAB1E575C7800CCE2B1 /* JsArgumentHelpers.h in Headers */, 27595ABC1E575C7800CCE2B1 /* SampleCxxModule.h in Headers */, 27595AB71E575C7800CCE2B1 /* MethodCall.h in Headers */, - 27595AAF1E575C7800CCE2B1 /* JSCMemory.h in Headers */, 3D74547C1E54758900E74ADD /* JSBigString.h in Headers */, - 27595AAC1E575C7800CCE2B1 /* JSCExecutor.h in Headers */, - 27595AB21E575C7800CCE2B1 /* JSCSamplingProfiler.h in Headers */, 27595AA41E575C7800CCE2B1 /* CxxModule.h in Headers */, 27595AB91E575C7800CCE2B1 /* NativeModule.h in Headers */, - 27595AB01E575C7800CCE2B1 /* JSCNativeModules.h in Headers */, 3D3CD9451DE5FC7100167DC4 /* JSBundleType.h in Headers */, 27595AA51E575C7800CCE2B1 /* CxxNativeModule.h in Headers */, 27595AB51E575C7800CCE2B1 /* JSIndexedRAMBundle.h in Headers */, 27595AB81E575C7800CCE2B1 /* ModuleRegistry.h in Headers */, - 27595AB11E575C7800CCE2B1 /* JSCPerfStats.h in Headers */, 27595AA61E575C7800CCE2B1 /* JSExecutor.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -3443,7 +3353,6 @@ 3D80DA1F1DF820620028D040 /* RCTPushNotificationManager.h in Headers */, 3D80DA201DF820620028D040 /* RCTAssert.h in Headers */, 3D80DA211DF820620028D040 /* RCTBridge.h in Headers */, - 13F880381E296D2800C3C7A1 /* JSCWrapper.h in Headers */, 3D80DA221DF820620028D040 /* RCTBridge+Private.h in Headers */, 599FAA461FB274980058CCF6 /* RCTSurfaceStage.h in Headers */, 599FAA361FB274980058CCF6 /* RCTSurface.h in Headers */, @@ -3470,11 +3379,9 @@ 3D80DA2F1DF820620028D040 /* RCTInvalidating.h in Headers */, 598FD1971F817336006C54CB /* RCTModalManager.h in Headers */, 599FAA3A1FB274980058CCF6 /* RCTSurfaceDelegate.h in Headers */, - 9936F3381F5F2F480010BF04 /* PrivateDataBase.h in Headers */, 3D80DA301DF820620028D040 /* RCTJavaScriptExecutor.h in Headers */, 3DCE53281FEAB23100613583 /* RCTDatePicker.h in Headers */, 50E98FEB21460B0D00CD9289 /* RCTWKWebView.h in Headers */, - 135A9BFF1E7B0EE600587AEB /* RCTJSCHelpers.h in Headers */, 3D80DA311DF820620028D040 /* RCTJavaScriptLoader.h in Headers */, 130E3D881E6A082100ACE484 /* RCTDevSettings.h in Headers */, 3D80DA321DF820620028D040 /* RCTJSStackFrame.h in Headers */, @@ -3497,7 +3404,6 @@ 3D80DA3D1DF820620028D040 /* RCTRootView.h in Headers */, 59EDBCB91FDF4E0C003573DE /* RCTScrollViewManager.h in Headers */, 59EDBCB51FDF4E0C003573DE /* RCTScrollView.h in Headers */, - 135A9BFB1E7B0EAE00587AEB /* RCTJSCErrorHandling.h in Headers */, 3D80DA3E1DF820620028D040 /* RCTRootViewDelegate.h in Headers */, 3D80DA3F1DF820620028D040 /* RCTRootViewInternal.h in Headers */, 3D80DA401DF820620028D040 /* RCTTouchEvent.h in Headers */, @@ -3509,11 +3415,9 @@ 3D80DA431DF820620028D040 /* RCTURLRequestHandler.h in Headers */, 3D80DA441DF820620028D040 /* RCTUtils.h in Headers */, 13134C981E296B2A00B9F3CB /* RCTCxxMethod.h in Headers */, - 3D80DA491DF820620028D040 /* RCTJSCSamplingProfiler.h in Headers */, 3D80DA4A1DF820620028D040 /* RCTAccessibilityManager.h in Headers */, 3D80DA4B1DF820620028D040 /* RCTAlertManager.h in Headers */, 3D80DA4C1DF820620028D040 /* RCTAppState.h in Headers */, - 3D0E378C1F1CC58C00DCAC9F /* RCTWebSocketObserver.h in Headers */, 3D80DA4D1DF820620028D040 /* RCTAsyncLocalStorage.h in Headers */, 3D80DA4E1DF820620028D040 /* RCTClipboard.h in Headers */, 3D80DA4F1DF820620028D040 /* RCTDevLoadingView.h in Headers */, @@ -3561,7 +3465,6 @@ 3D80DA6B1DF820620028D040 /* RCTFont.h in Headers */, 3D80DA701DF820620028D040 /* RCTModalHostView.h in Headers */, 3D80DA711DF820620028D040 /* RCTModalHostViewController.h in Headers */, - 3DF1BE831F26576400068F1A /* JSCTracing.h in Headers */, 3D80DA721DF820620028D040 /* RCTModalHostViewManager.h in Headers */, 13134C9C1E296B2A00B9F3CB /* RCTCxxModule.h in Headers */, 594F0A321FD23228007FBE96 /* RCTSurfaceHostingView.h in Headers */, @@ -3606,33 +3509,77 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 9936F2FB1F5F2E4B0010BF04 /* Headers */ = { + EBF21BC41FC498900052F4D5 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 9936F33C1F5F2FE70010BF04 /* PrivateDataBase.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - 9936F3171F5F2E5B0010BF04 /* Headers */ = { + EBF21BE21FC4989A0052F4D5 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 9936F3391F5F2F5C0010BF04 /* PrivateDataBase.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - EBF21BC41FC498900052F4D5 /* Headers */ = { + ED296F99214C9A0900B7C4FE /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + ED296FBC214C9B0400B7C4FE /* jsi-inl.h in Headers */, + ED296FBF214C9B0400B7C4FE /* JSIDynamic.h in Headers */, + ED296FC1214C9B0400B7C4FE /* JSCRuntime.h in Headers */, + ED296FC3214C9B0400B7C4FE /* instrumentation.h in Headers */, + ED296FC4214C9B0400B7C4FE /* jsi.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - EBF21BE21FC4989A0052F4D5 /* Headers */ = { + ED296FD1214C9CF800B7C4FE /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ED61896C2155BBF70000C9A7 /* JSINativeModules.h in Headers */, + ED61896A2155BBF70000C9A7 /* JSIExecutor.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + ED2970382150123E00B7C4FE /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ED29703E2150126E00B7C4FE /* AtomicIntrusiveLinkedList.h in Headers */, + ED2970402150126E00B7C4FE /* Bits.h in Headers */, + ED2970422150126E00B7C4FE /* Conv.h in Headers */, + ED2970432150126E00B7C4FE /* dynamic-inl.h in Headers */, + ED2970452150126E00B7C4FE /* dynamic.h in Headers */, + ED2970462150126E00B7C4FE /* Exception.h in Headers */, + ED2970482150126E00B7C4FE /* json.h in Headers */, + ED2970492150126E00B7C4FE /* Memory.h in Headers */, + ED29704A2150126E00B7C4FE /* MoveWrapper.h in Headers */, + ED29704B2150126E00B7C4FE /* Optional.h in Headers */, + ED29704C2150126E00B7C4FE /* ScopeGuard.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + EDEBC6BB214B3E7000DD5AC8 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + EDEBC6E9214B3F6800DD5AC8 /* jsi.h in Headers */, + EDEBC6E7214B3F6800DD5AC8 /* JSCRuntime.h in Headers */, + EDEBC6E5214B3F6800DD5AC8 /* JSIDynamic.h in Headers */, + EDEBC6E2214B3F6800DD5AC8 /* jsi-inl.h in Headers */, + EDEBC6E8214B3F6800DD5AC8 /* instrumentation.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + EDEBC729214B45A300DD5AC8 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + ED61896B2155BBF70000C9A7 /* JSINativeModules.h in Headers */, + ED6189692155BBF70000C9A7 /* JSIExecutor.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3687,6 +3634,9 @@ buildRules = ( ); dependencies = ( + ED2970662150237300B7C4FE /* PBXTargetDependency */, + ED296FCA214C9B6200B7C4FE /* PBXTargetDependency */, + ED296F81214C971800B7C4FE /* PBXTargetDependency */, 3D0574551DE5FF9600184BB4 /* PBXTargetDependency */, 3D0574571DE5FF9600184BB4 /* PBXTargetDependency */, ); @@ -3700,6 +3650,7 @@ buildConfigurationList = 3D383D391EBD27B6005632C8 /* Build configuration list for PBXNativeTarget "third-party-tvOS" */; buildPhases = ( 3D383D241EBD27B6005632C8 /* Sources */, + ED2970382150123E00B7C4FE /* Headers */, ); buildRules = ( ); @@ -3763,44 +3714,6 @@ productReference = 3D3C06751DE3340C00C268FA /* libyoga.a */; productType = "com.apple.product-type.library.static"; }; - 3D3CD8FF1DE5FBD600167DC4 /* jschelpers */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3D3CD9081DE5FBD600167DC4 /* Build configuration list for PBXNativeTarget "jschelpers" */; - buildPhases = ( - 3D3CD9001DE5FBD600167DC4 /* Headers */, - 3D80DABB1DF8218B0028D040 /* Copy Headers */, - 3D3CD9051DE5FBD600167DC4 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - 9936F3441F5F30780010BF04 /* PBXTargetDependency */, - 1320081B1E283DC300F0C457 /* PBXTargetDependency */, - ); - name = jschelpers; - productName = React; - productReference = 3D3CD90B1DE5FBD600167DC4 /* libjschelpers.a */; - productType = "com.apple.product-type.library.static"; - }; - 3D3CD90C1DE5FBD800167DC4 /* jschelpers-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3D3CD9151DE5FBD800167DC4 /* Build configuration list for PBXNativeTarget "jschelpers-tvOS" */; - buildPhases = ( - 3D3030241DF8295800D6DDAE /* Headers */, - 3D302F1D1DF8264A00D6DDAE /* Copy Headers */, - 3D3CD9121DE5FBD800167DC4 /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - 9936F3461F5F30830010BF04 /* PBXTargetDependency */, - 3D383D641EBD27CE005632C8 /* PBXTargetDependency */, - ); - name = "jschelpers-tvOS"; - productName = "React-tvOS"; - productReference = 3D3CD9181DE5FBD800167DC4 /* libjschelpers.a */; - productType = "com.apple.product-type.library.static"; - }; 3D3CD9191DE5FBEC00167DC4 /* cxxreact */ = { isa = PBXNativeTarget; buildConfigurationList = 3D3CD9221DE5FBEC00167DC4 /* Build configuration list for PBXNativeTarget "cxxreact" */; @@ -3812,9 +3725,7 @@ buildRules = ( ); dependencies = ( - EBF21C021FC499D10052F4D5 /* PBXTargetDependency */, - 9936F3401F5F305D0010BF04 /* PBXTargetDependency */, - 3D3CD9501DE5FDB900167DC4 /* PBXTargetDependency */, + EDEBC7D7214C52FD00DD5AC8 /* PBXTargetDependency */, ); name = cxxreact; productName = React; @@ -3832,9 +3743,7 @@ buildRules = ( ); dependencies = ( - EBF21C041FC499D80052F4D5 /* PBXTargetDependency */, - 9936F3421F5F30640010BF04 /* PBXTargetDependency */, - 3DC159E81E83E2A0007B1282 /* PBXTargetDependency */, + ED296F97214C996500B7C4FE /* PBXTargetDependency */, ); name = "cxxreact-tvOS"; productName = "React-tvOS"; @@ -3855,6 +3764,9 @@ buildRules = ( ); dependencies = ( + EDEBC74F214B477400DD5AC8 /* PBXTargetDependency */, + EDEBC7D9214C628300DD5AC8 /* PBXTargetDependency */, + EDEBC74B214B46A700DD5AC8 /* PBXTargetDependency */, 53D123991FBF1E0C001B8A10 /* PBXTargetDependency */, 3D3CD94C1DE5FCE700167DC4 /* PBXTargetDependency */, ); @@ -3863,93 +3775,139 @@ productReference = 83CBBA2E1A601D0E00E9B192 /* libReact.a */; productType = "com.apple.product-type.library.static"; }; - 9936F2F81F5F2E4B0010BF04 /* privatedata */ = { + EBF21BBF1FC498900052F4D5 /* jsinspector */ = { isa = PBXNativeTarget; - buildConfigurationList = 9936F3101F5F2E4B0010BF04 /* Build configuration list for PBXNativeTarget "privatedata" */; + buildConfigurationList = EBF21BD91FC498900052F4D5 /* Build configuration list for PBXNativeTarget "jsinspector" */; buildPhases = ( - 9936F2FB1F5F2E4B0010BF04 /* Headers */, - 9936F3021F5F2E4B0010BF04 /* Copy Headers */, - 9936F30A1F5F2E4B0010BF04 /* Sources */, + EBF21BC41FC498900052F4D5 /* Headers */, + EBF21BCB1FC498900052F4D5 /* Copy Headers */, + EBF21BD31FC498900052F4D5 /* Sources */, ); buildRules = ( ); dependencies = ( ); - name = privatedata; + name = jsinspector; productName = React; - productReference = 9936F3131F5F2E4B0010BF04 /* libprivatedata.a */; + productReference = EBF21BDC1FC498900052F4D5 /* libjsinspector.a */; productType = "com.apple.product-type.library.static"; }; - 9936F3141F5F2E5B0010BF04 /* privatedata-tvOS */ = { + EBF21BDD1FC4989A0052F4D5 /* jsinspector-tvOS */ = { isa = PBXNativeTarget; - buildConfigurationList = 9936F32C1F5F2E5B0010BF04 /* Build configuration list for PBXNativeTarget "privatedata-tvOS" */; + buildConfigurationList = EBF21BF71FC4989A0052F4D5 /* Build configuration list for PBXNativeTarget "jsinspector-tvOS" */; buildPhases = ( - 9936F3171F5F2E5B0010BF04 /* Headers */, - 9936F31E1F5F2E5B0010BF04 /* Copy Headers */, - 9936F3261F5F2E5B0010BF04 /* Sources */, + EBF21BE21FC4989A0052F4D5 /* Headers */, + EBF21BE91FC4989A0052F4D5 /* Copy Headers */, + EBF21BF11FC4989A0052F4D5 /* Sources */, ); buildRules = ( ); dependencies = ( ); - name = "privatedata-tvOS"; + name = "jsinspector-tvOS"; productName = "React-tvOS"; - productReference = 9936F32F1F5F2E5B0010BF04 /* libprivatedata-tvOS.a */; + productReference = EBF21BFA1FC4989A0052F4D5 /* libjsinspector-tvOS.a */; productType = "com.apple.product-type.library.static"; }; - EBF21BBF1FC498900052F4D5 /* jsinspector */ = { + ED296F98214C9A0900B7C4FE /* jsi-tvOS */ = { isa = PBXNativeTarget; - buildConfigurationList = EBF21BD91FC498900052F4D5 /* Build configuration list for PBXNativeTarget "jsinspector" */; + buildConfigurationList = ED296FB3214C9A0900B7C4FE /* Build configuration list for PBXNativeTarget "jsi-tvOS" */; buildPhases = ( - EBF21BC41FC498900052F4D5 /* Headers */, - EBF21BCB1FC498900052F4D5 /* Copy Headers */, - EBF21BD31FC498900052F4D5 /* Sources */, + ED296F99214C9A0900B7C4FE /* Headers */, + ED296FA4214C9A0900B7C4FE /* Copy Headers */, + ED296FA9214C9A0900B7C4FE /* Sources */, + ED296FCE214C9CB400B7C4FE /* Frameworks */, ); buildRules = ( ); dependencies = ( + ED29704E215012C700B7C4FE /* PBXTargetDependency */, ); - name = jsinspector; - productName = React; - productReference = EBF21BDC1FC498900052F4D5 /* libjsinspector.a */; + name = "jsi-tvOS"; + productName = "React-tvOS"; + productReference = ED296FB6214C9A0900B7C4FE /* libjsi-tvOS.a */; productType = "com.apple.product-type.library.static"; }; - EBF21BDD1FC4989A0052F4D5 /* jsinspector-tvOS */ = { + ED296FD0214C9CF800B7C4FE /* jsiexecutor-tvOS */ = { isa = PBXNativeTarget; - buildConfigurationList = EBF21BF71FC4989A0052F4D5 /* Build configuration list for PBXNativeTarget "jsinspector-tvOS" */; + buildConfigurationList = ED296FEB214C9CF800B7C4FE /* Build configuration list for PBXNativeTarget "jsiexecutor-tvOS" */; buildPhases = ( - EBF21BE21FC4989A0052F4D5 /* Headers */, - EBF21BE91FC4989A0052F4D5 /* Copy Headers */, - EBF21BF11FC4989A0052F4D5 /* Sources */, + ED296FD1214C9CF800B7C4FE /* Headers */, + ED296FDC214C9CF800B7C4FE /* Copy Headers */, + ED296FE1214C9CF800B7C4FE /* Sources */, + ED296FF5214C9E7C00B7C4FE /* Frameworks */, ); buildRules = ( ); dependencies = ( + ED296FFE214C9EC600B7C4FE /* PBXTargetDependency */, + ED296FFC214C9EC000B7C4FE /* PBXTargetDependency */, + ED296FF8214C9EAA00B7C4FE /* PBXTargetDependency */, ); - name = "jsinspector-tvOS"; + name = "jsiexecutor-tvOS"; productName = "React-tvOS"; - productReference = EBF21BFA1FC4989A0052F4D5 /* libjsinspector-tvOS.a */; + productReference = ED296FEE214C9CF800B7C4FE /* libjsiexecutor-tvOS.a */; productType = "com.apple.product-type.library.static"; }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 83CBB9F71A601CBA00E9B192 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 139D7E871E25C6D100323FB7 = { - CreatedOnToolsVersion = 8.1; - }; - 139D7ECD1E25DB7D00323FB7 = { - CreatedOnToolsVersion = 8.1; - }; - 2D2A28121D9B038B00D4039D = { - CreatedOnToolsVersion = 8.0; - }; - 83CBBA2D1A601D0E00E9B192 = { + EDEBC6BA214B3E7000DD5AC8 /* jsi */ = { + isa = PBXNativeTarget; + buildConfigurationList = EDEBC6D3214B3E7000DD5AC8 /* Build configuration list for PBXNativeTarget "jsi" */; + buildPhases = ( + EDEBC6BB214B3E7000DD5AC8 /* Headers */, + EDEBC6C6214B3E7000DD5AC8 /* Copy Headers */, + EDEBC6CA214B3E7000DD5AC8 /* Sources */, + EDEBC756214C283300DD5AC8 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + EDEBC7CC214C516800DD5AC8 /* PBXTargetDependency */, + ); + name = jsi; + productName = React; + productReference = EDEBC6D6214B3E7000DD5AC8 /* libjsi.a */; + productType = "com.apple.product-type.library.static"; + }; + EDEBC724214B45A300DD5AC8 /* jsiexecutor */ = { + isa = PBXNativeTarget; + buildConfigurationList = EDEBC738214B45A300DD5AC8 /* Build configuration list for PBXNativeTarget "jsiexecutor" */; + buildPhases = ( + EDEBC729214B45A300DD5AC8 /* Headers */, + EDEBC72F214B45A300DD5AC8 /* Copy Headers */, + EDEBC734214B45A300DD5AC8 /* Sources */, + EDEBC79A214C2A7000DD5AC8 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ED296F7E214C957300B7C4FE /* PBXTargetDependency */, + EDEBC7D3214C528C00DD5AC8 /* PBXTargetDependency */, + EDEBC7CE214C523F00DD5AC8 /* PBXTargetDependency */, + ); + name = jsiexecutor; + productName = React; + productReference = EDEBC73B214B45A300DD5AC8 /* libjsiexecutor.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 83CBB9F71A601CBA00E9B192 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0940; + ORGANIZATIONNAME = Facebook; + TargetAttributes = { + 139D7E871E25C6D100323FB7 = { + CreatedOnToolsVersion = 8.1; + }; + 139D7ECD1E25DB7D00323FB7 = { + CreatedOnToolsVersion = 8.1; + }; + 2D2A28121D9B038B00D4039D = { + CreatedOnToolsVersion = 8.0; + }; + 83CBBA2D1A601D0E00E9B192 = { CreatedOnToolsVersion = 6.1.1; }; }; @@ -3973,16 +3931,16 @@ 3D3C059B1DE3340C00C268FA /* yoga-tvOS */, 3D3CD9191DE5FBEC00167DC4 /* cxxreact */, 3D3CD9261DE5FBEE00167DC4 /* cxxreact-tvOS */, - 3D3CD8FF1DE5FBD600167DC4 /* jschelpers */, - 3D3CD90C1DE5FBD800167DC4 /* jschelpers-tvOS */, EBF21BBF1FC498900052F4D5 /* jsinspector */, EBF21BDD1FC4989A0052F4D5 /* jsinspector-tvOS */, 139D7ECD1E25DB7D00323FB7 /* third-party */, 3D383D211EBD27B6005632C8 /* third-party-tvOS */, 139D7E871E25C6D100323FB7 /* double-conversion */, 3D383D3D1EBD27B9005632C8 /* double-conversion-tvOS */, - 9936F2F81F5F2E4B0010BF04 /* privatedata */, - 9936F3141F5F2E5B0010BF04 /* privatedata-tvOS */, + EDEBC6BA214B3E7000DD5AC8 /* jsi */, + EDEBC724214B45A300DD5AC8 /* jsiexecutor */, + ED296F98214C9A0900B7C4FE /* jsi-tvOS */, + ED296FD0214C9CF800B7C4FE /* jsiexecutor-tvOS */, ); }; /* End PBXProject section */ @@ -4000,7 +3958,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi"; + shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; showEnvVarsInLog = 0; }; 142C4F7F1B582EA6001F0B58 /* Include RCTJSCProfiler */ = { @@ -4015,7 +3973,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if [[ \"$CONFIGURATION\" == \"Debug\" ]] && [[ -d \"/tmp/RCTJSCProfiler\" ]]; then\n find \"${CONFIGURATION_BUILD_DIR}\" -name '*.app' | xargs -I{} sh -c 'cp -r /tmp/RCTJSCProfiler \"$1\"' -- {}\nfi"; + shellScript = "if [[ \"$CONFIGURATION\" == \"Debug\" ]] && [[ -d \"/tmp/RCTJSCProfiler\" ]]; then\n find \"${CONFIGURATION_BUILD_DIR}\" -name '*.app' | xargs -I{} sh -c 'cp -r /tmp/RCTJSCProfiler \"$1\"' -- {}\nfi\n"; showEnvVarsInLog = 0; }; 190EE32F1E6A43DE00A8543A /* Install Third Party */ = { @@ -4059,7 +4017,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\nif nc -w 5 -z localhost 8081 ; then\nif ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\necho \"Port 8081 already in use, packager is either not running or not running correctly\"\nexit 2\nfi\nelse\nopen \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\nfi\nfi"; + shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\nif nc -w 5 -z localhost 8081 ; then\nif ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\necho \"Port 8081 already in use, packager is either not running or not running correctly\"\nexit 2\nfi\nelse\nopen \"$SRCROOT/../scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\nfi\nfi\n"; showEnvVarsInLog = 0; }; 3D383D3E1EBD27B9005632C8 /* Install Third Party */ = { @@ -4121,7 +4079,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 598FD1931F817284006C54CB /* PrivateDataBase.cpp in Sources */, 3DC159E41E83E1AE007B1282 /* RCTRootContentView.m in Sources */, 3D80D91B1DF6F8200028D040 /* RCTPlatform.m in Sources */, 2D0EB9F32021067800CAF88A /* RCTUIUtils.m in Sources */, @@ -4175,7 +4132,6 @@ 130E3D8B1E6A083900ACE484 /* RCTDevSettings.mm in Sources */, 2D3B5E951D9B087C00451313 /* RCTAssert.m in Sources */, 59D031F81F8353D3008361F0 /* RCTSafeAreaViewLocalData.m in Sources */, - 3DF1BE851F26577300068F1A /* JSCTracing.cpp in Sources */, 2D3B5EB61D9B091400451313 /* RCTExceptionsManager.m in Sources */, 2D3B5EEB1D9B09D000451313 /* RCTTabBarItem.m in Sources */, 2D3B5ED41D9B097D00451313 /* RCTModalHostView.m in Sources */, @@ -4211,7 +4167,6 @@ 2D3B5EB51D9B091100451313 /* RCTDevMenu.m in Sources */, 59EDBCAC1FDF4E0C003573DE /* (null) in Sources */, 2D3B5EBD1D9B092A00451313 /* RCTTiming.m in Sources */, - 135A9C041E7B0F6400587AEB /* RCTJSCErrorHandling.mm in Sources */, 2D3B5EA81D9B08D300451313 /* RCTUtils.m in Sources */, 599FAA451FB274980058CCF6 /* RCTSurfaceRootView.mm in Sources */, 2D3B5EC81D9B095800451313 /* RCTActivityIndicatorViewManager.m in Sources */, @@ -4229,7 +4184,6 @@ 2D3B5EB01D9B08FE00451313 /* RCTAlertManager.m in Sources */, 13134C9B1E296B2A00B9F3CB /* RCTCxxMethod.mm in Sources */, 2D3B5E9C1D9B08A300451313 /* RCTImageSource.m in Sources */, - 3DDEC1521DDCE0CA0020BBDF /* RCTJSCSamplingProfiler.m in Sources */, 2D3B5EC31D9B094800451313 /* RCTProfileTrampoline-arm.S in Sources */, 3D0B842B1EC0B49400B2BD8E /* RCTTVRemoteHandler.m in Sources */, 657734861EE834D900A0E9EA /* RCTInspectorDevServerHelper.mm in Sources */, @@ -4246,7 +4200,6 @@ 2D3B5EC11D9B093900451313 /* RCTFPSGraph.m in Sources */, 2D3B5E9A1D9B089D00451313 /* RCTEventDispatcher.m in Sources */, 2D3B5ED61D9B098400451313 /* RCTModalHostViewManager.m in Sources */, - 135A9C051E7B0F7500587AEB /* RCTJSCHelpers.mm in Sources */, 2D3B5EC71D9B095600451313 /* RCTActivityIndicatorView.m in Sources */, 2D3B5EB21D9B090300451313 /* RCTAsyncLocalStorage.m in Sources */, 59D031FC1F8353D3008361F0 /* RCTSafeAreaViewManager.m in Sources */, @@ -4323,30 +4276,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 3D3CD9051DE5FBD600167DC4 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13EBC6711E2870DE00880AC5 /* JSCWrapper.cpp in Sources */, - 13EBC6731E2870DE00880AC5 /* Value.cpp in Sources */, - 13EBC67D1E28725900880AC5 /* JSCHelpers.cpp in Sources */, - 135A9C021E7B0F4800587AEB /* systemJSCWrapper.cpp in Sources */, - 13EBC67B1E28723000880AC5 /* Unicode.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D3CD9121DE5FBD800167DC4 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13EBC6791E2870E400880AC5 /* Unicode.cpp in Sources */, - 13EBC6781E2870E400880AC5 /* JSCWrapper.cpp in Sources */, - 13EBC6771E2870E400880AC5 /* JSCHelpers.cpp in Sources */, - 135A9C011E7B0F4700587AEB /* systemJSCWrapper.cpp in Sources */, - 13EBC67A1E2870E400880AC5 /* Value.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 3D3CD91F1DE5FBEC00167DC4 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -4356,19 +4285,11 @@ 13F8877D1E29726200C3C7A1 /* ModuleRegistry.cpp in Sources */, C6D3801C1F71D76700621378 /* RAMBundleRegistry.cpp in Sources */, 13F8876E1E29726200C3C7A1 /* CxxNativeModule.cpp in Sources */, - 13F887721E29726200C3C7A1 /* JSCExecutor.cpp in Sources */, - 13F887741E29726200C3C7A1 /* JSCLegacyTracing.cpp in Sources */, 13DA8A332097A90B00276ED4 /* ReactMarker.cpp in Sources */, - 13F887771E29726200C3C7A1 /* JSCPerfStats.cpp in Sources */, 13F887711E29726200C3C7A1 /* JSBundleType.cpp in Sources */, - 13F887791E29726200C3C7A1 /* JSCUtils.cpp in Sources */, - 13F887781E29726200C3C7A1 /* JSCSamplingProfiler.cpp in Sources */, - 13F887751E29726200C3C7A1 /* JSCMemory.cpp in Sources */, 13F8877C1E29726200C3C7A1 /* MethodCall.cpp in Sources */, - 13F8877F1E29726200C3C7A1 /* Platform.cpp in Sources */, 13F887701E29726200C3C7A1 /* Instance.cpp in Sources */, 13F8877E1E29726200C3C7A1 /* NativeToJsBridge.cpp in Sources */, - 13F887761E29726200C3C7A1 /* JSCNativeModules.cpp in Sources */, 13F887801E29726200C3C7A1 /* SampleCxxModule.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -4382,20 +4303,12 @@ 13F8878E1E29726300C3C7A1 /* JSIndexedRAMBundle.cpp in Sources */, 13F887901E29726300C3C7A1 /* ModuleRegistry.cpp in Sources */, C6D3801D1F71D76800621378 /* RAMBundleRegistry.cpp in Sources */, - 13F887851E29726300C3C7A1 /* JSCExecutor.cpp in Sources */, - 13F887871E29726300C3C7A1 /* JSCLegacyTracing.cpp in Sources */, - 13F8878A1E29726300C3C7A1 /* JSCPerfStats.cpp in Sources */, 13DA8A342097A90B00276ED4 /* ReactMarker.cpp in Sources */, 13F887841E29726300C3C7A1 /* Instance.cpp in Sources */, - 13F8878C1E29726300C3C7A1 /* JSCUtils.cpp in Sources */, - 13F8878B1E29726300C3C7A1 /* JSCSamplingProfiler.cpp in Sources */, - 13F887881E29726300C3C7A1 /* JSCMemory.cpp in Sources */, 3D80D9181DF6F7A80028D040 /* JSBundleType.cpp in Sources */, 13F8878F1E29726300C3C7A1 /* MethodCall.cpp in Sources */, - 13F887921E29726300C3C7A1 /* Platform.cpp in Sources */, 13F887911E29726300C3C7A1 /* NativeToJsBridge.cpp in Sources */, 13F887821E29726300C3C7A1 /* CxxNativeModule.cpp in Sources */, - 13F887891E29726300C3C7A1 /* JSCNativeModules.cpp in Sources */, 13F887931E29726300C3C7A1 /* SampleCxxModule.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -4472,12 +4385,10 @@ 59EDBCB71FDF4E0C003573DE /* RCTScrollView.m in Sources */, 59EDBCAB1FDF4E0C003573DE /* (null) in Sources */, 59EDBCBB1FDF4E0C003573DE /* RCTScrollViewManager.m in Sources */, - 369123E11DDC75850095B341 /* RCTJSCSamplingProfiler.m in Sources */, 599FAA441FB274980058CCF6 /* RCTSurfaceRootView.mm in Sources */, C60669361F3CCF1B00E67165 /* RCTManagedPointer.mm in Sources */, 13B080261A694A8400A75B9A /* RCTWrapperViewController.m in Sources */, A2440AA31DF8D854006E7BFC /* RCTReloadCommand.m in Sources */, - 3DF1BE821F26576400068F1A /* JSCTracing.cpp in Sources */, 6577348F1EE8354A00A0E9EA /* RCTInspector.mm in Sources */, E9B20B7B1B500126007A2DA7 /* RCTAccessibilityManager.m in Sources */, 13A0C2891B74F71200B29F6F /* RCTDevLoadingView.m in Sources */, @@ -4503,7 +4414,6 @@ EBF21BBD1FC498270052F4D5 /* InspectorInterfaces.cpp in Sources */, 59EDBCAF1FDF4E0C003573DE /* RCTScrollContentView.m in Sources */, 13D9FEEE1CDCD93000158BD7 /* RCTKeyboardObserver.m in Sources */, - 135A9C001E7B0EE600587AEB /* RCTJSCHelpers.mm in Sources */, B233E6EA1D2D845D00BC68BA /* RCTI18nManager.m in Sources */, 3D7BFD1F1EA8E351008DFB7A /* RCTPackagerConnection.mm in Sources */, 13456E931ADAD2DE009F94A7 /* RCTConvert+CoreLocation.m in Sources */, @@ -4525,7 +4435,6 @@ 137327E81AA5CF210034F82E /* RCTTabBarItem.m in Sources */, 83A1FE8C1B62640A00BE0E65 /* RCTModalHostView.m in Sources */, 5925356A20084D0600DD584B /* RCTSurfaceSizeMeasureMode.mm in Sources */, - 9936F3371F5F2F480010BF04 /* PrivateDataBase.cpp in Sources */, 1450FF871BCFF28A00208362 /* RCTProfileTrampoline-arm.S in Sources */, 131B6AF51AF1093D00FFC3E0 /* RCTSegmentedControlManager.m in Sources */, 58114A171AAE854800E7D092 /* RCTPickerManager.m in Sources */, @@ -4536,7 +4445,6 @@ 5960C1BB1F0804A00066FD5B /* RCTLayoutAnimationGroup.m in Sources */, 137327E71AA5CF210034F82E /* RCTTabBar.m in Sources */, 13F17A851B8493E5007D4C75 /* RCTRedBox.m in Sources */, - 135A9BFC1E7B0EAE00587AEB /* RCTJSCErrorHandling.mm in Sources */, 59D031F31F8353D3008361F0 /* RCTSafeAreaView.m in Sources */, 83392EB31B6634E10013B15F /* RCTModalHostViewController.m in Sources */, 83CBBA691A601EF300E9B192 /* RCTEventDispatcher.m in Sources */, @@ -4551,46 +4459,63 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 9936F30A1F5F2E4B0010BF04 /* Sources */ = { + EBF21BD31FC498900052F4D5 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9936F33E1F5F2FFC0010BF04 /* PrivateDataBase.cpp in Sources */, + EBF21BFC1FC4990B0052F4D5 /* InspectorInterfaces.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 9936F3261F5F2E5B0010BF04 /* Sources */ = { + EBF21BF11FC4989A0052F4D5 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9936F33B1F5F2F9D0010BF04 /* PrivateDataBase.cpp in Sources */, + EBF21BFF1FC4998E0052F4D5 /* InspectorInterfaces.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - EBF21BD31FC498900052F4D5 /* Sources */ = { + ED296FA9214C9A0900B7C4FE /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - EBF21BFC1FC4990B0052F4D5 /* InspectorInterfaces.cpp in Sources */, + ED296FB9214C9AC200B7C4FE /* JSCRuntime.cpp in Sources */, + ED296FB7214C9A9A00B7C4FE /* JSIDynamic.cpp in Sources */, + ED296FB8214C9A9A00B7C4FE /* jsi.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - EBF21BF11FC4989A0052F4D5 /* Sources */ = { + ED296FE1214C9CF800B7C4FE /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - EBF21BFF1FC4998E0052F4D5 /* InspectorInterfaces.cpp in Sources */, + ED296FF3214C9D6C00B7C4FE /* JSINativeModules.cpp in Sources */, + ED296FF4214C9D6C00B7C4FE /* JSIExecutor.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + EDEBC6CA214B3E7000DD5AC8 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + EDEBC6E6214B3F6800DD5AC8 /* JSCRuntime.cpp in Sources */, + EDEBC6E4214B3F6800DD5AC8 /* jsi.cpp in Sources */, + EDEBC6E3214B3F6800DD5AC8 /* JSIDynamic.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + EDEBC734214B45A300DD5AC8 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + EDEBC743214B463000DD5AC8 /* JSINativeModules.cpp in Sources */, + EDEBC744214B463000DD5AC8 /* JSIExecutor.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 1320081B1E283DC300F0C457 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 139D7ECD1E25DB7D00323FB7 /* third-party */; - targetProxy = 1320081A1E283DC300F0C457 /* PBXContainerItemProxy */; - }; 1320081D1E283DCB00F0C457 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 139D7E871E25C6D100323FB7 /* double-conversion */; @@ -4606,11 +4531,6 @@ target = 3D3CD9261DE5FBEE00167DC4 /* cxxreact-tvOS */; targetProxy = 3D0574561DE5FF9600184BB4 /* PBXContainerItemProxy */; }; - 3D383D641EBD27CE005632C8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 3D383D211EBD27B6005632C8 /* third-party-tvOS */; - targetProxy = 3D383D631EBD27CE005632C8 /* PBXContainerItemProxy */; - }; 3D383D661EBD27DB005632C8 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 3D383D3D1EBD27B9005632C8 /* double-conversion-tvOS */; @@ -4621,50 +4541,90 @@ target = 3D3CD9191DE5FBEC00167DC4 /* cxxreact */; targetProxy = 3D3CD94B1DE5FCE700167DC4 /* PBXContainerItemProxy */; }; - 3D3CD9501DE5FDB900167DC4 /* PBXTargetDependency */ = { + 53D123991FBF1E0C001B8A10 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 3D3CD8FF1DE5FBD600167DC4 /* jschelpers */; - targetProxy = 3D3CD94F1DE5FDB900167DC4 /* PBXContainerItemProxy */; + target = 3D3C04B91DE3340900C268FA /* yoga */; + targetProxy = 53D123981FBF1E0C001B8A10 /* PBXContainerItemProxy */; }; - 3DC159E81E83E2A0007B1282 /* PBXTargetDependency */ = { + ED296F7E214C957300B7C4FE /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 3D3CD90C1DE5FBD800167DC4 /* jschelpers-tvOS */; - targetProxy = 3DC159E71E83E2A0007B1282 /* PBXContainerItemProxy */; + target = EDEBC6BA214B3E7000DD5AC8 /* jsi */; + targetProxy = ED296F7D214C957300B7C4FE /* PBXContainerItemProxy */; }; - 53D123991FBF1E0C001B8A10 /* PBXTargetDependency */ = { + ED296F81214C971800B7C4FE /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 3D3C04B91DE3340900C268FA /* yoga */; - targetProxy = 53D123981FBF1E0C001B8A10 /* PBXContainerItemProxy */; + target = EBF21BDD1FC4989A0052F4D5 /* jsinspector-tvOS */; + targetProxy = ED296F80214C971800B7C4FE /* PBXContainerItemProxy */; }; - 9936F3401F5F305D0010BF04 /* PBXTargetDependency */ = { + ED296F97214C996500B7C4FE /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 9936F2F81F5F2E4B0010BF04 /* privatedata */; - targetProxy = 9936F33F1F5F305D0010BF04 /* PBXContainerItemProxy */; + target = 3D383D3D1EBD27B9005632C8 /* double-conversion-tvOS */; + targetProxy = ED296F96214C996500B7C4FE /* PBXContainerItemProxy */; }; - 9936F3421F5F30640010BF04 /* PBXTargetDependency */ = { + ED296FCA214C9B6200B7C4FE /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 9936F3141F5F2E5B0010BF04 /* privatedata-tvOS */; - targetProxy = 9936F3411F5F30640010BF04 /* PBXContainerItemProxy */; + target = ED296F98214C9A0900B7C4FE /* jsi-tvOS */; + targetProxy = ED296FC9214C9B6200B7C4FE /* PBXContainerItemProxy */; }; - 9936F3441F5F30780010BF04 /* PBXTargetDependency */ = { + ED296FF8214C9EAA00B7C4FE /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 9936F2F81F5F2E4B0010BF04 /* privatedata */; - targetProxy = 9936F3431F5F30780010BF04 /* PBXContainerItemProxy */; + target = 3D383D211EBD27B6005632C8 /* third-party-tvOS */; + targetProxy = ED296FF7214C9EAA00B7C4FE /* PBXContainerItemProxy */; }; - 9936F3461F5F30830010BF04 /* PBXTargetDependency */ = { + ED296FFC214C9EC000B7C4FE /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 9936F3141F5F2E5B0010BF04 /* privatedata-tvOS */; - targetProxy = 9936F3451F5F30830010BF04 /* PBXContainerItemProxy */; + target = 3D3CD9261DE5FBEE00167DC4 /* cxxreact-tvOS */; + targetProxy = ED296FFB214C9EC000B7C4FE /* PBXContainerItemProxy */; }; - EBF21C021FC499D10052F4D5 /* PBXTargetDependency */ = { + ED296FFE214C9EC600B7C4FE /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = EBF21BBF1FC498900052F4D5 /* jsinspector */; - targetProxy = EBF21C011FC499D10052F4D5 /* PBXContainerItemProxy */; + target = ED296F98214C9A0900B7C4FE /* jsi-tvOS */; + targetProxy = ED296FFD214C9EC600B7C4FE /* PBXContainerItemProxy */; }; - EBF21C041FC499D80052F4D5 /* PBXTargetDependency */ = { + ED29704E215012C700B7C4FE /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = EBF21BDD1FC4989A0052F4D5 /* jsinspector-tvOS */; - targetProxy = EBF21C031FC499D80052F4D5 /* PBXContainerItemProxy */; + target = 3D383D3D1EBD27B9005632C8 /* double-conversion-tvOS */; + targetProxy = ED29704D215012C700B7C4FE /* PBXContainerItemProxy */; + }; + ED2970662150237300B7C4FE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = ED296FD0214C9CF800B7C4FE /* jsiexecutor-tvOS */; + targetProxy = ED2970652150237300B7C4FE /* PBXContainerItemProxy */; + }; + EDEBC74B214B46A700DD5AC8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = EDEBC724214B45A300DD5AC8 /* jsiexecutor */; + targetProxy = EDEBC74A214B46A700DD5AC8 /* PBXContainerItemProxy */; + }; + EDEBC74F214B477400DD5AC8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = EDEBC6BA214B3E7000DD5AC8 /* jsi */; + targetProxy = EDEBC74E214B477400DD5AC8 /* PBXContainerItemProxy */; + }; + EDEBC7CC214C516800DD5AC8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 139D7E871E25C6D100323FB7 /* double-conversion */; + targetProxy = EDEBC7CB214C516800DD5AC8 /* PBXContainerItemProxy */; + }; + EDEBC7CE214C523F00DD5AC8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3D3CD9191DE5FBEC00167DC4 /* cxxreact */; + targetProxy = EDEBC7CD214C523F00DD5AC8 /* PBXContainerItemProxy */; + }; + EDEBC7D3214C528C00DD5AC8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 139D7ECD1E25DB7D00323FB7 /* third-party */; + targetProxy = EDEBC7D2214C528C00DD5AC8 /* PBXContainerItemProxy */; + }; + EDEBC7D7214C52FD00DD5AC8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 139D7E871E25C6D100323FB7 /* double-conversion */; + targetProxy = EDEBC7D6214C52FD00DD5AC8 /* PBXContainerItemProxy */; + }; + EDEBC7D9214C628300DD5AC8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = EBF21BBF1FC498900052F4D5 /* jsinspector */; + targetProxy = EDEBC7D8214C628300DD5AC8 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -4906,73 +4866,6 @@ }; name = Release; }; - 3D3CD9091DE5FBD600167DC4 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jschelpers; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - 3D3CD90A1DE5FBD600167DC4 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jschelpers; - RUN_CLANG_STATIC_ANALYZER = NO; - }; - name = Release; - }; - 3D3CD9161DE5FBD800167DC4 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = jschelpers; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jschelpers; - SDKROOT = appletvos; - }; - name = Debug; - }; - 3D3CD9171DE5FBD800167DC4 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = jschelpers; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jschelpers; - SDKROOT = appletvos; - }; - name = Release; - }; 3D3CD9231DE5FBEC00167DC4 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; @@ -5207,7 +5100,7 @@ }; name = Release; }; - 9936F3111F5F2E4B0010BF04 /* Debug */ = { + EBF21BDA1FC498900052F4D5 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; buildSettings = { @@ -5216,12 +5109,12 @@ GCC_WARN_ABOUT_MISSING_NEWLINE = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/privatedata; + PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsinspector; RUN_CLANG_STATIC_ANALYZER = YES; }; name = Debug; }; - 9936F3121F5F2E4B0010BF04 /* Release */ = { + EBF21BDB1FC498900052F4D5 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; buildSettings = { @@ -5231,12 +5124,12 @@ GCC_WARN_ABOUT_MISSING_NEWLINE = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/privatedata; + PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsinspector; RUN_CLANG_STATIC_ANALYZER = NO; }; name = Release; }; - 9936F32D1F5F2E5B0010BF04 /* Debug */ = { + EBF21BF81FC4989A0052F4D5 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; buildSettings = { @@ -5250,12 +5143,12 @@ GCC_NO_COMMON_BLOCKS = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/privatedata; + PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsinspector; SDKROOT = appletvos; }; name = Debug; }; - 9936F32E1F5F2E5B0010BF04 /* Release */ = { + EBF21BF91FC4989A0052F4D5 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; buildSettings = { @@ -5269,43 +5162,69 @@ GCC_NO_COMMON_BLOCKS = YES; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/privatedata; + PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsinspector; SDKROOT = appletvos; }; name = Release; }; - EBF21BDA1FC498900052F4D5 /* Debug */ = { + ED296FB4214C9A0900B7C4FE /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; buildSettings = { + CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../third-party/boost_1_63_0", + "$(SRCROOT)/../third-party/folly-2016.10.31.00", + "$(SRCROOT)/../third-party/glog-0.3.5/src", + ); + OTHER_CFLAGS = ( + "-DFOLLY_NO_CONFIG", + "-DFOLLY_MOBILE=1", + "-DFOLLY_USE_LIBCPP=1", + ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsinspector; - RUN_CLANG_STATIC_ANALYZER = YES; + PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsi; + SDKROOT = appletvos; }; name = Debug; }; - EBF21BDB1FC498900052F4D5 /* Release */ = { + ED296FB5214C9A0900B7C4FE /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; buildSettings = { + CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; - CLANG_STATIC_ANALYZER_MODE = deep; - GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; - GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_NO_COMMON_BLOCKS = YES; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../third-party/boost_1_63_0", + "$(SRCROOT)/../third-party/folly-2016.10.31.00", + "$(SRCROOT)/../third-party/glog-0.3.5/src", + ); + OTHER_CFLAGS = ( + "-DFOLLY_NO_CONFIG", + "-DFOLLY_MOBILE=1", + "-DFOLLY_USE_LIBCPP=1", + ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsinspector; - RUN_CLANG_STATIC_ANALYZER = NO; + PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsi; + SDKROOT = appletvos; }; name = Release; }; - EBF21BF81FC4989A0052F4D5 /* Debug */ = { + ED296FEC214C9CF800B7C4FE /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; @@ -5315,16 +5234,25 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_TESTABILITY = YES; GCC_NO_COMMON_BLOCKS = YES; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../third-party/boost_1_63_0", + "$(SRCROOT)/../third-party/folly-2016.10.31.00", + "$(SRCROOT)/../third-party/glog-0.3.5/src", + ); + OTHER_CFLAGS = ( + "-DFOLLY_NO_CONFIG", + "-DFOLLY_MOBILE=1", + "-DFOLLY_USE_LIBCPP=1", + ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsinspector; + PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsireact; SDKROOT = appletvos; }; name = Debug; }; - EBF21BF91FC4989A0052F4D5 /* Release */ = { + ED296FED214C9CF800B7C4FE /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; @@ -5334,13 +5262,81 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_NO_COMMON_BLOCKS = YES; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../third-party/boost_1_63_0", + "$(SRCROOT)/../third-party/folly-2016.10.31.00", + "$(SRCROOT)/../third-party/glog-0.3.5/src", + ); + OTHER_CFLAGS = ( + "-DFOLLY_NO_CONFIG", + "-DFOLLY_MOBILE=1", + "-DFOLLY_USE_LIBCPP=1", + ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; - PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsinspector; + PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsireact; SDKROOT = appletvos; }; name = Release; }; + EDEBC6D4214B3E7000DD5AC8 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_STATIC_ANALYZER_MODE = deep; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsi; + RUN_CLANG_STATIC_ANALYZER = YES; + }; + name = Debug; + }; + EDEBC6D5214B3E7000DD5AC8 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_STATIC_ANALYZER_MODE = deep; + GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsi; + RUN_CLANG_STATIC_ANALYZER = NO; + }; + name = Release; + }; + EDEBC739214B45A300DD5AC8 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_STATIC_ANALYZER_MODE = deep; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsireact; + RUN_CLANG_STATIC_ANALYZER = YES; + }; + name = Debug; + }; + EDEBC73A214B45A300DD5AC8 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 3D788F841EBD2D240063D616 /* third-party.xcconfig */; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "c++14"; + CLANG_STATIC_ANALYZER_MODE = deep; + GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/jsireact; + RUN_CLANG_STATIC_ANALYZER = NO; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -5407,24 +5403,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 3D3CD9081DE5FBD600167DC4 /* Build configuration list for PBXNativeTarget "jschelpers" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3D3CD9091DE5FBD600167DC4 /* Debug */, - 3D3CD90A1DE5FBD600167DC4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3D3CD9151DE5FBD800167DC4 /* Build configuration list for PBXNativeTarget "jschelpers-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3D3CD9161DE5FBD800167DC4 /* Debug */, - 3D3CD9171DE5FBD800167DC4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 3D3CD9221DE5FBEC00167DC4 /* Build configuration list for PBXNativeTarget "cxxreact" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -5461,38 +5439,56 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 9936F3101F5F2E4B0010BF04 /* Build configuration list for PBXNativeTarget "privatedata" */ = { + EBF21BD91FC498900052F4D5 /* Build configuration list for PBXNativeTarget "jsinspector" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + EBF21BDA1FC498900052F4D5 /* Debug */, + EBF21BDB1FC498900052F4D5 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + EBF21BF71FC4989A0052F4D5 /* Build configuration list for PBXNativeTarget "jsinspector-tvOS" */ = { isa = XCConfigurationList; buildConfigurations = ( - 9936F3111F5F2E4B0010BF04 /* Debug */, - 9936F3121F5F2E4B0010BF04 /* Release */, + EBF21BF81FC4989A0052F4D5 /* Debug */, + EBF21BF91FC4989A0052F4D5 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 9936F32C1F5F2E5B0010BF04 /* Build configuration list for PBXNativeTarget "privatedata-tvOS" */ = { + ED296FB3214C9A0900B7C4FE /* Build configuration list for PBXNativeTarget "jsi-tvOS" */ = { isa = XCConfigurationList; buildConfigurations = ( - 9936F32D1F5F2E5B0010BF04 /* Debug */, - 9936F32E1F5F2E5B0010BF04 /* Release */, + ED296FB4214C9A0900B7C4FE /* Debug */, + ED296FB5214C9A0900B7C4FE /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - EBF21BD91FC498900052F4D5 /* Build configuration list for PBXNativeTarget "jsinspector" */ = { + ED296FEB214C9CF800B7C4FE /* Build configuration list for PBXNativeTarget "jsiexecutor-tvOS" */ = { isa = XCConfigurationList; buildConfigurations = ( - EBF21BDA1FC498900052F4D5 /* Debug */, - EBF21BDB1FC498900052F4D5 /* Release */, + ED296FEC214C9CF800B7C4FE /* Debug */, + ED296FED214C9CF800B7C4FE /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - EBF21BF71FC4989A0052F4D5 /* Build configuration list for PBXNativeTarget "jsinspector-tvOS" */ = { + EDEBC6D3214B3E7000DD5AC8 /* Build configuration list for PBXNativeTarget "jsi" */ = { isa = XCConfigurationList; buildConfigurations = ( - EBF21BF81FC4989A0052F4D5 /* Debug */, - EBF21BF91FC4989A0052F4D5 /* Release */, + EDEBC6D4214B3E7000DD5AC8 /* Debug */, + EDEBC6D5214B3E7000DD5AC8 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + EDEBC738214B45A300DD5AC8 /* Build configuration list for PBXNativeTarget "jsiexecutor" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + EDEBC739214B45A300DD5AC8 /* Debug */, + EDEBC73A214B45A300DD5AC8 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index 0fa92ba743b856..901d9c9bb5f801 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -129,7 +129,7 @@ task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy) task downloadJSCHeaders(type: Download) { // in sync with webkit SVN revision 174650 def jscAPIBaseURL = 'https://raw.githubusercontent.com/WebKit/webkit/38b15a3ba3c1b0798f2036f7cea36ffdc096202e/Source/JavaScriptCore/API/' - def jscHeaderFiles = ['JavaScript.h', 'JSBase.h', 'JSContextRef.h', 'JSObjectRef.h', 'JSRetainPtr.h', 'JSStringRef.h', 'JSValueRef.h', 'WebKitAvailability.h'] + def jscHeaderFiles = ['JavaScript.h', 'JSBase.h', 'JSContextRef.h', 'JSObjectRef.h', 'JSStringRef.h', 'JSValueRef.h', 'WebKitAvailability.h'] def output = new File(downloadsDir, 'jsc') output.mkdirs() src(jscHeaderFiles.collect { headerName -> "$jscAPIBaseURL$headerName" }) @@ -221,6 +221,7 @@ task buildReactNdkLib(dependsOn: [prepareJSC, prepareBoost, prepareDoubleConvers "NDK_LIBS_OUT=$buildDir/react-ndk/all", "THIRD_PARTY_NDK_DIR=$buildDir/third-party-ndk", "REACT_COMMON_DIR=$projectDir/../ReactCommon", + "REACT_SRC_DIR=$projectDir/src/main/java/com/facebook/react", '-C', file('src/main/jni/react/jni').absolutePath, '--jobs', project.hasProperty("jobs") ? project.property("jobs") : Runtime.runtime.availableProcessors() } diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK index ce91a2147e9cb9..a66f4368b4dcd6 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK @@ -28,6 +28,8 @@ rn_android_library( react_native_target("java/com/facebook/react/common:common"), react_native_target("java/com/facebook/react/devsupport:interfaces"), react_native_target("java/com/facebook/react/fabric:fabric"), + react_native_target("java/com/facebook/react/fabric/jsi:jsi"), + react_native_target("java/com/facebook/react/jscexecutor:jscexecutor"), react_native_target("java/com/facebook/react/module/annotations:annotations"), react_native_target("java/com/facebook/react/module/model:model"), react_native_target("java/com/facebook/react/modules/core:core"), diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestHelper.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestHelper.java index f0e22fad1cae33..a11a6a3499a529 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestHelper.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestHelper.java @@ -34,8 +34,8 @@ import com.facebook.react.bridge.queue.ReactQueueConfigurationSpec; import com.facebook.react.bridge.CatalystInstanceImpl; import com.facebook.react.bridge.JSBundleLoader; -import com.facebook.react.bridge.JSCJavaScriptExecutorFactory; import com.facebook.react.bridge.JavaScriptExecutor; +import com.facebook.react.jscexecutor.JSCExecutorFactory; import com.facebook.react.modules.core.ReactChoreographer; import com.facebook.react.uimanager.ViewManager; import com.android.internal.util.Predicate; @@ -85,7 +85,7 @@ public CatalystInstance build() { } JavaScriptExecutor executor = null; try { - executor = new JSCJavaScriptExecutorFactory("ReactTestHelperApp", "ReactTestHelperDevice").create(); + executor = new JSCExecutorFactory("ReactTestHelperApp", "ReactTestHelperDevice").create(); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/BUCK b/ReactAndroid/src/main/java/com/facebook/react/BUCK index 426fd4f5de5cdc..8f2c72e8c0454b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/BUCK @@ -22,6 +22,7 @@ rn_android_library( react_native_target("java/com/facebook/react/common:common"), react_native_target("java/com/facebook/react/devsupport:devsupport"), react_native_target("java/com/facebook/react/devsupport:interfaces"), + react_native_target("java/com/facebook/react/jscexecutor:jscexecutor"), react_native_target("java/com/facebook/react/jstasks:jstasks"), react_native_target("java/com/facebook/react/module/annotations:annotations"), react_native_target("java/com/facebook/react/module/model:model"), diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java index f1dbcca7ad46f8..9c458612ad3dd9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java @@ -11,7 +11,6 @@ import android.app.Application; import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.JSBundleLoader; -import com.facebook.react.bridge.JSCJavaScriptExecutorFactory; import com.facebook.react.bridge.JSIModulePackage; import com.facebook.react.bridge.JavaScriptExecutorFactory; import com.facebook.react.bridge.NativeModuleCallExceptionHandler; @@ -20,6 +19,7 @@ import com.facebook.react.devsupport.RedBoxHandler; import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; import com.facebook.react.devsupport.interfaces.DevSupportManager; +import com.facebook.react.jscexecutor.JSCExecutorFactory; import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; import com.facebook.react.packagerconnection.RequestHandler; import java.util.ArrayList; @@ -251,7 +251,7 @@ public ReactInstanceManager build() { mCurrentActivity, mDefaultHardwareBackBtnHandler, mJavaScriptExecutorFactory == null - ? new JSCJavaScriptExecutorFactory(appName, deviceName) + ? new JSCExecutorFactory(appName, deviceName) : mJavaScriptExecutorFactory, (mJSBundleLoader == null && mJSBundleAssetUrl != null) ? JSBundleLoader.createAssetLoader( diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/BUCK b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/BUCK new file mode 100644 index 00000000000000..4300801c18c03a --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/BUCK @@ -0,0 +1,24 @@ +load("//tools/build_defs/oss:rn_defs.bzl", "react_native_dep", "react_native_target", "rn_android_library") + +rn_android_library( + name = "jsi", + srcs = glob(["**/*.java"]), + provided_deps = [ + react_native_dep("third-party/android/support/v4:lib-support-v4"), + ], + required_for_source_only_abi = True, + visibility = [ + "PUBLIC", + ], + deps = [ + react_native_target("java/com/facebook/react/bridge:bridge"), + react_native_dep("libraries/soloader/java/com/facebook/soloader:soloader"), + react_native_dep("third-party/java/infer-annotations:infer-annotations"), + react_native_target("java/com/facebook/react/fabric:fabric"), + react_native_target("java/com/facebook/react/fabric/jsi/jni:jni"), + ], + exported_deps = [ + react_native_dep("java/com/facebook/jni:jni"), + react_native_dep("java/com/facebook/proguard/annotations:annotations"), + ], +) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/FabricJSIBinding.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/FabricJSIBinding.java new file mode 100644 index 00000000000000..fdd76dd69fd7c8 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/FabricJSIBinding.java @@ -0,0 +1,55 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +package com.facebook.fbreact.fabric.jsi; + +import com.facebook.jni.HybridData; +import com.facebook.proguard.annotations.DoNotStrip; +import com.facebook.react.bridge.JavaScriptContextHolder; +import com.facebook.react.bridge.NativeMap; +import com.facebook.react.fabric.FabricBinder; +import com.facebook.react.fabric.FabricBinding; +import com.facebook.soloader.SoLoader; + +@DoNotStrip +public class FabricJSIBinding implements FabricBinding { + + static { + SoLoader.loadLibrary("fabricjsijni"); + } + + // used from native + @SuppressWarnings("unused") + private final HybridData mHybridData; + + private static native HybridData initHybrid(); + + @Override + public native void releaseEventTarget(long jsContextNativePointer, long eventTargetPointer); + + @Override + public native void releaseEventHandler(long jsContextNativePointer, long eventHandlerPointer); + + @Override + public native void dispatchEventToEmptyTarget( + long jsContextNativePointer, long eventHandlerPointer, String type, NativeMap payload); + + @Override + public native void dispatchEventToTarget( + long jsContextNativePointer, + long eventHandlerPointer, + long eventTargetPointer, + String type, + NativeMap payload); + + private native void installFabric(long jsContextNativePointer, Object fabricModule); + + public FabricJSIBinding() { + mHybridData = initHybrid(); + } + + @Override + public void installFabric(JavaScriptContextHolder jsContext, FabricBinder fabricModule) { + fabricModule.setBinding(this); + installFabric(jsContext.get(), fabricModule); + } +} diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/BUCK b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/BUCK new file mode 100644 index 00000000000000..428d6df40e909d --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/BUCK @@ -0,0 +1,23 @@ +load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "FBJNI_TARGET", "react_native_target", "rn_xplat_cxx_library") + +rn_xplat_cxx_library( + name = "jni", + srcs = glob(["*.cpp"]), + headers = glob(["*.h"]), + compiler_flags = [ + "-Wall", + "-fexceptions", + "-std=gnu++1y", + "-frtti", + ], + platforms = ANDROID, + soname = "libfabricjsijni.$(ext)", + visibility = ["PUBLIC"], + deps = [ + FBJNI_TARGET, + react_native_target("jni/react/jni:jni"), + "xplat//folly:molly", + "xplat//jsi:JSIDynamic", + "xplat//jsi:jsi", + ], +) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/FabricJSIBinding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/FabricJSIBinding.cpp new file mode 100644 index 00000000000000..b54e30bdfdcd43 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/FabricJSIBinding.cpp @@ -0,0 +1,316 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#include "FabricJSIBinding.h" +#include +#include +#include + +using namespace facebook::jni; +using namespace facebook::jsi; + +namespace facebook { +namespace react { + +namespace { + +struct JList : public JavaClass { + static constexpr auto kJavaDescriptor = "Ljava/util/List;"; +}; + +struct JShadowNode : public JavaClass { + static constexpr auto kJavaDescriptor = "Lcom/facebook/react/uimanager/ReactShadowNode;"; +}; + +// This wrapper is only needed because JSI doesn't expose its underlying +// raw pointer. It could change implementation details. +struct EventTarget { + // TODO: This will cause a leak. It needs to be a weak reference. + jsi::Object instanceHandle; + EventTarget(jsi::Object instance) : instanceHandle(std::move(instance)) {} +}; + +// This wrapper is only needed because JSI doesn't expose its underlying +// raw pointer. It could change implementation details. +struct EventHandler { + jsi::Function callback; + EventHandler(jsi::Function eventHandler) : callback(std::move(eventHandler)) {} +}; + +// This wrapper is needed since we can only store HostObjects in JSI. +// Ideally we could just store the raw pointer in there along with a +// finalizer specified in the class. Alternatively we could make all +// our shadow nodes C++ objects but that seems unlikely at this point. +struct ShadowViewWrapper : public HostObject { + global_ref node; + + ShadowViewWrapper(alias_ref shadowNode) : node(make_global(shadowNode)) {} +}; + +struct ChildSetWrapper : public HostObject { + global_ref childSet; + + ChildSetWrapper(alias_ref list) : childSet(make_global(list)) {} +}; + +local_ref ValueAsJString(Runtime& runtime, const Value& value) { + std::string str = value.getString(runtime).utf8(runtime); + return make_jstring(str); +} + +local_ref ValueAsReadableMap(Runtime& runtime, const Value& value) { + auto dynamicValue = dynamicFromValue(runtime, value); + return ReadableNativeMap::newObjectCxxArgs(std::move(dynamicValue)); +} + +Value createNode(jni::alias_ref manager, Runtime& runtime, const Value* arguments, size_t count) { + static auto createNode = + jni::findClassStatic("com/facebook/react/fabric/FabricUIManager") + ->getMethod(jint, jstring, jint, ReadableNativeMap::javaobject, jlong)>("createNode"); + + int reactTag = (int)arguments[0].getNumber(); + auto viewName = ValueAsJString(runtime, arguments[1]); + int rootTag = (int)arguments[2].getNumber(); + auto props = arguments[3].isNull() ? local_ref(nullptr) : + ValueAsReadableMap(runtime, arguments[3]); + auto eventTarget = arguments[4].getObject(runtime); + auto eventTargetWrapper = new EventTarget(std::move(eventTarget)); + + auto node = createNode(manager, reactTag, viewName.get(), rootTag, props.get(), (jlong)eventTargetWrapper); + auto wrapper = std::make_unique(node); + + return Object::createFromHostObject(runtime, std::move(wrapper)); +} + +Value cloneNode(jni::alias_ref manager, Runtime& runtime, const Value* arguments, size_t count) { + static auto cloneNode = + jni::findClassStatic("com/facebook/react/fabric/FabricUIManager") + ->getMethod(JShadowNode::javaobject)>("cloneNode"); + + auto previousNode = arguments[0].getObject(runtime).getHostObject(runtime)->node; + auto instance = arguments[1].getObject(runtime); + auto newNode = cloneNode(manager, previousNode.get()); + auto wrapper = std::make_unique(newNode); + + return Object::createFromHostObject(runtime, std::move(wrapper)); +} + +Value cloneNodeWithNewChildren(jni::alias_ref manager, Runtime& runtime, const Value* arguments, size_t count) { + static auto cloneNodeWithNewChildren = + jni::findClassStatic("com/facebook/react/fabric/FabricUIManager") + ->getMethod(JShadowNode::javaobject)>("cloneNodeWithNewChildren"); + + auto previousNode = arguments[0].getObject(runtime).getHostObject(runtime)->node; + auto instance = arguments[1].getObject(runtime); + auto newNode = cloneNodeWithNewChildren(manager, previousNode.get()); + auto wrapper = std::make_unique(newNode); + + return Object::createFromHostObject(runtime, std::move(wrapper)); +} + +Value cloneNodeWithNewProps(jni::alias_ref manager, Runtime& runtime, const Value* arguments, size_t count) { + static auto cloneNodeWithNewProps = + jni::findClassStatic("com/facebook/react/fabric/FabricUIManager") + ->getMethod(JShadowNode::javaobject, ReadableNativeMap::javaobject)>("cloneNodeWithNewProps"); + + auto previousNode = arguments[0].getObject(runtime).getHostObject(runtime)->node; + auto props = ValueAsReadableMap(runtime, arguments[1]); + auto instance = arguments[2].getObject(runtime); + auto newNode = cloneNodeWithNewProps(manager, previousNode.get(), props.get()); + auto wrapper = std::make_unique(newNode); + + return Object::createFromHostObject(runtime, std::move(wrapper)); +} + +Value cloneNodeWithNewChildrenAndProps(jni::alias_ref manager, Runtime& runtime, const Value* arguments, size_t count) { + static auto cloneNodeWithNewChildrenAndProps = + jni::findClassStatic("com/facebook/react/fabric/FabricUIManager") + ->getMethod(JShadowNode::javaobject, ReadableNativeMap::javaobject)>("cloneNodeWithNewChildrenAndProps"); + + auto previousNode = arguments[0].getObject(runtime).getHostObject(runtime)->node; + auto props = ValueAsReadableMap(runtime, arguments[1]); + auto instance = arguments[2].getObject(runtime); + auto newNode = cloneNodeWithNewChildrenAndProps(manager, previousNode.get(), props.get()); + auto wrapper = std::make_unique(newNode); + + return Object::createFromHostObject(runtime, std::move(wrapper)); +} + +Value appendChild(jni::alias_ref manager, Runtime& runtime, const Value* arguments, size_t count) { + static auto appendChild = + jni::findClassStatic("com/facebook/react/fabric/FabricUIManager") + ->getMethod("appendChild"); + + auto parentNode = arguments[0].getObject(runtime).getHostObject(runtime)->node; + auto childNode = arguments[1].getObject(runtime).getHostObject(runtime)->node; + + appendChild(manager, parentNode.get(), childNode.get()); + + return Value::undefined(); +} + +Value createChildSet(jni::alias_ref manager, Runtime& runtime, const Value* arguments, size_t count) { + static auto createChildSet = + jni::findClassStatic("com/facebook/react/fabric/FabricUIManager") + ->getMethod(jint)>("createChildSet"); + + int rootTag = (int)arguments[0].getNumber(); + auto childSet = createChildSet(manager, rootTag); + + return Object::createFromHostObject( + runtime, + std::make_unique(childSet) + ); +} + +Value appendChildToSet(jni::alias_ref manager, Runtime& runtime, const Value* arguments, size_t count) { + static auto appendChildToSet = + jni::findClassStatic("com/facebook/react/fabric/FabricUIManager") + ->getMethod("appendChildToSet"); + + auto childSet = arguments[0].getObject(runtime).getHostObject(runtime)->childSet; + auto childNode = arguments[1].getObject(runtime).getHostObject(runtime)->node; + + appendChildToSet(manager, childSet.get(), childNode.get()); + + return Value::undefined(); +} + +Value completeRoot(jni::alias_ref manager, Runtime& runtime, const Value* arguments, size_t count) { + static auto completeRoot = + jni::findClassStatic("com/facebook/react/fabric/FabricUIManager") + ->getMethod("completeRoot"); + + int rootTag = (int)arguments[0].getNumber(); + auto childSet = arguments[1].getObject(runtime).getHostObject(runtime)->childSet; + + completeRoot(manager, rootTag, childSet.get()); + + return Value::undefined(); +} + +Value registerEventHandler(jni::alias_ref manager, Runtime& runtime, const Value* arguments, size_t count) { + static auto registerEventHandler = + jni::findClassStatic("com/facebook/react/fabric/FabricUIManager") + ->getMethod("registerEventHandler"); + + auto eventHandler = arguments[0].getObject(runtime).getFunction(runtime); + + registerEventHandler(manager, (jlong)new EventHandler(std::move(eventHandler))); + + return Value::undefined(); +} + +typedef Value(*FabricCallback)(jni::alias_ref manager, Runtime& runtime, const Value* arguments, size_t count); + +void addFabricMethod( + jni::alias_ref manager, + Runtime *runtime, + Object *module, + const char *name, + FabricCallback callback +) { + jni::global_ref retainedManager = make_global(manager); + module->setProperty( + *runtime, + name, + Function::createFromHostFunction( + *runtime, + PropNameID::forAscii(*runtime, name), + 1, + [retainedManager, callback] (Runtime& runtime, const Value&, const Value* args, size_t count) { + return callback(retainedManager, runtime, args, count); + } + ) + ); +} + +} + +jni::local_ref FabricJSIBinding::initHybrid( + jni::alias_ref) { + return makeCxxInstance(); +} + +void FabricJSIBinding::releaseEventTarget( + jlong jsContextNativePointer, + jlong eventTargetPointer +) { + EventTarget *target = (EventTarget *)((void *)eventTargetPointer); + delete target; +} + +void FabricJSIBinding::releaseEventHandler( + jlong jsContextNativePointer, + jlong eventHandlerPointer +) { + EventHandler *target = (EventHandler *)((void *)eventHandlerPointer); + delete target; +} + +void FabricJSIBinding::dispatchEventToEmptyTarget( + jlong jsContextNativePointer, + jlong eventHandlerPointer, + std::string type, + NativeMap *payload +) { + Runtime *runtime = (Runtime *)jsContextNativePointer; + auto eventHandler = (EventHandler *)eventHandlerPointer; + eventHandler->callback.call(*runtime, { + jsi::Value::null(), + jsi::String::createFromUtf8(*runtime, type), + jsi::valueFromDynamic(*runtime, payload->consume()) + }); +} + +void FabricJSIBinding::dispatchEventToTarget( + jlong jsContextNativePointer, + jlong eventHandlerPointer, + jlong eventTargetPointer, + std::string type, + NativeMap *payload +) { + Runtime *runtime = (Runtime *)jsContextNativePointer; + auto eventHandler = (EventHandler *)eventHandlerPointer; + auto eventTarget = (EventTarget *)eventTargetPointer; + eventHandler->callback.call(*runtime, { + jsi::Value(*runtime, eventTarget->instanceHandle), + jsi::String::createFromUtf8(*runtime, type), + jsi::valueFromDynamic(*runtime, payload->consume()) + }); +} + +void FabricJSIBinding::installFabric(jlong jsContextNativePointer, + jni::alias_ref fabricUiManager) { + Runtime* runtime = (Runtime*)jsContextNativePointer; + + Object module = Object(*runtime); + + addFabricMethod(fabricUiManager, runtime, &module, "createNode", createNode); + addFabricMethod(fabricUiManager, runtime, &module, "cloneNode", cloneNode); + addFabricMethod(fabricUiManager, runtime, &module, "cloneNodeWithNewChildren", cloneNodeWithNewChildren); + addFabricMethod(fabricUiManager, runtime, &module, "cloneNodeWithNewProps", cloneNodeWithNewProps); + addFabricMethod(fabricUiManager, runtime, &module, "cloneNodeWithNewChildrenAndProps", cloneNodeWithNewChildrenAndProps); + + addFabricMethod(fabricUiManager, runtime, &module, "appendChild", appendChild); + addFabricMethod(fabricUiManager, runtime, &module, "createChildSet", createChildSet); + addFabricMethod(fabricUiManager, runtime, &module, "appendChildToSet", appendChildToSet); + addFabricMethod(fabricUiManager, runtime, &module, "completeRoot", completeRoot); + + addFabricMethod(fabricUiManager, runtime, &module, "registerEventHandler", registerEventHandler); + + runtime->global().setProperty(*runtime, "nativeFabricUIManager", module); +} + +void FabricJSIBinding::registerNatives() { + registerHybrid({ + makeNativeMethod("initHybrid", FabricJSIBinding::initHybrid), + makeNativeMethod("installFabric", FabricJSIBinding::installFabric), + makeNativeMethod("releaseEventTarget", FabricJSIBinding::releaseEventTarget), + makeNativeMethod("releaseEventHandler", FabricJSIBinding::releaseEventHandler), + makeNativeMethod("dispatchEventToEmptyTarget", FabricJSIBinding::dispatchEventToEmptyTarget), + makeNativeMethod("dispatchEventToTarget", FabricJSIBinding::dispatchEventToTarget), + }); +} + +} +} diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/FabricJSIBinding.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/FabricJSIBinding.h new file mode 100644 index 00000000000000..14ccf9760ffe92 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/FabricJSIBinding.h @@ -0,0 +1,49 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#pragma once + +#include +#include +#include + +namespace facebook { +namespace react { + +class Instance; + +class FabricJSIBinding : public jni::HybridClass { +public: + constexpr static const char *const kJavaDescriptor = + "Lcom/facebook/fbreact/fabric/jsi/FabricJSIBinding;"; + + static void registerNatives(); + +private: + + static jni::local_ref initHybrid(jni::alias_ref); + + void releaseEventTarget(jlong jsContextNativePointer, jlong eventTargetPointer); + + void releaseEventHandler(jlong jsContextNativePointer, jlong eventHandlerPointer); + + void dispatchEventToEmptyTarget( + jlong jsContextNativePointer, + jlong eventHandlerPointer, + std::string type, + NativeMap *payload + ); + + void dispatchEventToTarget( + jlong jsContextNativePointer, + jlong eventHandlerPointer, + jlong eventTargetPointer, + std::string type, + NativeMap *payload + ); + + void installFabric(jlong jsContextNativePointer, jni::alias_ref fabricModule); + +}; + +} +} diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/OnLoad.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/OnLoad.cpp new file mode 100644 index 00000000000000..e664d853646db6 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jsi/jni/OnLoad.cpp @@ -0,0 +1,12 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#include +#include + +#include "FabricJSIBinding.h" + +JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) { + return facebook::xplat::initialize(vm, [] { + facebook::react::FabricJSIBinding::registerNatives(); + }); +} diff --git a/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/Android.mk b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/Android.mk new file mode 100644 index 00000000000000..9b7404543b56c5 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/Android.mk @@ -0,0 +1,16 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := jscexecutor + +LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) + +LOCAL_C_INCLUDES := $(LOCAL_PATH) + +LOCAL_CFLAGS += -fvisibility=hidden -fexceptions -frtti + +LOCAL_STATIC_LIBRARIES := libjsi libjsireact +LOCAL_SHARED_LIBRARIES := libfolly_json libfb libreactnativejni + +include $(BUILD_SHARED_LIBRARY) diff --git a/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/BUCK b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/BUCK new file mode 100644 index 00000000000000..7888574707aa94 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/BUCK @@ -0,0 +1,35 @@ +load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "FBJNI_TARGET", "rn_xplat_cxx_library", "react_native_xplat_target", "react_native_target", "react_native_dep", "rn_android_library") + +rn_android_library( + name = "jscexecutor", + srcs = glob(["*.java"]), + visibility = [ + "PUBLIC", + ], + deps = [ + ":jni", + react_native_dep("libraries/soloader/java/com/facebook/soloader:soloader"), + react_native_target("java/com/facebook/react/bridge:bridge"), + ], +) + +rn_xplat_cxx_library( + name = "jni", + srcs = glob(["*.cpp"]), + headers = glob(["*.h"]), + header_namespace = "", + compiler_flags = ["-fexceptions"], + platforms = ANDROID, + fbandroid_allow_jni_merging = True, + soname = "libjscexecutor.$(ext)", + visibility = [ + react_native_target("java/com/facebook/react/jscexecutor:jscexecutor"), + ], + deps = [ + "xplat//folly:molly", + FBJNI_TARGET, + react_native_target("jni/react/jni:jni"), + react_native_xplat_target("jsi:JSCRuntime"), + react_native_xplat_target("jsiexecutor:jsiexecutor"), + ], +) diff --git a/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/JSCExecutor.java b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/JSCExecutor.java new file mode 100644 index 00000000000000..7455dffb402e50 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/JSCExecutor.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2015-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. + */ + +package com.facebook.react.jscexecutor; + +import com.facebook.jni.HybridData; +import com.facebook.proguard.annotations.DoNotStrip; +import com.facebook.react.bridge.JavaScriptExecutor; +import com.facebook.react.bridge.ReadableNativeMap; +import com.facebook.soloader.SoLoader; + +@DoNotStrip +/* package */ class JSCExecutor extends JavaScriptExecutor { + static { + SoLoader.loadLibrary("jscexecutor"); + } + + /* package */ JSCExecutor(ReadableNativeMap jscConfig) { + super(initHybrid(jscConfig)); + } + + @Override + public String getName() { + return "JSCExecutor"; + } + + private static native HybridData initHybrid(ReadableNativeMap jscConfig); +} diff --git a/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/JSCExecutorFactory.java b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/JSCExecutorFactory.java new file mode 100644 index 00000000000000..a71b9bcc8311e9 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/JSCExecutorFactory.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2015-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. + */ + +package com.facebook.react.jscexecutor; + +import com.facebook.react.bridge.JavaScriptExecutor; +import com.facebook.react.bridge.JavaScriptExecutorFactory; +import com.facebook.react.bridge.WritableNativeMap; + +public class JSCExecutorFactory implements JavaScriptExecutorFactory { + private final String mAppName; + private final String mDeviceName; + + public JSCExecutorFactory(String appName, String deviceName) { + this.mAppName = appName; + this.mDeviceName = deviceName; + } + + @Override + public JavaScriptExecutor create() throws Exception { + WritableNativeMap jscConfig = new WritableNativeMap(); + jscConfig.putString("OwnerIdentity", "ReactNative"); + jscConfig.putString("AppIdentity", mAppName); + jscConfig.putString("DeviceIdentity", mDeviceName); + return new JSCExecutor(jscConfig); + } + + @Override + public String toString() { + return "JSIExecutor+JSCRuntime"; + } +} diff --git a/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/OnLoad.cpp b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/OnLoad.cpp new file mode 100644 index 00000000000000..c6f185aacbda96 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/OnLoad.cpp @@ -0,0 +1,70 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace facebook { +namespace react { + +namespace { + +class JSCExecutorFactory : public JSExecutorFactory { +public: + std::unique_ptr createJSExecutor( + std::shared_ptr delegate, + std::shared_ptr jsQueue) override { + return folly::make_unique( + jsc::makeJSCRuntime(), + delegate, + [](const std::string& message, unsigned int logLevel) { + reactAndroidLoggingHook(message, logLevel); + }, + JSIExecutor::defaultTimeoutInvoker, + nullptr); + } +}; + +} + +// This is not like JSCJavaScriptExecutor, which calls JSC directly. This uses +// JSIExecutor with JSCRuntime. +class JSCExecutorHolder + : public jni::HybridClass { + public: + static constexpr auto kJavaDescriptor = "Lcom/facebook/react/jscexecutor/JSCExecutor;"; + + static jni::local_ref initHybrid( + jni::alias_ref, ReadableNativeMap*) { + // This is kind of a weird place for stuff, but there's no other + // good place for initialization which is specific to JSC on + // Android. + JReactMarker::setLogPerfMarkerIfNeeded(); + // TODO mhorowitz T28461666 fill in some missing nice to have glue + return makeCxxInstance(folly::make_unique()); + } + + static void registerNatives() { + registerHybrid({ + makeNativeMethod("initHybrid", JSCExecutorHolder::initHybrid), + }); + } + + private: + friend HybridBase; + using HybridBase::HybridBase; +}; + +} // namespace react +} // namespace facebook + +JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) { + return facebook::jni::initialize(vm, [] { + facebook::react::JSCExecutorHolder::registerNatives(); + }); +} diff --git a/ReactAndroid/src/main/jni/Application.mk b/ReactAndroid/src/main/jni/Application.mk index 7c15b8852cbfc7..0e3d85e32dd6c3 100644 --- a/ReactAndroid/src/main/jni/Application.mk +++ b/ReactAndroid/src/main/jni/Application.mk @@ -5,7 +5,19 @@ APP_PLATFORM := android-16 APP_MK_DIR := $(dir $(lastword $(MAKEFILE_LIST))) -NDK_MODULE_PATH := $(APP_MK_DIR)$(HOST_DIRSEP)$(THIRD_PARTY_NDK_DIR)$(HOST_DIRSEP)$(REACT_COMMON_DIR)$(HOST_DIRSEP)$(APP_MK_DIR)first-party +# What is NDK_MODULE_PATH? +# This is comparable to the PATH environment variable in Linux. The purpose +# of NDK_MODULE_PATH is to provide a list of directories that contain modules +# we want ndk-build to compile. +# +# What is HOST_DIRSEP? +# In PATH, the directories are separated by a ':'. +# In NDK_MODULE_PATH, the directories are separated by $(HOST_DIRSEP). +# +# Where are APP_MK_DIR, THIRD_PARTY_NDK_DIR, etc. defined? +# The directories inside NDK_MODULE_PATH (ex: APP_MK_DIR, THIRD_PARTY_NDK_DIR, +# etc.) are defined inside build.gradle. +NDK_MODULE_PATH := $(APP_MK_DIR)$(HOST_DIRSEP)$(THIRD_PARTY_NDK_DIR)$(HOST_DIRSEP)$(REACT_COMMON_DIR)$(HOST_DIRSEP)$(APP_MK_DIR)first-party$(HOST_DIRSEP)$(REACT_SRC_DIR) APP_STL := gnustl_shared diff --git a/ReactAndroid/src/main/jni/react/jni/Android.mk b/ReactAndroid/src/main/jni/react/jni/Android.mk index 5fce5384bdb059..d76dd0fc2052db 100644 --- a/ReactAndroid/src/main/jni/react/jni/Android.mk +++ b/ReactAndroid/src/main/jni/react/jni/Android.mk @@ -2,47 +2,61 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE := reactnativejni - -LOCAL_SRC_FILES := \ - AndroidJSCFactory.cpp \ - CatalystInstanceImpl.cpp \ - CxxModuleWrapper.cpp \ - JavaModuleWrapper.cpp \ - JReactMarker.cpp \ - JMessageQueueThread.cpp \ - JSCPerfLogging.cpp \ - JSLoader.cpp \ - JSLogging.cpp \ - JniJSModulesUnbundle.cpp \ - MethodInvoker.cpp \ - ModuleRegistryBuilder.cpp \ - NativeArray.cpp \ - NativeCommon.cpp \ - NativeDeltaClient.cpp \ - NativeMap.cpp \ - OnLoad.cpp \ - ProxyExecutor.cpp \ - ReadableNativeArray.cpp \ - ReadableNativeMap.cpp \ - WritableNativeArray.cpp \ - WritableNativeMap.cpp \ - +# Include . in the header search path for all source files in this module. LOCAL_C_INCLUDES := $(LOCAL_PATH) + +# Include ./../../ in the header search path for modules that depend on +# reactnativejni. This will allow external modules to require this module's +# headers using #include .h>, assuming: +# . == jni +# ./../ == react LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../.. -LOCAL_CFLAGS += -fvisibility=hidden -fexceptions -frtti +LOCAL_CFLAGS += -fexceptions -frtti LOCAL_LDLIBS += -landroid -LOCAL_SHARED_LIBRARIES := libfolly_json libfb libjsc libglog_init libyoga libprivatedata + +# The dynamic libraries (.so files) that this module depends on. +LOCAL_SHARED_LIBRARIES := libfolly_json libfb libjsc libglog_init libyoga + +# The static libraries (.a files) that this module depends on. LOCAL_STATIC_LIBRARIES := libreactnative +# Name of this module. +# +# Other modules can depend on this one by adding libreactnativejni to their +# LOCAL_SHARED_LIBRARIES variable. +LOCAL_MODULE := reactnativejni + +# Compile all local c++ files. +LOCAL_SRC_FILES := $(wildcard *.cpp) + +# Build the files in this directory as a shared library include $(BUILD_SHARED_LIBRARY) -$(call import-module,cxxreact) -$(call import-module,privatedata) -$(call import-module,fb) -$(call import-module,fbgloginit) +# Compile the c++ dependencies required for ReactAndroid +# +# How does the import-module function work? +# For each $(call import-module,), you search the directories in +# NDK_MODULE_PATH. (This variable is defined in Application.mk). If you find a +# /Android.mk you in a directory

, you run: +# include //Android.mk +# +# What does it mean to include an Android.mk file? +# Whenever you encounter an include //Android.mk, you +# tell andorid-ndk to compile the module in / according +# to the specification inside //Android.mk. $(call import-module,folly) +$(call import-module,fb) $(call import-module,jsc) +$(call import-module,fbgloginit) $(call import-module,yogajni) +$(call import-module,cxxreact) +$(call import-module,jsi) +$(call import-module,jsiexecutor) + +# TODO(ramanpreet): +# Why doesn't this import-module call generate a jscexecutor.so file? +# $(call import-module,jscexecutor) + +include $(REACT_SRC_DIR)/jscexecutor/Android.mk diff --git a/ReactAndroid/src/main/jni/react/jni/AndroidJSCFactory.cpp b/ReactAndroid/src/main/jni/react/jni/AndroidJSCFactory.cpp deleted file mode 100644 index 54b208a48d06b1..00000000000000 --- a/ReactAndroid/src/main/jni/react/jni/AndroidJSCFactory.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include "JSCPerfLogging.h" -#include "JSLogging.h" -#include "JReactMarker.h" - -using namespace facebook::jni; - -namespace facebook { -namespace react { - -namespace { - -ExceptionHandling::ExtractedEror extractJniError(const std::exception& ex, const char *context) { - auto jniEx = dynamic_cast(&ex); - if (!jniEx) { - return {}; - } - - auto stackTrace = jniEx->getThrowable()->getStackTrace(); - std::ostringstream stackStr; - for (int i = 0, count = stackTrace->size(); i < count; ++i) { - auto frame = stackTrace->getElement(i); - - auto methodName = folly::to(frame->getClassName(), ".", - frame->getMethodName()); - - // Cut off stack traces at the Android looper, to keep them simple - if (methodName == "android.os.Looper.loop") { - break; - } - - stackStr << std::move(methodName) << '@' << frame->getFileName(); - if (frame->getLineNumber() > 0) { - stackStr << ':' << frame->getLineNumber(); - } - stackStr << std::endl; - } - - auto msg = folly::to("Java exception in '", context, "'\n\n", jniEx->what()); - return {.message = msg, .stack = stackStr.str()}; -} - -JSValueRef nativePerformanceNow( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], JSValueRef *exception) { - static const int64_t NANOSECONDS_IN_SECOND = 1000000000LL; - static const int64_t NANOSECONDS_IN_MILLISECOND = 1000000LL; - - // Since SystemClock.uptimeMillis() is commonly used for performance measurement in Java - // and uptimeMillis() internally uses clock_gettime(CLOCK_MONOTONIC), - // we use the same API here. - // We need that to make sure we use the same time system on both JS and Java sides. - // Links to the source code: - // https://android.googlesource.com/platform/frameworks/native/+/jb-mr1-release/libs/utils/SystemClock.cpp - // https://android.googlesource.com/platform/system/core/+/master/libutils/Timers.cpp - struct timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); - int64_t nano = now.tv_sec * NANOSECONDS_IN_SECOND + now.tv_nsec; - return Value::makeNumber(ctx, (nano / (double)NANOSECONDS_IN_MILLISECOND)); -} - -JSValueRef nativeLoggingHook( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - android_LogPriority logLevel = ANDROID_LOG_DEBUG; - if (argumentCount > 1) { - int level = (int)Value(ctx, arguments[1]).asNumber(); - // The lowest log level we get from JS is 0. We shift and cap it to be - // in the range the Android logging method expects. - logLevel = std::min( - static_cast(level + ANDROID_LOG_DEBUG), - ANDROID_LOG_FATAL); - } - if (argumentCount > 0) { - String message = Value(ctx, arguments[0]).toString(); - reactAndroidLoggingHook(message.str(), logLevel); - } - return Value::makeUndefined(ctx); -} - -} - -namespace detail { - -void injectJSCExecutorAndroidPlatform() { - // Inject some behavior into react/ - JReactMarker::setLogPerfMarkerIfNeeded(); - ExceptionHandling::platformErrorExtractor = extractJniError; - JSCNativeHooks::loggingHook = nativeLoggingHook; - JSCNativeHooks::nowHook = nativePerformanceNow; - JSCNativeHooks::installPerfHooks = addNativePerfLoggingHooks; -} - -} - -std::unique_ptr makeAndroidJSCExecutorFactory( - const folly::dynamic& jscConfig) { - detail::injectJSCExecutorAndroidPlatform(); - return folly::make_unique(std::move(jscConfig)); -} - -} -} diff --git a/ReactAndroid/src/main/jni/react/jni/AndroidJSCFactory.h b/ReactAndroid/src/main/jni/react/jni/AndroidJSCFactory.h deleted file mode 100644 index a71632262b49a5..00000000000000 --- a/ReactAndroid/src/main/jni/react/jni/AndroidJSCFactory.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -namespace folly { - -class dynamic; - -} - -namespace facebook { -namespace react { - -class JSExecutorFactory; - -namespace detail { - -// This is only exposed so instrumentation tests can call it. -void injectJSCExecutorAndroidPlatform(); - -} - -std::unique_ptr makeAndroidJSCExecutorFactory( - const folly::dynamic& jscConfig); - -} -} diff --git a/ReactAndroid/src/main/jni/react/jni/BUCK b/ReactAndroid/src/main/jni/react/jni/BUCK index 8a9dac25e78285..d679a640324523 100644 --- a/ReactAndroid/src/main/jni/react/jni/BUCK +++ b/ReactAndroid/src/main/jni/react/jni/BUCK @@ -1,7 +1,6 @@ -load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "ANDROID_JSC_DEPS", "APPLE_JSC_DEPS", "FBJNI_TARGET", "IS_OSS_BUILD", "react_native_xplat_target", "rn_xplat_cxx_library") +load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "ANDROID_JSC_DEPS", "APPLE_JSC_DEPS", "FBJNI_TARGET", "IS_OSS_BUILD", "react_native_xplat_dep", "react_native_xplat_target", "rn_xplat_cxx_library") EXPORTED_HEADERS = [ - "AndroidJSCFactory.h", "CxxModuleWrapper.h", "CxxModuleWrapperBase.h", "CxxSharedModuleWrapper.h", @@ -54,11 +53,13 @@ rn_xplat_cxx_library( ], deps = ([ "xplat//third-party/linker_lib:android", + "xplat//third-party/linker_lib:atomic", "xplat//folly:molly", "fbandroid//xplat/fbgloginit:fbgloginit", "xplat//fbsystrace:fbsystrace", react_native_xplat_target("cxxreact:bridge"), react_native_xplat_target("cxxreact:module"), + react_native_xplat_dep("jsi:jsi"), FBJNI_TARGET, ]) if not IS_OSS_BUILD else [], ) diff --git a/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.cpp b/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.cpp index 1937b1d4a7f6cc..65924c37e1ad14 100644 --- a/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.cpp @@ -8,11 +8,10 @@ #include #include +#include #include #include -#include - -#include +#include #include "JNativeRunnable.h" @@ -35,8 +34,10 @@ std::function wrapRunnable(std::function&& runnable) { return [runnable=std::move(runnable)] { try { runnable(); - } catch (const JSException& ex) { - throwNewJavaException(JavaJSException::create(ex.what(), ex.getStack().c_str(), ex).get()); + } catch (const jsi::JSError& ex) { + throwNewJavaException( + JavaJSException::create(ex.getMessage().c_str(), ex.getStack().c_str(), ex) + .get()); } }; } diff --git a/ReactAndroid/src/main/jni/react/jni/JSCPerfLogging.cpp b/ReactAndroid/src/main/jni/react/jni/JSCPerfLogging.cpp deleted file mode 100644 index 5d1dd553dc9d6c..00000000000000 --- a/ReactAndroid/src/main/jni/react/jni/JSCPerfLogging.cpp +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "JSCPerfLogging.h" - -#include - -#include -#include - -using namespace facebook::jni; - -namespace facebook { namespace react { - -struct JQuickPerformanceLogger : JavaClass { - static auto constexpr kJavaDescriptor = "Lcom/facebook/quicklog/QuickPerformanceLogger;"; - - void markerStart(int markerId, int instanceKey, long timestamp) { - static auto markerStartMethod = - javaClassStatic()->getMethod("markerStart"); - markerStartMethod(self(), markerId, instanceKey, timestamp); - } - - void markerEnd(int markerId, int instanceKey, short actionId, long timestamp) { - static auto markerEndMethod = - javaClassStatic()->getMethod("markerEnd"); - markerEndMethod(self(), markerId, instanceKey, actionId, timestamp); - } - - void markerTag(int markerId, int instanceKey, alias_ref tag) { - static auto markerTagMethod = - javaClassStatic()->getMethod)>("markerTag"); - markerTagMethod(self(), markerId, instanceKey, tag); - } - - void markerAnnotate( - int markerId, - int instanceKey, - alias_ref key, - alias_ref value) { - static auto markerAnnotateMethod = javaClassStatic()-> - getMethod, alias_ref)>("markerAnnotate"); - markerAnnotateMethod(self(), markerId, instanceKey, key, value); - } - - void markerNote(int markerId, int instanceKey, short actionId, long timestamp) { - static auto markerNoteMethod = - javaClassStatic()->getMethod("markerNote"); - markerNoteMethod(self(), markerId, instanceKey, actionId, timestamp); - } - - void markerCancel(int markerId, int instanceKey) { - static auto markerCancelMethod = - javaClassStatic()->getMethod("markerCancel"); - markerCancelMethod(self(), markerId, instanceKey); - } - - int64_t currentMonotonicTimestamp() { - static auto currentTimestampMethod = - javaClassStatic()->getMethod("currentMonotonicTimestamp"); - return currentTimestampMethod(self()); - } - - void markerPoint(int markerId, alias_ref name, int instanceKey) { - static auto markerPointMethod = - javaClassStatic()->getMethod)>("markerPoint"); - markerPointMethod(self(), markerId, instanceKey, name); - } -}; - -struct JQuickPerformanceLoggerProvider : JavaClass { - static auto constexpr kJavaDescriptor = "Lcom/facebook/quicklog/QuickPerformanceLoggerProvider;"; - - static alias_ref get() { - static auto getQPLInstMethod = - javaClassStatic()->getStaticMethod("getQPLInstance"); - static auto logger = make_global(getQPLInstMethod(javaClassStatic())); - return logger; - } -}; - -static bool isReady() { - static bool ready = false; - if (!ready) { - try { - // TODO: findClassStatic only does the lookup once. If we can't find - // QuickPerformanceLoggerProvider the first time we call this, we will always fail here. - findClassStatic("com/facebook/quicklog/QuickPerformanceLoggerProvider"); - } catch(...) { - // Swallow this exception - we don't want to crash the app, an error is enough. - FBLOGE("Calling QPL from JS before class has been loaded in Java. Ignored."); - return false; - } - if (JQuickPerformanceLoggerProvider::get()) { - ready = true; - } else { - FBLOGE("Calling QPL from JS before it has been initialized in Java. Ignored."); - return false; - } - } - return ready; -} - -// After having read the implementation of PNaN that is returned from JSValueToNumber, and some -// more material on how NaNs are constructed, I think this is the most consistent way to verify -// NaN with how we generate it. -// Once the integration completes, I'll play around with it some more and potentially change this -// implementation to use std::isnan() if it is exactly commensurate with our usage. -static bool isNan(double value) { - return (value != value); -} - -static double grabDouble( - JSContextRef ctx, - const JSValueRef arguments[], - size_t argumentIndex, - JSValueRef* exception) { - return JSValueToNumber(ctx, arguments[argumentIndex], exception); -} - -// Safely translates JSValues to an array of doubles. -static bool grabDoubles( - size_t targetsCount, - double targets[], - JSContextRef ctx, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - if (argumentCount < targetsCount) { - return false; - } - for (size_t i = 0 ; i < targetsCount ; i++) { - targets[i] = grabDouble(ctx, arguments, i, exception); - if (isNan(targets[i])) { - return false; - } - } - return true; -} - -static local_ref getJStringFromJSValueRef(JSContextRef ctx, JSValueRef ref) { - JSStringRef jsStringRef = JSValueToStringCopy(ctx, ref, nullptr); - const JSChar* chars = JSStringGetCharactersPtr(jsStringRef); - const size_t length = JSStringGetLength(jsStringRef); - local_ref returnStr = adopt_local(Environment::current()->NewString(chars, length)); - JSStringRelease(jsStringRef); - return returnStr; -} - -static JSValueRef nativeQPLMarkerStart( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - double targets[3]; - if (isReady() && grabDoubles(3, targets, ctx, argumentCount, arguments, exception)) { - int32_t markerId = (int32_t) targets[0]; - int32_t instanceKey = (int32_t) targets[1]; - int64_t timestamp = (int64_t) targets[2]; - JQuickPerformanceLoggerProvider::get()->markerStart(markerId, instanceKey, timestamp); - } - return JSValueMakeUndefined(ctx); -} - -static JSValueRef nativeQPLMarkerEnd( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - double targets[4]; - if (isReady() && grabDoubles(4, targets, ctx, argumentCount, arguments, exception)) { - int32_t markerId = (int32_t) targets[0]; - int32_t instanceKey = (int32_t) targets[1]; - // NOTE: avoid undefined behavior when the value does not find in int16_t. - int16_t actionId = (int16_t) (int32_t) targets[2]; - int64_t timestamp = (int64_t) targets[3]; - JQuickPerformanceLoggerProvider::get()->markerEnd(markerId, instanceKey, actionId, timestamp); - } - return JSValueMakeUndefined(ctx); -} - -static JSValueRef nativeQPLMarkerTag( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - double targets[2]; - if (isReady() && grabDoubles(2, targets, ctx, argumentCount, arguments, exception)) { - int32_t markerId = (int32_t) targets[0]; - int32_t instanceKey = (int32_t) targets[1]; - local_ref tag = getJStringFromJSValueRef(ctx, arguments[2]); - JQuickPerformanceLoggerProvider::get()->markerTag(markerId, instanceKey, tag); - } - return JSValueMakeUndefined(ctx); -} - -static JSValueRef nativeQPLMarkerAnnotate( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - double targets[2]; - if (isReady() && grabDoubles(2, targets, ctx, argumentCount, arguments, exception)) { - int32_t markerId = (int32_t) targets[0]; - int32_t instanceKey = (int32_t) targets[1]; - local_ref key = getJStringFromJSValueRef(ctx, arguments[2]); - local_ref value = getJStringFromJSValueRef(ctx, arguments[3]); - JQuickPerformanceLoggerProvider::get()->markerAnnotate(markerId, instanceKey, key, value); - } - return JSValueMakeUndefined(ctx); -} - -static JSValueRef nativeQPLMarkerNote( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - double targets[4]; - if (isReady() && grabDoubles(4, targets, ctx, argumentCount, arguments, exception)) { - int32_t markerId = (int32_t) targets[0]; - int32_t instanceKey = (int32_t) targets[1]; - // NOTE: avoid undefined behavior when the value does not find in int16_t. - int16_t actionId = (int16_t) (int32_t) targets[2]; - int64_t timestamp = (int64_t) targets[3]; - JQuickPerformanceLoggerProvider::get()->markerNote(markerId, instanceKey, actionId, timestamp); - } - return JSValueMakeUndefined(ctx); -} - -static JSValueRef nativeQPLMarkerCancel( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - double targets[2]; - if (isReady() && grabDoubles(2, targets, ctx, argumentCount, arguments, exception)) { - int32_t markerId = (int32_t) targets[0]; - int32_t instanceKey = (int32_t) targets[1]; - JQuickPerformanceLoggerProvider::get()->markerCancel(markerId, instanceKey); - } - return JSValueMakeUndefined(ctx); -} - -static JSValueRef nativeQPLTimestamp( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - if (!isReady()) { - return JSValueMakeNumber(ctx, 0); - } - int64_t timestamp = JQuickPerformanceLoggerProvider::get()->currentMonotonicTimestamp(); - // Since this is monotonic time, I assume the 52 bits of mantissa are enough in the double value. - return JSValueMakeNumber(ctx, timestamp); -} - -static JSValueRef nativeQPLMarkerPoint( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - if (isReady() && argumentCount == 4) { - double markerIdArgument = grabDouble(ctx, arguments, 0, exception); - double instanceKeyArgument = grabDouble(ctx, arguments, 2, exception); - if (isNan(markerIdArgument) || isNan(instanceKeyArgument)) { - return JSValueMakeUndefined(ctx); - } - - int32_t markerId = (int32_t) markerIdArgument; - local_ref name = getJStringFromJSValueRef(ctx, arguments[1]); - int32_t instanceKey = (int32_t) instanceKeyArgument; - // timestamp is not used as QuickPerformanceLogger::markerPoint with all - // params is missing - JQuickPerformanceLoggerProvider::get()->markerPoint(markerId, name, instanceKey); - } - return JSValueMakeUndefined(ctx); -} - -void addNativePerfLoggingHooks(JSGlobalContextRef ctx) { - installGlobalFunction(ctx, "nativeQPLMarkerStart", nativeQPLMarkerStart); - installGlobalFunction(ctx, "nativeQPLMarkerEnd", nativeQPLMarkerEnd); - installGlobalFunction(ctx, "nativeQPLMarkerTag", nativeQPLMarkerTag); - installGlobalFunction(ctx, "nativeQPLMarkerAnnotate", nativeQPLMarkerAnnotate); - installGlobalFunction(ctx, "nativeQPLMarkerNote", nativeQPLMarkerNote); - installGlobalFunction(ctx, "nativeQPLMarkerCancel", nativeQPLMarkerCancel); - installGlobalFunction(ctx, "nativeQPLTimestamp", nativeQPLTimestamp); - installGlobalFunction(ctx, "nativeQPLMarkerPoint", nativeQPLMarkerPoint); -} - -} } diff --git a/ReactAndroid/src/main/jni/react/jni/JSCPerfLogging.h b/ReactAndroid/src/main/jni/react/jni/JSCPerfLogging.h deleted file mode 100644 index 5a103febe6ae6d..00000000000000 --- a/ReactAndroid/src/main/jni/react/jni/JSCPerfLogging.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include - -namespace facebook { -namespace react { - -void addNativePerfLoggingHooks(JSGlobalContextRef ctx); - -} } diff --git a/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp b/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp index 290a61f9aa2f57..20b134a5c84375 100644 --- a/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp +++ b/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp @@ -9,7 +9,6 @@ #include #include -#include "AndroidJSCFactory.h" #include "CatalystInstanceImpl.h" #include "CxxModuleWrapper.h" #include "JavaScriptExecutorHolder.h" @@ -30,27 +29,6 @@ namespace react { namespace { -// TODO: can we avoid these wrapper classes, and instead specialize the logic in CatalystInstanceImpl -class JSCJavaScriptExecutorHolder : public HybridClass { - public: - static constexpr auto kJavaDescriptor = "Lcom/facebook/react/bridge/JSCJavaScriptExecutor;"; - - static local_ref initHybrid(alias_ref, ReadableNativeMap* jscConfig) { - return makeCxxInstance(makeAndroidJSCExecutorFactory(jscConfig->consume())); - } - - static void registerNatives() { - registerHybrid({ - makeNativeMethod("initHybrid", JSCJavaScriptExecutorHolder::initHybrid), - }); - } - - private: - friend HybridBase; - using HybridBase::HybridBase; -}; - struct JavaJSExecutor : public JavaClass { static constexpr auto kJavaDescriptor = "Lcom/facebook/react/bridge/JavaJSExecutor;"; }; @@ -83,7 +61,6 @@ class ProxyJavaScriptExecutorHolder : public HybridClass -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "JSBigString.h" -#include "JSBundleType.h" -#include "JSCLegacyTracing.h" -#include "JSCMemory.h" -#include "JSCPerfStats.h" -#include "JSCSamplingProfiler.h" -#include "JSCTracing.h" -#include "JSCUtils.h" -#include "JSModulesUnbundle.h" -#include "MessageQueueThread.h" -#include "ModuleRegistry.h" -#include "Platform.h" -#include "RAMBundleRegistry.h" -#include "RecoverableError.h" -#include "SystraceSection.h" - -#if defined(WITH_FB_JSC_TUNING) && defined(__ANDROID__) -#include -#endif - -namespace facebook { -namespace react { - -namespace { - -template -inline JSObjectCallAsFunctionCallback exceptionWrapMethod() { - struct funcWrapper { - static JSValueRef call( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - try { - auto executor = Object::getGlobalObject(ctx).getPrivate(); - if (executor && - executor->getJavaScriptContext()) { // Executor not invalidated - return (executor->*method)(argumentCount, arguments); - } - } catch (...) { - *exception = translatePendingCppExceptionToJSError(ctx, function); - } - return Value::makeUndefined(ctx); - } - }; - - return &funcWrapper::call; -} - -template -inline JSObjectGetPropertyCallback exceptionWrapMethod() { - struct funcWrapper { - static JSValueRef call( - JSContextRef ctx, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception) { - try { - auto executor = Object::getGlobalObject(ctx).getPrivate(); - if (executor && - executor->getJavaScriptContext()) { // Executor not invalidated - return (executor->*method)(object, propertyName); - } - } catch (...) { - *exception = translatePendingCppExceptionToJSError(ctx, object); - } - return Value::makeUndefined(ctx); - } - }; - - return &funcWrapper::call; -} - -} // namespace - -#if DEBUG -static JSValueRef nativeInjectHMRUpdate( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - String execJSString = Value(ctx, arguments[0]).toString(); - String jsURL = Value(ctx, arguments[1]).toString(); - evaluateScript(ctx, execJSString, jsURL); - return Value::makeUndefined(ctx); -} -#endif - -std::unique_ptr JSCExecutorFactory::createJSExecutor( - std::shared_ptr delegate, - std::shared_ptr jsQueue) { - return folly::make_unique( - delegate, jsQueue, m_jscConfig); -} - -JSCExecutor::JSCExecutor( - std::shared_ptr delegate, - std::shared_ptr messageQueueThread, - const folly::dynamic& jscConfig) throw(JSException) - : m_delegate(delegate), - m_messageQueueThread(messageQueueThread), - m_nativeModules(delegate ? delegate->getModuleRegistry() : nullptr), - m_jscConfig(jscConfig) { - initOnJSVMThread(); - - { - SystraceSection s("nativeModuleProxy object"); - installGlobalProxy( - m_context, - "nativeModuleProxy", - exceptionWrapMethod<&JSCExecutor::getNativeModule>()); - } -} - -JSCExecutor::~JSCExecutor() { - CHECK(*m_isDestroyed) - << "JSCExecutor::destroy() must be called before its destructor!"; -} - -void JSCExecutor::destroy() { - *m_isDestroyed = true; - if (m_messageQueueThread.get()) { - m_messageQueueThread->runOnQueueSync([this]() { terminateOnJSVMThread(); }); - } else { - terminateOnJSVMThread(); - } -} - -void JSCExecutor::setContextName(const std::string& name) { - String jsName = String(m_context, name.c_str()); - JSC_JSGlobalContextSetName(m_context, jsName); -} - -static bool canUseInspector(JSContextRef context) { -#ifdef WITH_INSPECTOR -#if defined(__APPLE__) - return isCustomJSCPtr(context); // WITH_INSPECTOR && Apple -#else - return true; // WITH_INSPECTOR && Android -#endif -#else - return false; // !WITH_INSPECTOR -#endif -} - -static bool canUseSamplingProfiler(JSContextRef context) { -#if defined(__APPLE__) || defined(WITH_JSC_EXTRA_TRACING) - return JSC_JSSamplingProfilerEnabled(context); -#else - return false; -#endif -} - -void JSCExecutor::initOnJSVMThread() throw(JSException) { - SystraceSection s("JSCExecutor::initOnJSVMThread"); - -#if defined(__APPLE__) - const bool useCustomJSC = - m_jscConfig.getDefault("UseCustomJSC", false).getBool(); - if (useCustomJSC) { - JSC_configureJSCForIOS(true, toJson(m_jscConfig)); - } -#else - const bool useCustomJSC = false; -#endif - -#if defined(WITH_FB_JSC_TUNING) && defined(__ANDROID__) - configureJSCForAndroid(m_jscConfig); -#endif - - // Create a custom global class, so we can store data in it later using - // JSObjectSetPrivate - JSClassRef globalClass = nullptr; - { - SystraceSection s_("JSClassCreate"); - JSClassDefinition definition = kJSClassDefinitionEmpty; - definition.attributes |= kJSClassAttributeNoAutomaticPrototype; - globalClass = JSC_JSClassCreate(useCustomJSC, &definition); - } - { - SystraceSection s_("JSGlobalContextCreateInGroup"); - m_context = - JSC_JSGlobalContextCreateInGroup(useCustomJSC, nullptr, globalClass); - } - JSC_JSClassRelease(useCustomJSC, globalClass); - - // Add a pointer to ourselves so we can retrieve it later in our hooks - Object::getGlobalObject(m_context).setPrivate(this); - - if (canUseInspector(m_context)) { - const std::string ownerId = - m_jscConfig.getDefault("OwnerIdentity", "unknown").getString(); - const std::string appId = - m_jscConfig.getDefault("AppIdentity", "unknown").getString(); - const std::string deviceId = - m_jscConfig.getDefault("DeviceIdentity", "unknown").getString(); - auto checkIsInspectedRemote = [ownerId, appId, deviceId]() { - return isNetworkInspected(ownerId, appId, deviceId); - }; - - auto& globalInspector = facebook::react::getInspectorInstance(); - JSC_JSGlobalContextEnableDebugger( - m_context, globalInspector, ownerId.c_str(), checkIsInspectedRemote); - } - - installNativeHook<&JSCExecutor::nativeFlushQueueImmediate>( - "nativeFlushQueueImmediate"); - installNativeHook<&JSCExecutor::nativeCallSyncHook>("nativeCallSyncHook"); - - installGlobalFunction( - m_context, "nativeLoggingHook", JSCNativeHooks::loggingHook); - installGlobalFunction( - m_context, "nativePerformanceNow", JSCNativeHooks::nowHook); - -#if DEBUG - installGlobalFunction( - m_context, "nativeInjectHMRUpdate", nativeInjectHMRUpdate); -#endif - - addNativeTracingHooks(m_context); - addNativeTracingLegacyHooks(m_context); - addJSCMemoryHooks(m_context); - addJSCPerfStatsHooks(m_context); - - JSCNativeHooks::installPerfHooks(m_context); - - if (canUseSamplingProfiler(m_context)) { - initSamplingProfilerOnMainJSCThread(m_context); - } -} - -bool JSCExecutor::isNetworkInspected( - const std::string& owner, - const std::string& app, - const std::string& device) { -#ifdef WITH_FB_DBG_ATTACH_BEFORE_EXEC - auto connect_socket = [](int socket_desc, std::string address, int port) { - if (socket_desc < 0) { - ::close(socket_desc); - return false; - } - - struct timeval tv; - tv.tv_sec = 1; - tv.tv_usec = 0; - auto sock_opt_rcv_resp = setsockopt( - socket_desc, - SOL_SOCKET, - SO_RCVTIMEO, - (const char*)&tv, - sizeof(struct timeval)); - if (sock_opt_rcv_resp < 0) { - ::close(socket_desc); - return false; - } - - auto sock_opt_snd_resp = setsockopt( - socket_desc, - SOL_SOCKET, - SO_SNDTIMEO, - (const char*)&tv, - sizeof(struct timeval)); - if (sock_opt_snd_resp < 0) { - ::close(socket_desc); - return false; - } - - struct sockaddr_in server; - server.sin_addr.s_addr = inet_addr(address.c_str()); - server.sin_family = AF_INET; - server.sin_port = htons(port); - auto connect_resp = - ::connect(socket_desc, (struct sockaddr*)&server, sizeof(server)); - if (connect_resp < 0) { - ::close(socket_desc); - return false; - } - - return true; - }; - - int socket_desc = socket(AF_INET, SOCK_STREAM, 0); - - if (!connect_socket(socket_desc, "127.0.0.1", 8082)) { -#if defined(__ANDROID__) - socket_desc = socket(AF_INET, SOCK_STREAM, 0); - if (!connect_socket(socket_desc, "10.0.2.2", 8082) /* emulator */) { - socket_desc = socket(AF_INET, SOCK_STREAM, 0); - if (!connect_socket(socket_desc, "10.0.3.2", 8082) /* genymotion */) { - return false; - } - } -#else //! defined(__ANDROID__) - return false; -#endif // defined(__ANDROID__) - } - - std::string escapedOwner = - folly::uriEscape(owner, folly::UriEscapeMode::QUERY); - std::string escapedApp = - folly::uriEscape(app, folly::UriEscapeMode::QUERY); - std::string escapedDevice = - folly::uriEscape(device, folly::UriEscapeMode::QUERY); - std::string msg = folly::to( - "GET /autoattach?title=", - escapedOwner, - "&app=", - escapedApp, - "&device=", - escapedDevice, - " HTTP/1.1\r\n\r\n"); - auto send_resp = ::send(socket_desc, msg.c_str(), msg.length(), 0); - if (send_resp < 0) { - ::close(socket_desc); - return false; - } - - char server_reply[200]; - server_reply[199] = '\0'; - auto recv_resp = - ::recv(socket_desc, server_reply, sizeof(server_reply) - 1, 0); - if (recv_resp < 0) { - ::close(socket_desc); - return false; - } - - std::string response(server_reply); - if (response.size() < 25) { - ::close(socket_desc); - return false; - } - auto responseCandidate = response.substr(response.size() - 25); - auto found = - responseCandidate.find("{\"autoattach\":true}") != std::string::npos; - ::close(socket_desc); - return found; -#else //! WITH_FB_DBG_ATTACH_BEFORE_EXEC - return false; -#endif // WITH_FB_DBG_ATTACH_BEFORE_EXEC -} - -void JSCExecutor::terminateOnJSVMThread() { - JSGlobalContextRef context = m_context; - m_context = nullptr; - Object::getGlobalObject(context).setPrivate(nullptr); - m_nativeModules.reset(); - - if (canUseInspector(context)) { - auto& globalInspector = facebook::react::getInspectorInstance(); - JSC_JSGlobalContextDisableDebugger(context, globalInspector); - } - - JSC_JSGlobalContextRelease(context); -} - -#ifdef WITH_FBJSCEXTENSIONS -static const char* explainLoadSourceStatus(JSLoadSourceStatus status) { - switch (status) { - case JSLoadSourceIsCompiled: - return "No error encountered during source load"; - - case JSLoadSourceErrorOnRead: - return "Error reading source"; - - case JSLoadSourceIsNotCompiled: - return "Source is not compiled"; - - case JSLoadSourceErrorVersionMismatch: - return "Source version not supported"; - - default: - return "Bad error code"; - } -} -#endif - -// basename_r isn't in all iOS SDKs, so use this simple version instead. -static std::string simpleBasename(const std::string& path) { - size_t pos = path.rfind("/"); - return (pos != std::string::npos) ? path.substr(pos) : path; -} - -void JSCExecutor::loadApplicationScript( - std::unique_ptr script, - std::string sourceURL) { - SystraceSection s( - "JSCExecutor::loadApplicationScript", "sourceURL", sourceURL); - - std::string scriptName = simpleBasename(sourceURL); - ReactMarker::logTaggedMarker( - ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str()); - String jsSourceURL(m_context, sourceURL.c_str()); - -// TODO t15069155: reduce the number of overrides here -#ifdef WITH_FBJSCEXTENSIONS - if (auto fileStr = dynamic_cast(script.get())) { - JSContextLock lock(m_context); - JSLoadSourceStatus jsStatus; - auto bcSourceCode = JSCreateSourceCodeFromFile( - fileStr->fd(), jsSourceURL, nullptr, &jsStatus); - - switch (jsStatus) { - case JSLoadSourceIsCompiled: - if (!bcSourceCode) { - throw std::runtime_error("Unexpected error opening compiled bundle"); - } - evaluateSourceCode(m_context, bcSourceCode, jsSourceURL); - - flush(); - - ReactMarker::logMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP); - ReactMarker::logTaggedMarker( - ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str()); - return; - - case JSLoadSourceErrorVersionMismatch: - throw RecoverableError(explainLoadSourceStatus(jsStatus)); - - case JSLoadSourceErrorOnRead: - case JSLoadSourceIsNotCompiled: - // Not bytecode, fall through. - break; - } - } -#elif defined(__APPLE__) - BundleHeader header; - memcpy( - &header, script->c_str(), std::min(script->size(), sizeof(BundleHeader))); - auto scriptTag = parseTypeFromHeader(header); - - if (scriptTag == ScriptTag::BCBundle) { - using file_ptr = std::unique_ptr; - file_ptr source(fopen(sourceURL.c_str(), "r"), fclose); - int sourceFD = fileno(source.get()); - - JSValueRef jsError; - JSValueRef result = JSC_JSEvaluateBytecodeBundle( - m_context, NULL, sourceFD, jsSourceURL, &jsError); - if (result == nullptr) { - throw JSException(m_context, jsError, jsSourceURL); - } - } else -#endif - { - String jsScript; - JSContextLock lock(m_context); - { - SystraceSection s_( - "JSCExecutor::loadApplicationScript-createExpectingAscii"); - ReactMarker::logMarker(ReactMarker::JS_BUNDLE_STRING_CONVERT_START); - jsScript = adoptString(std::move(script)); - ReactMarker::logMarker(ReactMarker::JS_BUNDLE_STRING_CONVERT_STOP); - } - - SystraceSection s_("JSCExecutor::loadApplicationScript-evaluateScript"); - evaluateScript(m_context, jsScript, jsSourceURL); - } - - flush(); - - ReactMarker::logMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP); - ReactMarker::logTaggedMarker( - ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str()); -} - -void JSCExecutor::setBundleRegistry( - std::unique_ptr bundleRegistry) { - if (!m_bundleRegistry) { - installNativeHook<&JSCExecutor::nativeRequire>("nativeRequire"); - } - m_bundleRegistry = std::move(bundleRegistry); -} - -void JSCExecutor::registerBundle( - uint32_t bundleId, - const std::string& bundlePath) { - if (m_bundleRegistry) { - m_bundleRegistry->registerBundle(bundleId, bundlePath); - } else { - auto stPath = JSCExecutor::getSyntheticBundlePath(bundleId, bundlePath); - auto sourceUrlStr = String(m_context, stPath.c_str()); - auto source = adoptString(JSBigFileString::fromPath(bundlePath)); - evaluateScript(m_context, source, sourceUrlStr); - } -} - -void JSCExecutor::bindBridge() throw(JSException) { - SystraceSection s("JSCExecutor::bindBridge"); - std::call_once(m_bindFlag, [this] { - auto global = Object::getGlobalObject(m_context); - auto batchedBridgeValue = global.getProperty("__fbBatchedBridge"); - if (batchedBridgeValue.isUndefined()) { - auto requireBatchedBridge = - global.getProperty("__fbRequireBatchedBridge"); - if (!requireBatchedBridge.isUndefined()) { - batchedBridgeValue = requireBatchedBridge.asObject().callAsFunction({}); - } - if (batchedBridgeValue.isUndefined()) { - throw JSException( - "Could not get BatchedBridge, make sure your bundle is packaged correctly"); - } - } - - auto batchedBridge = batchedBridgeValue.asObject(); - m_callFunctionReturnFlushedQueueJS = - batchedBridge.getProperty("callFunctionReturnFlushedQueue").asObject(); - m_invokeCallbackAndReturnFlushedQueueJS = - batchedBridge.getProperty("invokeCallbackAndReturnFlushedQueue") - .asObject(); - m_flushedQueueJS = batchedBridge.getProperty("flushedQueue").asObject(); - m_callFunctionReturnResultAndFlushedQueueJS = - batchedBridge.getProperty("callFunctionReturnResultAndFlushedQueue") - .asObject(); - }); -} - -void JSCExecutor::callNativeModules(Value&& value) { - SystraceSection s("JSCExecutor::callNativeModules"); - // If this fails, you need to pass a fully functional delegate with a - // module registry to the factory/ctor. - CHECK(m_delegate) << "Attempting to use native modules without a delegate"; - try { - auto calls = value.toJSONString(); - m_delegate->callNativeModules(*this, folly::parseJson(calls), true); - } catch (...) { - std::string message = "Error in callNativeModules()"; - try { - message += ":" + value.toString().str(); - } catch (...) { - // ignored - } - std::throw_with_nested(std::runtime_error(message)); - } -} - -void JSCExecutor::flush() { - SystraceSection s("JSCExecutor::flush"); - - if (m_flushedQueueJS) { - callNativeModules(m_flushedQueueJS->callAsFunction({})); - return; - } - - // When a native module is called from JS, BatchedBridge.enqueueNativeCall() - // is invoked. For that to work, require('BatchedBridge') has to be called, - // and when that happens, __fbBatchedBridge is set as a side effect. - auto global = Object::getGlobalObject(m_context); - auto batchedBridgeValue = global.getProperty("__fbBatchedBridge"); - // So here, if __fbBatchedBridge doesn't exist, then we know no native calls - // have happened, and we were able to determine this without forcing - // BatchedBridge to be loaded as a side effect. - if (!batchedBridgeValue.isUndefined()) { - // If calls were made, we bind to the JS bridge methods, and use them to - // get the pending queue of native calls. - bindBridge(); - callNativeModules(m_flushedQueueJS->callAsFunction({})); - } else if (m_delegate) { - // If we have a delegate, we need to call it; we pass a null list to - // callNativeModules, since we know there are no native calls, without - // calling into JS again. If no calls were made and there's no delegate, - // nothing happens, which is correct. - callNativeModules(Value::makeNull(m_context)); - } -} - -void JSCExecutor::callFunction( - const std::string& moduleId, - const std::string& methodId, - const folly::dynamic& arguments) { - SystraceSection s("JSCExecutor::callFunction"); - // This weird pattern is because Value is not default constructible. - // The lambda is inlined, so there's no overhead. - auto result = [&] { - JSContextLock lock(m_context); - try { - if (!m_callFunctionReturnResultAndFlushedQueueJS) { - bindBridge(); - } - return m_callFunctionReturnFlushedQueueJS->callAsFunction( - {Value(m_context, String::createExpectingAscii(m_context, moduleId)), - Value(m_context, String::createExpectingAscii(m_context, methodId)), - Value::fromDynamic(m_context, std::move(arguments))}); - } catch (...) { - std::throw_with_nested( - std::runtime_error("Error calling " + moduleId + "." + methodId)); - } - }(); - callNativeModules(std::move(result)); -} - -void JSCExecutor::invokeCallback( - const double callbackId, - const folly::dynamic& arguments) { - SystraceSection s("JSCExecutor::invokeCallback"); - auto result = [&] { - JSContextLock lock(m_context); - try { - if (!m_invokeCallbackAndReturnFlushedQueueJS) { - bindBridge(); - } - return m_invokeCallbackAndReturnFlushedQueueJS->callAsFunction( - {Value::makeNumber(m_context, callbackId), - Value::fromDynamic(m_context, std::move(arguments))}); - } catch (...) { - std::throw_with_nested(std::runtime_error( - folly::to("Error invoking callback ", callbackId))); - } - }(); - callNativeModules(std::move(result)); -} - -void JSCExecutor::setGlobalVariable( - std::string propName, - std::unique_ptr jsonValue) { - try { - SystraceSection s("JSCExecutor::setGlobalVariable", "propName", propName); - auto valueToInject = Value::fromJSON(adoptString(std::move(jsonValue))); - Object::getGlobalObject(m_context).setProperty( - propName.c_str(), valueToInject); - } catch (...) { - std::throw_with_nested( - std::runtime_error("Error setting global variable: " + propName)); - } -} - -std::string JSCExecutor::getDescription() { -#if defined(__APPLE__) - if (isCustomJSCPtr(m_context)) { - return "Custom JSC"; - } else { - return "System JSC"; - } -#else - return "JSC"; -#endif -} - -String JSCExecutor::adoptString(std::unique_ptr script) { -#if defined(WITH_FBJSCEXTENSIONS) - const JSBigString* string = script.release(); - auto jsString = JSStringCreateAdoptingExternal( - string->c_str(), string->size(), (void*)string, [](void* s) { - delete static_cast(s); - }); - return String::adopt(m_context, jsString); -#else - return script->isAscii() - ? String::createExpectingAscii(m_context, script->c_str(), script->size()) - : String(m_context, script->c_str()); -#endif -} - -void* JSCExecutor::getJavaScriptContext() { - return m_context; -} - -bool JSCExecutor::isInspectable() { - return canUseInspector(m_context); -} - -void JSCExecutor::handleMemoryPressure(int pressureLevel) { -#ifdef WITH_JSC_MEMORY_PRESSURE - JSHandleMemoryPressure( - this, m_context, static_cast(pressureLevel)); -#endif -} - -void JSCExecutor::flushQueueImmediate(Value&& queue) { - auto queueStr = queue.toJSONString(); - m_delegate->callNativeModules(*this, folly::parseJson(queueStr), false); -} - -void JSCExecutor::loadModule(uint32_t bundleId, uint32_t moduleId) { - auto module = m_bundleRegistry->getModule(bundleId, moduleId); - auto sourceUrl = String::createExpectingAscii(m_context, module.name); - auto source = adoptString( - std::unique_ptr(new JSBigStdString(module.code))); - evaluateScript(m_context, source, sourceUrl); -} - -// Native JS hooks -template -void JSCExecutor::installNativeHook(const char* name) { - installGlobalFunction(m_context, name, exceptionWrapMethod()); -} - -JSValueRef JSCExecutor::getNativeModule( - JSObjectRef object, - JSStringRef propertyName) { - if (JSC_JSStringIsEqualToUTF8CString(m_context, propertyName, "name")) { - return Value(m_context, String(m_context, "NativeModules")); - } - - return m_nativeModules.getModule(m_context, propertyName); -} - -JSValueRef JSCExecutor::nativeRequire( - size_t count, - const JSValueRef arguments[]) { - if (count > 2 || count == 0) { - throw std::invalid_argument("Got wrong number of args"); - } - - uint32_t moduleId = - folly::to(Value(m_context, arguments[0]).getNumberOrThrow()); - uint32_t bundleId = count == 2 - ? folly::to(Value(m_context, arguments[1]).getNumberOrThrow()) - : 0; - - ReactMarker::logMarker(ReactMarker::NATIVE_REQUIRE_START); - loadModule(bundleId, moduleId); - ReactMarker::logMarker(ReactMarker::NATIVE_REQUIRE_STOP); - return Value::makeUndefined(m_context); -} - -JSValueRef JSCExecutor::nativeFlushQueueImmediate( - size_t argumentCount, - const JSValueRef arguments[]) { - if (argumentCount != 1) { - throw std::invalid_argument("Got wrong number of args"); - } - - flushQueueImmediate(Value(m_context, arguments[0])); - return Value::makeUndefined(m_context); -} - -JSValueRef JSCExecutor::nativeCallSyncHook( - size_t argumentCount, - const JSValueRef arguments[]) { - if (argumentCount != 3) { - throw std::invalid_argument("Got wrong number of args"); - } - - unsigned int moduleId = Value(m_context, arguments[0]).asUnsignedInteger(); - unsigned int methodId = Value(m_context, arguments[1]).asUnsignedInteger(); - folly::dynamic args = - folly::parseJson(Value(m_context, arguments[2]).toJSONString()); - - if (!args.isArray()) { - throw std::invalid_argument(folly::to( - "method parameters should be array, but are ", args.typeName())); - } - - MethodCallResult result = m_delegate->callSerializableNativeHook( - *this, moduleId, methodId, std::move(args)); - if (!result.hasValue()) { - return Value::makeUndefined(m_context); - } - return Value::fromDynamic(m_context, result.value()); -} - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/cxxreact/JSCExecutor.h b/ReactCommon/cxxreact/JSCExecutor.h deleted file mode 100644 index 5c75fcce87d2c9..00000000000000 --- a/ReactCommon/cxxreact/JSCExecutor.h +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef RN_EXPORT -#define RN_EXPORT __attribute__((visibility("default"))) -#endif - -namespace facebook { -namespace react { - -class MessageQueueThread; -class RAMBundleRegistry; - -class RN_EXPORT JSCExecutorFactory : public JSExecutorFactory { -public: - JSCExecutorFactory(const folly::dynamic& jscConfig) : - m_jscConfig(jscConfig) {} - std::unique_ptr createJSExecutor( - std::shared_ptr delegate, - std::shared_ptr jsQueue) override; -private: - std::string m_cacheDir; - folly::dynamic m_jscConfig; -}; - -template -struct JSCValueEncoder { - // If you get a build error here, it means the compiler can't see the template instantation of toJSCValue - // applicable to your type. - static const Value toJSCValue(JSGlobalContextRef ctx, T&& value); -}; - -template<> -struct JSCValueEncoder { - static const Value toJSCValue(JSGlobalContextRef ctx, const folly::dynamic &&value) { - return Value::fromDynamic(ctx, value); - } -}; - -class RN_EXPORT JSCExecutor : public JSExecutor, public PrivateDataBase { -public: - /** - * Must be invoked from thread this Executor will run on. - */ - explicit JSCExecutor(std::shared_ptr delegate, - std::shared_ptr messageQueueThread, - const folly::dynamic& jscConfig) throw(JSException); - ~JSCExecutor() override; - - virtual void loadApplicationScript( - std::unique_ptr script, - std::string sourceURL) override; - - virtual void setBundleRegistry(std::unique_ptr bundleRegistry) override; - virtual void registerBundle(uint32_t bundleId, const std::string& bundlePath) override; - - virtual void callFunction( - const std::string& moduleId, - const std::string& methodId, - const folly::dynamic& arguments) override; - - virtual void invokeCallback( - const double callbackId, - const folly::dynamic& arguments) override; - - virtual void setGlobalVariable( - std::string propName, - std::unique_ptr jsonValue) override; - - virtual std::string getDescription() override; - - virtual void* getJavaScriptContext() override; - - virtual bool isInspectable() override; - - virtual void handleMemoryPressure(int pressureLevel) override; - - virtual void destroy() override; - - void setContextName(const std::string& name); - -private: - JSGlobalContextRef m_context; - std::shared_ptr m_delegate; - std::shared_ptr m_isDestroyed = std::shared_ptr(new bool(false)); - std::shared_ptr m_messageQueueThread; - std::unique_ptr m_bundleRegistry; - JSCNativeModules m_nativeModules; - folly::dynamic m_jscConfig; - std::once_flag m_bindFlag; - - folly::Optional m_invokeCallbackAndReturnFlushedQueueJS; - folly::Optional m_callFunctionReturnFlushedQueueJS; - folly::Optional m_flushedQueueJS; - folly::Optional m_callFunctionReturnResultAndFlushedQueueJS; - - void initOnJSVMThread() throw(JSException); - static bool isNetworkInspected(const std::string &owner, const std::string &app, const std::string &device); - void terminateOnJSVMThread(); - void bindBridge() throw(JSException); - void callNativeModules(Value&&); - void flush(); - void flushQueueImmediate(Value&&); - void loadModule(uint32_t bundleId, uint32_t moduleId); - - String adoptString(std::unique_ptr); - - template - void installNativeHook(const char* name); - - JSValueRef getNativeModule(JSObjectRef object, JSStringRef propertyName); - - JSValueRef nativeRequire( - size_t argumentCount, - const JSValueRef arguments[]); - JSValueRef nativeFlushQueueImmediate( - size_t argumentCount, - const JSValueRef arguments[]); - JSValueRef nativeCallSyncHook( - size_t argumentCount, - const JSValueRef arguments[]); -}; - -} } diff --git a/ReactCommon/cxxreact/JSCLegacyTracing.cpp b/ReactCommon/cxxreact/JSCLegacyTracing.cpp deleted file mode 100644 index bf91c333de5ca6..00000000000000 --- a/ReactCommon/cxxreact/JSCLegacyTracing.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "JSCLegacyTracing.h" - -#if defined(WITH_JSC_EXTRA_TRACING) - -#include -#include -#include -#include - -static const char *ENABLED_FBSYSTRACE_PROFILE_NAME = "__fbsystrace__"; - -using namespace facebook::react; - -static int64_t int64FromJSValue(JSContextRef ctx, JSValueRef value, JSValueRef* exception) { - return static_cast(JSC_JSValueToNumber(ctx, value, exception)); -} - -static JSValueRef nativeTraceBeginLegacy( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - if (FBSYSTRACE_LIKELY(argumentCount >= 1)) { - uint64_t tag = int64FromJSValue(ctx, arguments[0], exception); - if (!fbsystrace_is_tracing(tag)) { - return Value::makeUndefined(ctx); - } - } - - JSStartProfiling(ctx, String(ctx, ENABLED_FBSYSTRACE_PROFILE_NAME), true); - - return Value::makeUndefined(ctx); -} - -static JSValueRef nativeTraceEndLegacy( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - if (FBSYSTRACE_LIKELY(argumentCount >= 1)) { - uint64_t tag = int64FromJSValue(ctx, arguments[0], exception); - if (!fbsystrace_is_tracing(tag)) { - return Value::makeUndefined(ctx); - } - } - - JSEndProfiling(ctx, String(ctx, ENABLED_FBSYSTRACE_PROFILE_NAME)); - - return Value::makeUndefined(ctx); -} - -#endif - -namespace facebook { -namespace react { - -void addNativeTracingLegacyHooks(JSGlobalContextRef ctx) { -#if defined(WITH_JSC_EXTRA_TRACING) - installGlobalFunction(ctx, "nativeTraceBeginLegacy", nativeTraceBeginLegacy); - installGlobalFunction(ctx, "nativeTraceEndLegacy", nativeTraceEndLegacy); -#endif -} - -} } diff --git a/ReactCommon/cxxreact/JSCLegacyTracing.h b/ReactCommon/cxxreact/JSCLegacyTracing.h deleted file mode 100644 index fa57d584494a07..00000000000000 --- a/ReactCommon/cxxreact/JSCLegacyTracing.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include - -namespace facebook { -namespace react { - -void addNativeTracingLegacyHooks(JSGlobalContextRef ctx); - -} } diff --git a/ReactCommon/cxxreact/JSCMemory.cpp b/ReactCommon/cxxreact/JSCMemory.cpp deleted file mode 100644 index 1b1e252dee7f66..00000000000000 --- a/ReactCommon/cxxreact/JSCMemory.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "JSCMemory.h" - -#ifdef WITH_FB_MEMORY_PROFILING - -#include -#include -#include -#include -#include - -using namespace facebook::react; - -static JSValueRef nativeCaptureHeap( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - if (argumentCount < 1) { - if (exception) { - *exception = Value::makeError( - ctx, - "nativeCaptureHeap requires the path to save the capture"); - } - return Value::makeUndefined(ctx); - } - - auto outputFilename = Value(ctx, arguments[0]).toString(); - JSCaptureHeap(ctx, outputFilename.str().c_str(), exception); - return Value::makeUndefined(ctx); -} - -#endif // WITH_FB_MEMORY_PROFILING - -namespace facebook { -namespace react { - -void addJSCMemoryHooks(JSGlobalContextRef ctx) { -#ifdef WITH_FB_MEMORY_PROFILING - installGlobalFunction(ctx, "nativeCaptureHeap", nativeCaptureHeap); -#endif // WITH_FB_MEMORY_PROFILING -} - -} } diff --git a/ReactCommon/cxxreact/JSCMemory.h b/ReactCommon/cxxreact/JSCMemory.h deleted file mode 100644 index 110fe917751562..00000000000000 --- a/ReactCommon/cxxreact/JSCMemory.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include - -namespace facebook { -namespace react { - -void addJSCMemoryHooks(JSGlobalContextRef ctx); - -} } diff --git a/ReactCommon/cxxreact/JSCNativeModules.cpp b/ReactCommon/cxxreact/JSCNativeModules.cpp deleted file mode 100644 index 4ad35dbe2d6b25..00000000000000 --- a/ReactCommon/cxxreact/JSCNativeModules.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "JSCNativeModules.h" - -#include - -#include "ModuleRegistry.h" -#include "ReactMarker.h" - -namespace facebook { -namespace react { - -JSCNativeModules::JSCNativeModules(std::shared_ptr moduleRegistry) : - m_moduleRegistry(std::move(moduleRegistry)) {} - -JSValueRef JSCNativeModules::getModule(JSContextRef context, JSStringRef jsName) { - if (!m_moduleRegistry) { - return nullptr; - } - - std::string moduleName = String::ref(context, jsName).str(); - - const auto it = m_objects.find(moduleName); - if (it != m_objects.end()) { - return static_cast(it->second); - } - - auto module = createModule(moduleName, context); - if (!module.hasValue()) { - // Allow lookup to continue in the objects own properties, which allows for overrides of NativeModules - return nullptr; - } - - // Protect since we'll be holding on to this value, even though JS may not - module->makeProtected(); - - auto result = m_objects.emplace(std::move(moduleName), std::move(*module)).first; - return static_cast(result->second); -} - -void JSCNativeModules::reset() { - m_genNativeModuleJS = nullptr; - m_objects.clear(); -} - -folly::Optional JSCNativeModules::createModule(const std::string& name, JSContextRef context) { - ReactMarker::logTaggedMarker(ReactMarker::NATIVE_MODULE_SETUP_START, name.c_str()); - - if (!m_genNativeModuleJS) { - auto global = Object::getGlobalObject(context); - m_genNativeModuleJS = global.getProperty("__fbGenNativeModule").asObject(); - m_genNativeModuleJS->makeProtected(); - } - - auto result = m_moduleRegistry->getConfig(name); - if (!result.hasValue()) { - return nullptr; - } - - Value moduleInfo = m_genNativeModuleJS->callAsFunction({ - Value::fromDynamic(context, result->config), - Value::makeNumber(context, result->index) - }); - CHECK(!moduleInfo.isNull()) << "Module returned from genNativeModule is null"; - - folly::Optional module(moduleInfo.asObject().getProperty("module").asObject()); - - ReactMarker::logTaggedMarker(ReactMarker::NATIVE_MODULE_SETUP_STOP, name.c_str()); - - return module; -} - -} } diff --git a/ReactCommon/cxxreact/JSCNativeModules.h b/ReactCommon/cxxreact/JSCNativeModules.h deleted file mode 100644 index 6f61263518cf49..00000000000000 --- a/ReactCommon/cxxreact/JSCNativeModules.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -#include -#include - -namespace facebook { -namespace react { - -class ModuleRegistry; - -/** - * Holds and creates JS representations of the modules in ModuleRegistry - */ -class JSCNativeModules { - -public: - explicit JSCNativeModules(std::shared_ptr moduleRegistry); - JSValueRef getModule(JSContextRef context, JSStringRef name); - void reset(); - -private: - folly::Optional m_genNativeModuleJS; - std::shared_ptr m_moduleRegistry; - std::unordered_map m_objects; - - folly::Optional createModule(const std::string& name, JSContextRef context); -}; - -} -} diff --git a/ReactCommon/cxxreact/JSCPerfStats.cpp b/ReactCommon/cxxreact/JSCPerfStats.cpp deleted file mode 100644 index 95a71e22b40f65..00000000000000 --- a/ReactCommon/cxxreact/JSCPerfStats.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "JSCPerfStats.h" - -#ifdef JSC_HAS_PERF_STATS_API - -#include - -#include -#include - -#include -#include -#include - -using namespace facebook::react; - -static uint64_t toMillis(struct timeval tv) { - return tv.tv_sec * 1000ULL + tv.tv_usec / 1000ULL; -} - -static JSValueRef nativeGetProcessPerfStats( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - struct rusage usage{}; - if (getrusage(RUSAGE_SELF, &usage) != 0) { - return Value::makeUndefined(ctx); - } - - auto result = Object::create(ctx); - uint64_t cpu_time_ms = toMillis(usage.ru_utime) + toMillis(usage.ru_stime); - result.setProperty("major_faults", Value::makeNumber(ctx, usage.ru_majflt)); - result.setProperty("minor_faults", Value::makeNumber(ctx, usage.ru_minflt)); - result.setProperty("cpu_time_ms", Value::makeNumber(ctx, cpu_time_ms)); - result.setProperty("input_blocks", Value::makeNumber(ctx, usage.ru_inblock)); - result.setProperty("output_blocks", Value::makeNumber(ctx, usage.ru_oublock)); - return static_cast(result); -} - -static JSValueRef nativeGetHeapStats( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - JSHeapStats heapStats = {0}; - JSGetHeapStats(ctx, &heapStats); - - auto result = Object::create(ctx); - result.setProperty("size", Value::makeNumber(ctx, heapStats.size)); - result.setProperty("extra_size", Value::makeNumber(ctx, heapStats.extraSize)); - result.setProperty("capacity", Value::makeNumber(ctx, heapStats.capacity)); - result.setProperty("object_count", Value::makeNumber(ctx, heapStats.objectCount)); - result.setProperty("object_size", Value::makeNumber(ctx, heapStats.objectSizeAfterLastCollect)); - result.setProperty("object_capacity", Value::makeNumber(ctx, heapStats.objectCapacityAfterLastCollect)); - result.setProperty("block_size", Value::makeNumber(ctx, heapStats.blockSize)); - result.setProperty("malloc_size", Value::makeNumber(ctx, heapStats.mallocSize)); - return static_cast(result); -} - -static JSValueRef nativeGetGCStats( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - JSGCStats gcStats = {0}; - JSGetGCStats(ctx, &gcStats); - - auto result = Object::create(ctx); - result.setProperty("last_full_gc_length", Value::makeNumber(ctx, gcStats.lastFullGCLength)); - result.setProperty("last_eden_gc_length", Value::makeNumber(ctx, gcStats.lastEdenGCLength)); - return static_cast(result); -} - -#endif - -namespace facebook { -namespace react { - -void addJSCPerfStatsHooks(JSGlobalContextRef ctx) { -#ifdef JSC_HAS_PERF_STATS_API - installGlobalFunction(ctx, "nativeGetProcessPerfStats", nativeGetProcessPerfStats); - installGlobalFunction(ctx, "nativeGetHeapStats", nativeGetHeapStats); - installGlobalFunction(ctx, "nativeGetGCStats", nativeGetGCStats); -#endif -} - -} } diff --git a/ReactCommon/cxxreact/JSCPerfStats.h b/ReactCommon/cxxreact/JSCPerfStats.h deleted file mode 100644 index d4a682eb3f6bbd..00000000000000 --- a/ReactCommon/cxxreact/JSCPerfStats.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include - -namespace facebook { -namespace react { - -void addJSCPerfStatsHooks(JSGlobalContextRef ctx); - -} } diff --git a/ReactCommon/cxxreact/JSCSamplingProfiler.cpp b/ReactCommon/cxxreact/JSCSamplingProfiler.cpp deleted file mode 100644 index 3fb5d74a462b07..00000000000000 --- a/ReactCommon/cxxreact/JSCSamplingProfiler.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "JSCSamplingProfiler.h" - -#include - -static JSValueRef pokeSamplingProfiler( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - return JSC_JSPokeSamplingProfiler(ctx); -} - -namespace facebook { -namespace react { - -void initSamplingProfilerOnMainJSCThread(JSGlobalContextRef ctx) { - JSC_JSStartSamplingProfilingOnMainJSCThread(ctx); - - // Allow the profiler to be poked from JS as well - // (see SamplingProfiler.js for an example of how it could be used with the JSCSamplingProfiler module). - installGlobalFunction(ctx, "pokeSamplingProfiler", pokeSamplingProfiler); -} - -} } diff --git a/ReactCommon/cxxreact/JSCSamplingProfiler.h b/ReactCommon/cxxreact/JSCSamplingProfiler.h deleted file mode 100644 index 78b2267b555616..00000000000000 --- a/ReactCommon/cxxreact/JSCSamplingProfiler.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include - -namespace facebook { -namespace react { - -void initSamplingProfilerOnMainJSCThread(JSGlobalContextRef ctx); - -} } diff --git a/ReactCommon/cxxreact/JSCTracing.cpp b/ReactCommon/cxxreact/JSCTracing.cpp deleted file mode 100644 index 0c08705b922158..00000000000000 --- a/ReactCommon/cxxreact/JSCTracing.cpp +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "JSCTracing.h" - -#if defined(WITH_FBSYSTRACE) && (defined(WITH_JSC_EXTRA_TRACING) || DEBUG) -#define USE_JSCTRACING 1 -#else -#define USE_JSCTRACING 0 -#endif - -#if USE_JSCTRACING - -#include -#include -#include -#include - -#include -#include -#include - -using std::min; -using namespace facebook::react; - -static int64_t int64FromJSValue(JSContextRef ctx, JSValueRef value, JSValueRef* exception) { - return static_cast(JSC_JSValueToNumber(ctx, value, exception)); -} - -static size_t copyTruncatedAsciiChars( - char* buf, - size_t bufLen, - JSContextRef ctx, - JSValueRef value, - size_t maxLen) { - JSStringRef jsString = JSC_JSValueToStringCopy(ctx, value, NULL); - size_t stringLen = JSC_JSStringGetLength(ctx, jsString); - // Unlike the Java version, we truncate from the end of the string, - // rather than the beginning. - size_t toWrite = min(stringLen, min(bufLen, maxLen)); - - const char *startBuf = buf; - const JSChar* chars = JSC_JSStringGetCharactersPtr(ctx, jsString); - while (toWrite-- > 0) { - *(buf++) = (char)*(chars++); - } - - JSC_JSStringRelease(ctx, jsString); - - // Return the number of bytes written - return buf - startBuf; -} - -static size_t copyArgsToBuffer( - char* buf, - size_t bufLen, - size_t pos, - JSContextRef ctx, - size_t argumentCount, - const JSValueRef arguments[]) { - char separator = '|'; - for ( - size_t idx = 0; - idx + 1 < argumentCount; // Make sure key and value are present. - idx += 2) { - JSValueRef key = arguments[idx]; - JSValueRef value = arguments[idx+1]; - - buf[pos++] = separator; - separator = ';'; - if (FBSYSTRACE_UNLIKELY(pos >= bufLen)) { break; } - pos += copyTruncatedAsciiChars( - buf + pos, bufLen - pos, ctx, key, FBSYSTRACE_MAX_MESSAGE_LENGTH); - if (FBSYSTRACE_UNLIKELY(pos >= bufLen)) { break; } - buf[pos++] = '='; - if (FBSYSTRACE_UNLIKELY(pos >= bufLen)) { break; } - pos += copyTruncatedAsciiChars( - buf + pos, bufLen - pos, ctx, value, FBSYSTRACE_MAX_MESSAGE_LENGTH); - if (FBSYSTRACE_UNLIKELY(pos >= bufLen)) { break; } - } - return pos; -} - -static JSValueRef nativeTraceBeginSection( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - if (FBSYSTRACE_UNLIKELY(argumentCount < 2)) { - if (exception) { - *exception = Value::makeError( - ctx, - "nativeTraceBeginSection: requires at least 2 arguments"); - } - return Value::makeUndefined(ctx); - } - - uint64_t tag = int64FromJSValue(ctx, arguments[0], exception); - if (!fbsystrace_is_tracing(tag)) { - return Value::makeUndefined(ctx); - } - - char buf[FBSYSTRACE_MAX_MESSAGE_LENGTH]; - size_t pos = 0; - - pos += snprintf(buf + pos, sizeof(buf) - pos, "B|%d|", getpid()); - // Skip the overflow check here because the int will be small. - pos += copyTruncatedAsciiChars(buf + pos, sizeof(buf) - pos, ctx, arguments[1], FBSYSTRACE_MAX_SECTION_NAME_LENGTH); - // Skip the overflow check here because the section name will be small-ish. - - pos = copyArgsToBuffer(buf, sizeof(buf), pos, ctx, argumentCount - 2, arguments + 2); - if (FBSYSTRACE_UNLIKELY(pos >= sizeof(buf))) { - goto flush; - } - -flush: - fbsystrace_trace_raw(buf, min(pos, sizeof(buf)-1)); - - return Value::makeUndefined(ctx); -} - -static JSValueRef nativeTraceEndSection( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - if (FBSYSTRACE_UNLIKELY(argumentCount < 1)) { - if (exception) { - *exception = Value::makeError( - ctx, - "nativeTraceEndSection: requires at least 1 argument"); - } - return Value::makeUndefined(ctx); - } - - uint64_t tag = int64FromJSValue(ctx, arguments[0], exception); - if (!fbsystrace_is_tracing(tag)) { - return Value::makeUndefined(ctx); - } - - if (FBSYSTRACE_LIKELY(argumentCount == 1)) { - fbsystrace_end_section(tag); - } else { - char buf[FBSYSTRACE_MAX_MESSAGE_LENGTH]; - size_t pos = 0; - - buf[pos++] = 'E'; - buf[pos++] = '|'; - buf[pos++] = '|'; - pos = copyArgsToBuffer(buf, sizeof(buf), pos, ctx, argumentCount - 1, arguments + 1); - if (FBSYSTRACE_UNLIKELY(pos >= sizeof(buf))) { - goto flush; - } - -flush: - fbsystrace_trace_raw(buf, min(pos, sizeof(buf)-1)); - } - - return Value::makeUndefined(ctx); -} - -static JSValueRef beginOrEndAsync( - bool isEnd, - bool isFlow, - JSContextRef ctx, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - if (FBSYSTRACE_UNLIKELY(argumentCount < 3)) { - if (exception) { - *exception = Value::makeError( - ctx, - "beginOrEndAsync: requires at least 3 arguments"); - } - return Value::makeUndefined(ctx); - } - - uint64_t tag = int64FromJSValue(ctx, arguments[0], exception); - if (!fbsystrace_is_tracing(tag)) { - return Value::makeUndefined(ctx); - } - - char buf[FBSYSTRACE_MAX_MESSAGE_LENGTH]; - size_t pos = 0; - - // This uses an if-then-else instruction in ARMv7, which should be cheaper - // than a full branch. - buf[pos++] = ((isFlow) ? (isEnd ? 'f' : 's') : (isEnd ? 'F' : 'S')); - pos += snprintf(buf + pos, sizeof(buf) - pos, "|%d|", getpid()); - // Skip the overflow check here because the int will be small. - pos += copyTruncatedAsciiChars(buf + pos, sizeof(buf) - pos, ctx, arguments[1], FBSYSTRACE_MAX_SECTION_NAME_LENGTH); - // Skip the overflow check here because the section name will be small-ish. - - // I tried some trickery to avoid a branch here, but gcc did not cooperate. - // We could consider changing the implementation to be lest branchy in the - // future. - // This is not required for flow use an or to avoid introducing another branch - if (!(isEnd | isFlow)) { - buf[pos++] = '<'; - buf[pos++] = '0'; - buf[pos++] = '>'; - } - buf[pos++] = '|'; - - // Append the cookie. It should be an integer, but copyTruncatedAsciiChars - // will automatically convert it to a string. We might be able to get more - // performance by just getting the number and doing to string - // conversion ourselves. We truncate to FBSYSTRACE_MAX_SECTION_NAME_LENGTH - // just to make sure we can avoid the overflow check even if the caller - // passes in something bad. - pos += copyTruncatedAsciiChars(buf + pos, sizeof(buf) - pos, ctx, arguments[2], FBSYSTRACE_MAX_SECTION_NAME_LENGTH); - - pos = copyArgsToBuffer(buf, sizeof(buf), pos, ctx, argumentCount - 3, arguments + 3); - if (FBSYSTRACE_UNLIKELY(pos >= sizeof(buf))) { - goto flush; - } - -flush: - fbsystrace_trace_raw(buf, min(pos, sizeof(buf)-1)); - - return Value::makeUndefined(ctx); -} - -static JSValueRef nativeTraceBeginAsyncSection( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - return beginOrEndAsync(false /* isEnd */, false /* isFlow */, - ctx, argumentCount, arguments, exception); -} - -static JSValueRef nativeTraceEndAsyncSection( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - return beginOrEndAsync(true /* isEnd */, false /* isFlow */, - ctx, argumentCount, arguments, exception); -} - -static JSValueRef nativeTraceBeginAsyncFlow( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - return beginOrEndAsync(false /* isEnd */, true /* isFlow */, - ctx, argumentCount, arguments, exception); -} - -static JSValueRef nativeTraceEndAsyncFlow( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - return beginOrEndAsync(true /* isEnd */, true /* isFlow */, - ctx, argumentCount, arguments, exception); -} - -static JSValueRef nativeTraceCounter( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - if (FBSYSTRACE_UNLIKELY(argumentCount < 3)) { - if (exception) { - *exception = Value::makeError( - ctx, - "nativeTraceCounter: requires at least 3 arguments"); - } - return Value::makeUndefined(ctx); - } - - uint64_t tag = int64FromJSValue(ctx, arguments[0], exception); - if (!fbsystrace_is_tracing(tag)) { - return Value::makeUndefined(ctx); - } - - char buf[FBSYSTRACE_MAX_MESSAGE_LENGTH]; - size_t len = copyTruncatedAsciiChars(buf, sizeof(buf), ctx, - arguments[1], FBSYSTRACE_MAX_SECTION_NAME_LENGTH); - buf[min(len,(FBSYSTRACE_MAX_MESSAGE_LENGTH-1))] = 0; - int64_t value = int64FromJSValue(ctx, arguments[2], exception); - - fbsystrace_counter(tag, buf, value); - - return Value::makeUndefined(ctx); -} - -#endif - -namespace facebook { -namespace react { - -void addNativeTracingHooks(JSGlobalContextRef ctx) { -#if USE_JSCTRACING - installGlobalFunction(ctx, "nativeTraceBeginSection", nativeTraceBeginSection); - installGlobalFunction(ctx, "nativeTraceEndSection", nativeTraceEndSection); - installGlobalFunction(ctx, "nativeTraceBeginAsyncSection", nativeTraceBeginAsyncSection); - installGlobalFunction(ctx, "nativeTraceEndAsyncSection", nativeTraceEndAsyncSection); - installGlobalFunction(ctx, "nativeTraceBeginAsyncFlow", nativeTraceBeginAsyncFlow); - installGlobalFunction(ctx, "nativeTraceEndAsyncFlow", nativeTraceEndAsyncFlow); - installGlobalFunction(ctx, "nativeTraceCounter", nativeTraceCounter); -#endif -} - -} } diff --git a/ReactCommon/cxxreact/JSCTracing.h b/ReactCommon/cxxreact/JSCTracing.h deleted file mode 100644 index c68c3556dddbd9..00000000000000 --- a/ReactCommon/cxxreact/JSCTracing.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include - -namespace facebook { -namespace react { - -void addNativeTracingHooks(JSGlobalContextRef ctx); - -} } diff --git a/ReactCommon/cxxreact/JSCUtils.cpp b/ReactCommon/cxxreact/JSCUtils.cpp deleted file mode 100644 index 69ea803b7479e1..00000000000000 --- a/ReactCommon/cxxreact/JSCUtils.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "JSCUtils.h" - -#include "RAMBundleRegistry.h" - -#include - -namespace facebook { -namespace react { - -String jsStringFromBigString(JSContextRef ctx, const JSBigString& bigstr) { - if (bigstr.isAscii()) { - return String::createExpectingAscii(ctx, bigstr.c_str(), bigstr.size()); - } else { - return String(ctx, bigstr.c_str()); - } -} - -} -} diff --git a/ReactCommon/cxxreact/JSCUtils.h b/ReactCommon/cxxreact/JSCUtils.h deleted file mode 100644 index 55300044515e7b..00000000000000 --- a/ReactCommon/cxxreact/JSCUtils.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include - -namespace facebook { -namespace react { - -String jsStringFromBigString(JSContextRef ctx, const JSBigString& bigstr); - -} -} diff --git a/ReactCommon/cxxreact/Platform.cpp b/ReactCommon/cxxreact/Platform.cpp deleted file mode 100644 index a9a096fa9c6c06..00000000000000 --- a/ReactCommon/cxxreact/Platform.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "Platform.h" - -namespace facebook { -namespace react { - -#if __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wglobal-constructors" -#endif - -namespace JSCNativeHooks { - -Hook loggingHook = nullptr; -Hook nowHook = nullptr; -ConfigurationHook installPerfHooks = nullptr; - -} - -#if __clang__ -#pragma clang diagnostic pop -#endif - -} } diff --git a/ReactCommon/cxxreact/Platform.h b/ReactCommon/cxxreact/Platform.h deleted file mode 100644 index bf7182f0bdc1d7..00000000000000 --- a/ReactCommon/cxxreact/Platform.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include - -#include -#include - -#ifndef RN_EXPORT -#define RN_EXPORT __attribute__((visibility("default"))) -#endif - -namespace facebook { -namespace react { - -namespace JSCNativeHooks { - -using Hook = JSValueRef(*)( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef *exception); -extern RN_EXPORT Hook loggingHook; -extern RN_EXPORT Hook nowHook; - -typedef void(*ConfigurationHook)(JSGlobalContextRef); -extern RN_EXPORT ConfigurationHook installPerfHooks; - -} - -} } diff --git a/ReactCommon/cxxreact/tests/BUCK b/ReactCommon/cxxreact/tests/BUCK index 37ef5228405372..609e5daaf5cd5f 100644 --- a/ReactCommon/cxxreact/tests/BUCK +++ b/ReactCommon/cxxreact/tests/BUCK @@ -1,8 +1,6 @@ load( "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID_JSC_DEPS", "APPLE", - "APPLE_JSC_DEPS", "fb_xplat_cxx_test", "jni_instrumentation_test_lib", "react_native_xplat_target", @@ -12,10 +10,7 @@ TEST_SRCS = [ "RecoverableErrorTest.cpp", "jsarg_helpers.cpp", "jsbigstring.cpp", - "jscexecutor.cpp", - "jsclogging.cpp", "methodcall.cpp", - "value.cpp", ] jni_instrumentation_test_lib( @@ -33,9 +28,10 @@ jni_instrumentation_test_lib( ], deps = [ "xplat//third-party/linker_lib:android", + "xplat//third-party/linker_lib:atomic", "xplat//third-party/gmock:gtest", react_native_xplat_target("cxxreact:bridge"), - ] + ANDROID_JSC_DEPS, + ], ) fb_xplat_cxx_test( @@ -53,6 +49,5 @@ fb_xplat_cxx_test( "xplat//folly:molly", "xplat//third-party/gmock:gtest", react_native_xplat_target("cxxreact:bridge"), - react_native_xplat_target("jschelpers:jschelpers"), - ] + APPLE_JSC_DEPS, + ], ) diff --git a/ReactCommon/cxxreact/tests/jscexecutor.cpp b/ReactCommon/cxxreact/tests/jscexecutor.cpp deleted file mode 100644 index 1988d5796fe742..00000000000000 --- a/ReactCommon/cxxreact/tests/jscexecutor.cpp +++ /dev/null @@ -1,273 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include -#include -#include -#include - -using namespace facebook; -using namespace facebook::react; - - -// TODO(12340362): Fix these tests. And add checks for sizes. -/* - -namespace { - -std::string capturedMethodCalls; - -struct NullDelegate : ExecutorDelegate { - virtual void registerExecutor(std::unique_ptr executor, - std::shared_ptr queue) { - std::terminate(); - } - - virtual std::unique_ptr unregisterExecutor(JSExecutor& executor) { - std::terminate(); - } - - virtual std::vector moduleNames() { - return std::vector{}; - } - - virtual folly::dynamic getModuleConfig(const std::string& name) { - std::terminate(); - } - virtual void callNativeModules( - JSExecutor& executor, std::string callJSON, bool isEndOfBatch) { - // TODO: capture calljson - std::terminate(); - } - virtual MethodCallResult callSerializableNativeHook( - JSExecutor& executor, unsigned int moduleId, unsigned int methodId, folly::dynamic&& args) { - std::terminate(); - } -}; - -struct FakeMessageQueue : MessageQueueThread { - virtual void runOnQueue(std::function&& runnable) { - // This is wrong, but oh well. - runnable(); - } - - virtual void runOnQueueSync(std::function&& runnable) { - runnable(); - } - - virtual void quitSynchronous() { - std::terminate(); - } -}; - -std::vector executeForMethodCalls( - JSCExecutor& e, - int moduleId, - int methodId, - folly::dynamic args = folly::dynamic::array()) { - e.callFunction(folly::to(moduleId), folly::to(methodId), std::move(args)); - return parseMethodCalls(capturedMethodCalls); -} - -void loadApplicationScript(JSCExecutor& e, std::string jsText) { - e.loadApplicationScript(std::unique_ptr(new JSBigStdString(jsText)), ""); -} - -void setGlobalVariable(JSCExecutor& e, std::string name, std::string jsonObject) { - e.setGlobalVariable(name, std::unique_ptr(new JSBigStdString(jsonObject))); -} - -} - -TEST(JSCExecutor, Initialize) { - JSCExecutor executor(std::make_shared(), std::make_shared(), "", folly::dynamic::object); -} - -TEST(JSCExecutor, Two) { - JSCExecutor exec1(std::make_shared(), std::make_shared(), "", folly::dynamic::object); - JSCExecutor exec2(std::make_shared(), std::make_shared(), "", folly::dynamic::object); -} - -TEST(JSCExecutor, CallFunction) { - auto jsText = "" - "var Bridge = {" - " callFunctionReturnFlushedQueue: function (module, method, args) {" - " return [[module + 1], [method + 1], [args]];" - " }," - "};" - "function require() { return Bridge; }" - ""; - JSCExecutor e(std::make_shared(), std::make_shared(), "", folly::dynamic::object); - loadApplicationScript(e, jsText); - folly::dynamic args = folly::dynamic::array(); - args.push_back(true); - args.push_back(0.4); - args.push_back("hello, world"); - args.push_back(4.0); - auto returnedCalls = executeForMethodCalls(e, 10, 9, args); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - EXPECT_EQ(11, returnedCall.moduleId); - EXPECT_EQ(10, returnedCall.methodId); - ASSERT_EQ(4, returnedCall.arguments.size()); - EXPECT_EQ(args[0], returnedCall.arguments[0]); - EXPECT_EQ(args[1], returnedCall.arguments[1]); - EXPECT_EQ(args[2], returnedCall.arguments[2]); - EXPECT_EQ(folly::dynamic(4.0), returnedCall.arguments[3]); -} - -TEST(JSCExecutor, CallFunctionWithMap) { - auto jsText = "" - "var Bridge = {" - " callFunctionReturnFlushedQueue: function (module, method, args) {" - " var s = args[0].foo + args[0].bar + args[0].baz;" - " return [[module], [method], [[s]]];" - " }," - "};" - "function require() { return Bridge; }" - ""; - JSCExecutor e(std::make_shared(), std::make_shared(), "", folly::dynamic::object); - loadApplicationScript(e, jsText); - folly::dynamic args = folly::dynamic::array(); - folly::dynamic map = folly::dynamic::object - ("foo", folly::dynamic("hello")) - ("bar", folly::dynamic(4.0)) - ("baz", folly::dynamic(true)) - ; - args.push_back(std::move(map)); - auto returnedCalls = executeForMethodCalls(e, 10, 9, args); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - ASSERT_EQ(1, returnedCall.arguments.size()); - EXPECT_EQ("hello4true", returnedCall.arguments[0].getString()); -} - -TEST(JSCExecutor, CallFunctionReturningMap) { - auto jsText = "" - "var Bridge = {" - " callFunctionReturnFlushedQueue: function (module, method, args) {" - " var s = { foo: 4, bar: true };" - " return [[module], [method], [[s]]];" - " }," - "};" - "function require() { return Bridge; }" - ""; - JSCExecutor e(std::make_shared(), std::make_shared(), "", folly::dynamic::object); - loadApplicationScript(e, jsText); - auto returnedCalls = executeForMethodCalls(e, 10, 9); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - ASSERT_EQ(1, returnedCall.arguments.size()); - ASSERT_EQ(folly::dynamic::OBJECT, returnedCall.arguments[0].type()); - auto& returnedMap = returnedCall.arguments[0]; - auto foo = returnedMap.at("foo"); - EXPECT_EQ(folly::dynamic(4.0), foo); - auto bar = returnedMap.at("bar"); - EXPECT_EQ(folly::dynamic(true), bar); -} - -TEST(JSCExecutor, CallFunctionWithArray) { - auto jsText = "" - "var Bridge = {" - " callFunctionReturnFlushedQueue: function (module, method, args) {" - " var s = args[0][0]+ args[0][1] + args[0][2] + args[0].length;" - " return [[module], [method], [[s]]];" - " }," - "};" - "function require() { return Bridge; }" - ""; - JSCExecutor e(std::make_shared(), std::make_shared(), "", folly::dynamic::object); - loadApplicationScript(e, jsText); - std::vector args; - std::vector array { - folly::dynamic("hello"), - folly::dynamic(4.0), - folly::dynamic(true), - }; - args.push_back(std::move(array)); - auto returnedCalls = executeForMethodCalls(e, 10, 9, args); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - ASSERT_EQ(1, returnedCall.arguments.size()); - EXPECT_EQ("hello4true3", returnedCall.arguments[0].getString()); -} - -TEST(JSCExecutor, CallFunctionReturningNumberArray) { - auto jsText = "" - "var Bridge = {" - " callFunctionReturnFlushedQueue: function (module, method, args) {" - " var s = [3, 1, 4];" - " return [[module], [method], [[s]]];" - " }," - "};" - "function require() { return Bridge; }" - ""; - JSCExecutor e(std::make_shared(), std::make_shared(), "", folly::dynamic::object); - loadApplicationScript(e, jsText); - auto returnedCalls = executeForMethodCalls(e, 10, 9); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - ASSERT_EQ(1, returnedCall.arguments.size()); - ASSERT_EQ(folly::dynamic::ARRAY, returnedCall.arguments[0].type()); - - auto& array = returnedCall.arguments[0]; - EXPECT_EQ(3, array.size()); - EXPECT_EQ(folly::dynamic(3.0), array[0]); - EXPECT_EQ(folly::dynamic(4.0), array[2]); -} - -TEST(JSCExecutor, SetSimpleGlobalVariable) { - auto jsText = "" - "var Bridge = {" - " callFunctionReturnFlushedQueue: function (module, method, args) {" - " return [[module], [method], [[__foo]]];" - " }," - "};" - "function require() { return Bridge; }" - ""; - JSCExecutor e(std::make_shared(), std::make_shared(), "", folly::dynamic::object); - loadApplicationScript(e, jsText); - setGlobalVariable(e, "__foo", "42"); - auto returnedCalls = executeForMethodCalls(e, 10, 9); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - ASSERT_EQ(1, returnedCall.arguments.size()); - ASSERT_EQ(42.0, returnedCall.arguments[0].getDouble()); -} - -TEST(JSCExecutor, SetObjectGlobalVariable) { - auto jsText = "" - "var Bridge = {" - " callFunctionReturnFlushedQueue: function (module, method, args) {" - " return [[module], [method], [[__foo]]];" - " }," - "};" - "function require() { return Bridge; }" - ""; - JSCExecutor e(std::make_shared(), std::make_shared(), "", folly::dynamic::object); - loadApplicationScript(e, jsText); - auto jsonObject = "" - "{" - " \"foo\": \"hello\"," - " \"bar\": 4," - " \"baz\": true" - "}" - ""; - setGlobalVariable(e, "__foo", jsonObject); - auto returnedCalls = executeForMethodCalls(e, 10, 9); - ASSERT_EQ(1, returnedCalls.size()); - auto returnedCall = returnedCalls[0]; - ASSERT_EQ(1, returnedCall.arguments.size()); - ASSERT_EQ(folly::dynamic::OBJECT, returnedCall.arguments[0].type()); - auto& returnedMap = returnedCall.arguments[0]; - auto foo = returnedMap.at("foo"); - EXPECT_EQ(folly::dynamic("hello"), foo); - auto bar = returnedMap.at("bar"); - EXPECT_EQ(folly::dynamic(4.0), bar); - auto baz = returnedMap.at("baz"); - EXPECT_EQ(folly::dynamic(true), baz); -} - -*/ diff --git a/ReactCommon/cxxreact/tests/jsclogging.cpp b/ReactCommon/cxxreact/tests/jsclogging.cpp deleted file mode 100644 index 632d3aa2fd14be..00000000000000 --- a/ReactCommon/cxxreact/tests/jsclogging.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include -#include - -using namespace facebook; -using namespace facebook::react; - -/* -static const char* expectedLogMessageSubstring = NULL; -static bool hasSeenExpectedLogMessage = false; - -static void mockLogHandler(int pri, const char *tag, const char *msg) { - if (expectedLogMessageSubstring == NULL) { - return; - } - - hasSeenExpectedLogMessage |= (strstr(msg, expectedLogMessageSubstring) != NULL); -} - -class JSCLoggingTest : public testing::Test { - protected: - virtual void SetUp() override { - setLogHandler(&mockLogHandler); - } - - virtual void TearDown() override { - setLogHandler(NULL); - expectedLogMessageSubstring = NULL; - hasSeenExpectedLogMessage = false; - } - -}; - -TEST_F(JSCLoggingTest, LogException) { - auto jsText = "throw new Error('I am a banana!');"; - expectedLogMessageSubstring = "I am a banana!"; - - JSCExecutor e; - e.loadApplicationScript(jsText, ""); - - ASSERT_TRUE(hasSeenExpectedLogMessage); -} -*/ diff --git a/ReactCommon/cxxreact/tests/value.cpp b/ReactCommon/cxxreact/tests/value.cpp deleted file mode 100644 index d001d03bcb2426..00000000000000 --- a/ReactCommon/cxxreact/tests/value.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. -#include -#include -#include -#include - -#ifdef WITH_FBJSCEXTENSION -#undef ASSERT -#include -#include "OpaqueJSString.h" -#endif - -#include - -using namespace facebook::react; - -#ifdef ANDROID -#include -static void prepare() { - ALooper_prepare(0); -} -#else -static void prepare() {} -#endif - -TEST(Value, Undefined) { - prepare(); - JSGlobalContextRef ctx = JSC_JSGlobalContextCreateInGroup(false, nullptr, nullptr); - auto v = Value::makeUndefined(ctx); - auto s = String::adopt(ctx, JSC_JSValueToStringCopy(ctx, v, nullptr)); - EXPECT_EQ("undefined", s.str()); - JSC_JSGlobalContextRelease(ctx); -} - -TEST(Value, FromJSON) { - prepare(); - JSGlobalContextRef ctx = JSC_JSGlobalContextCreateInGroup(false, nullptr, nullptr); - String s(ctx, "{\"a\": 4}"); - Value v(Value::fromJSON(s)); - EXPECT_TRUE(v.isObject()); - JSC_JSGlobalContextRelease(ctx); -} - -TEST(Value, ToJSONString) { - prepare(); - JSGlobalContextRef ctx = JSC_JSGlobalContextCreateInGroup(false, nullptr, nullptr); - String s(ctx, "{\"a\": 4}"); - Value v(Value::fromJSON(s)); - folly::dynamic dyn = folly::parseJson(v.toJSONString()); - ASSERT_NE(nullptr, dyn); - EXPECT_TRUE(dyn.isObject()); - auto val = dyn.at("a"); - ASSERT_NE(nullptr, val); - ASSERT_TRUE(val.isNumber()); - EXPECT_EQ(4, val.asInt()); - EXPECT_EQ(4.0f, val.asDouble()); - - JSC_JSGlobalContextRelease(ctx); -} - -#ifdef WITH_FBJSCEXTENSION -// Just test that handling invalid data doesn't crash. -TEST(Value, FromBadUtf8) { - prepare(); - JSGlobalContextRef ctx = JSC_JSGlobalContextCreateInGroup(false, nullptr, nullptr); - // 110xxxxx 10xxxxxx - auto dyn = folly::dynamic("\xC0"); - Value::fromDynamic(ctx, dyn); - dyn = folly::dynamic("\xC0\x00"); - Value::fromDynamic(ctx, dyn); - // 1110xxxx 10xxxxxx 10xxxxxx - dyn = "\xE0"; - Value::fromDynamic(ctx, dyn); - Value(ctx, Value::fromDynamic(ctx, dyn)).toJSONString(); - dyn = "\xE0\x00"; - Value::fromDynamic(ctx, dyn); - Value(ctx, Value::fromDynamic(ctx, dyn)).toJSONString(); - dyn = "\xE0\x00\x00"; - Value::fromDynamic(ctx, dyn); - Value(ctx, Value::fromDynamic(ctx, dyn)).toJSONString(); - dyn = "\xE0\xA0\x00"; - Value::fromDynamic(ctx, dyn); - // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - dyn = "\xF0"; - Value::fromDynamic(ctx, dyn); - Value(ctx, Value::fromDynamic(ctx, dyn)).toJSONString(); - dyn = "\xF0\x00\x00\x00"; - Value::fromDynamic(ctx, dyn); - dyn = "\xF0\x80\x80\x00"; - Value::fromDynamic(ctx, dyn); - Value(ctx, Value::fromDynamic(ctx, dyn)).toJSONString(); - JSC_JSGlobalContextRelease(ctx); -} - -// Just test that handling invalid data doesn't crash. -TEST(Value, BadUtf16) { - prepare(); - JSGlobalContextRef ctx = JSC_JSGlobalContextCreateInGroup(false, nullptr, nullptr); - UChar buf[] = { 0xDD00, 0xDD00, 0xDD00, 0x1111 }; - JSStringRef ref = OpaqueJSString::create(buf, 4).leakRef(); - Value v(ctx, ref); - v.toJSONString(0); - JSC_JSGlobalContextRelease(ctx); -} -#endif diff --git a/ReactCommon/jschelpers/Android.mk b/ReactCommon/jschelpers/Android.mk deleted file mode 100644 index 765b0ac7833acc..00000000000000 --- a/ReactCommon/jschelpers/Android.mk +++ /dev/null @@ -1,27 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := jschelpers - -LOCAL_SRC_FILES := \ - JSCHelpers.cpp \ - Unicode.cpp \ - Value.cpp \ - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) - -LOCAL_CFLAGS := \ - -DLOG_TAG=\"ReactNative\" - -LOCAL_CFLAGS += -fexceptions -frtti - -LOCAL_SHARED_LIBRARIES := libfolly_json libjsc libglog - -include $(BUILD_STATIC_LIBRARY) - -$(call import-module,folly) -$(call import-module,jsc) -$(call import-module,glog) -$(call import-module,privatedata) diff --git a/ReactCommon/jschelpers/BUCK b/ReactCommon/jschelpers/BUCK deleted file mode 100644 index 49b21bbfef77f4..00000000000000 --- a/ReactCommon/jschelpers/BUCK +++ /dev/null @@ -1,73 +0,0 @@ -load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "ANDROID_JSC_INTERNAL_DEPS", "APPLE", "APPLE_JSC_INTERNAL_DEPS", "react_native_xplat_target", "rn_xplat_cxx_library") - -EXPORTED_HEADERS = [ - "JavaScriptCore.h", - "JSCHelpers.h", - "JSCWrapper.h", - "noncopyable.h", - "Unicode.h", - "Value.h", -] - -rn_xplat_cxx_library( - name = "jscinternalhelpers", - srcs = glob( - ["*.cpp"], - exclude = ["systemJSCWrapper.cpp"], - ), - headers = glob( - ["*.h"], - exclude = EXPORTED_HEADERS, - ), - header_namespace = "", - exported_headers = dict([ - ( - "jschelpers/%s" % header, - header, - ) - for header in EXPORTED_HEADERS - ]), - compiler_flags = [ - "-Wall", - "-fexceptions", - "-frtti", - "-fvisibility=hidden", - "-std=c++1y", - ], - fbandroid_deps = ANDROID_JSC_INTERNAL_DEPS, - fbobjc_deps = APPLE_JSC_INTERNAL_DEPS, - force_static = True, - platforms = (ANDROID, APPLE), - visibility = [ - "PUBLIC", - ], - deps = [ - "xplat//folly:molly", - "xplat//third-party/glog:glog", - react_native_xplat_target("privatedata:privatedata"), - ], - exported_deps = [ - react_native_xplat_target("privatedata:privatedata"), - ], -) - -rn_xplat_cxx_library( - name = "jschelpers", - srcs = [], - compiler_flags = [ - "-Wall", - "-fexceptions", - "-fvisibility=hidden", - "-std=c++1y", - ], - fbobjc_frameworks = [ - "$SDKROOT/System/Library/Frameworks/JavaScriptCore.framework", - ], - fbobjc_srcs = ["systemJSCWrapper.cpp"], - force_static = True, - platforms = (ANDROID, APPLE), - visibility = [ - "PUBLIC", - ], - deps = [":jscinternalhelpers"], -) diff --git a/ReactCommon/jschelpers/JSCHelpers.cpp b/ReactCommon/jschelpers/JSCHelpers.cpp deleted file mode 100644 index 33da92cc23195c..00000000000000 --- a/ReactCommon/jschelpers/JSCHelpers.cpp +++ /dev/null @@ -1,299 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "JSCHelpers.h" - -#ifdef WITH_FBSYSTRACE -#include -#endif - -#include - -#if WITH_FBJSCEXTENSIONS -#include -#endif - -#include "JavaScriptCore.h" -#include "Value.h" -#include - -#if WITH_FBJSCEXTENSIONS -#undef ASSERT -#undef WTF_EXPORT_PRIVATE - -#include -#include - -#undef TRUE -#undef FALSE -#endif - -namespace facebook { -namespace react { - -namespace { - -class JSFunctionPrivateData : public PrivateDataBase { - public: - explicit JSFunctionPrivateData(JSFunction&& function) : jsFunction_{std::move(function)} {} - - JSFunction& getJSFunction() { - return jsFunction_; - } - -private: - JSFunction jsFunction_; -}; - -JSValueRef functionCaller( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception) { - const bool isCustomJSC = isCustomJSCPtr(ctx); - auto* privateData = PrivateDataBase::cast( - JSC_JSObjectGetPrivate(isCustomJSC, function)); - return (privateData->getJSFunction())(ctx, thisObject, argumentCount, arguments); -} - -JSClassRef createFuncClass(JSContextRef ctx) { - JSClassDefinition definition = kJSClassDefinitionEmpty; - definition.attributes |= kJSClassAttributeNoAutomaticPrototype; - - // Need to duplicate the two different finalizer blocks, since there's no way - // for it to capture this static information. - const bool isCustomJSC = isCustomJSCPtr(ctx); - if (isCustomJSC) { - definition.finalize = [](JSObjectRef object) { - auto* privateData = PrivateDataBase::cast( - JSC_JSObjectGetPrivate(true, object)); - delete privateData; - }; - } else { - definition.finalize = [](JSObjectRef object) { - auto* privateData = PrivateDataBase::cast( - JSC_JSObjectGetPrivate(false, object)); - delete privateData; - }; - } - definition.callAsFunction = exceptionWrapMethod<&functionCaller>(); - - return JSC_JSClassCreate(isCustomJSC, &definition); -} - -JSObjectRef makeFunction( - JSContextRef ctx, - JSStringRef name, - JSFunction function) { - static JSClassRef kClassDef = NULL, kCustomJSCClassDef = NULL; - JSClassRef *classRef = isCustomJSCPtr(ctx) ? &kCustomJSCClassDef : &kClassDef; - if (!*classRef) { - *classRef = createFuncClass(ctx); - } - - // dealloc in kClassDef.finalize - JSFunctionPrivateData *functionDataPtr = new JSFunctionPrivateData(std::move(function)); - auto functionObject = Object(ctx, JSC_JSObjectMake(ctx, *classRef, functionDataPtr)); - functionObject.setProperty("name", Value(ctx, name)); - return functionObject; -} - -} - -void JSException::buildMessage(JSContextRef ctx, JSValueRef exn, JSStringRef sourceURL, const char* errorMsg) { - std::ostringstream msgBuilder; - if (errorMsg && strlen(errorMsg) > 0) { - msgBuilder << errorMsg << ": "; - } - - Object exnObject = Value(ctx, exn).asObject(); - Value exnMessage = exnObject.getProperty("message"); - msgBuilder << (exnMessage.isString() ? exnMessage : (Value)exnObject).toString().str(); - - // The null/empty-ness of source tells us if the JS came from a - // file/resource, or was a constructed statement. The location - // info will include that source, if any. - std::string locationInfo = sourceURL != nullptr ? String::ref(ctx, sourceURL).str() : ""; - auto line = exnObject.getProperty("line"); - if (line != nullptr && line.isNumber()) { - if (locationInfo.empty() && line.asInteger() != 1) { - // If there is a non-trivial line number, but there was no - // location info, we include a placeholder, and the line - // number. - locationInfo = folly::to(":", line.asInteger()); - } else if (!locationInfo.empty()) { - // If there is location info, we always include the line - // number, regardless of its value. - locationInfo += folly::to(":", line.asInteger()); - } - } - - if (!locationInfo.empty()) { - msgBuilder << " (" << locationInfo << ")"; - } - - auto exceptionText = msgBuilder.str(); - LOG(ERROR) << "Got JS Exception: " << exceptionText; - msg_ = std::move(exceptionText); - - Value jsStack = exnObject.getProperty("stack"); - if (jsStack.isString()) { - auto stackText = jsStack.toString().str(); - LOG(ERROR) << "Got JS Stack: " << stackText; - stack_ = std::move(stackText); - } -} - -namespace ExceptionHandling { - -PlatformErrorExtractor platformErrorExtractor; - -} - -JSObjectRef makeFunction( - JSContextRef ctx, - const char* name, - JSFunction function) { - return makeFunction(ctx, String(ctx, name), std::move(function)); -} - -void installGlobalFunction( - JSGlobalContextRef ctx, - const char* name, - JSFunction function) { - auto jsName = String(ctx, name); - auto functionObj = makeFunction(ctx, jsName, std::move(function)); - Object::getGlobalObject(ctx).setProperty(jsName, Value(ctx, functionObj)); -} - -JSObjectRef makeFunction( - JSGlobalContextRef ctx, - const char* name, - JSObjectCallAsFunctionCallback callback) { - auto jsName = String(ctx, name); - return JSC_JSObjectMakeFunctionWithCallback(ctx, jsName, callback); -} - -void installGlobalFunction( - JSGlobalContextRef ctx, - const char* name, - JSObjectCallAsFunctionCallback callback) { - String jsName(ctx, name); - JSObjectRef functionObj = JSC_JSObjectMakeFunctionWithCallback( - ctx, jsName, callback); - Object::getGlobalObject(ctx).setProperty(jsName, Value(ctx, functionObj)); -} - -void installGlobalProxy( - JSGlobalContextRef ctx, - const char* name, - JSObjectGetPropertyCallback callback) { - JSClassDefinition proxyClassDefintion = kJSClassDefinitionEmpty; - proxyClassDefintion.attributes |= kJSClassAttributeNoAutomaticPrototype; - proxyClassDefintion.getProperty = callback; - - const bool isCustomJSC = isCustomJSCPtr(ctx); - JSClassRef proxyClass = JSC_JSClassCreate(isCustomJSC, &proxyClassDefintion); - JSObjectRef proxyObj = JSC_JSObjectMake(ctx, proxyClass, nullptr); - JSC_JSClassRelease(isCustomJSC, proxyClass); - - Object::getGlobalObject(ctx).setProperty(name, Value(ctx, proxyObj)); -} - -void removeGlobal(JSGlobalContextRef ctx, const char* name) { - Object::getGlobalObject(ctx).setProperty(name, Value::makeUndefined(ctx)); -} - -JSValueRef evaluateScript(JSContextRef context, JSStringRef script, JSStringRef sourceURL) { - JSValueRef exn, result; - result = JSC_JSEvaluateScript(context, script, NULL, sourceURL, 0, &exn); - if (result == nullptr) { - throw JSException(context, exn, sourceURL); - } - return result; -} - -#if WITH_FBJSCEXTENSIONS -JSValueRef evaluateSourceCode(JSContextRef context, JSSourceCodeRef source, JSStringRef sourceURL) { - JSValueRef exn, result; - result = JSEvaluateSourceCode(context, source, NULL, &exn); - if (result == nullptr) { - throw JSException(context, exn, sourceURL); - } - return result; -} -#endif - -JSContextLock::JSContextLock(JSGlobalContextRef ctx) noexcept -#if WITH_FBJSCEXTENSIONS - : ctx_(ctx), - globalLock_(PTHREAD_MUTEX_INITIALIZER) - { - WTFThreadData& threadData = wtfThreadData(); - - // Code below is responsible for acquiring locks. It should execute - // atomically, thus none of the functions invoked from now on are allowed to - // throw an exception - try { - if (!threadData.isDebuggerThread()) { - CHECK(0 == pthread_mutex_lock(&globalLock_)); - } - JSLock(ctx_); - } catch (...) { - abort(); - } -} -#else -{} -#endif - - -JSContextLock::~JSContextLock() noexcept { - #if WITH_FBJSCEXTENSIONS - WTFThreadData& threadData = wtfThreadData(); - - JSUnlock(ctx_); - if (!threadData.isDebuggerThread()) { - CHECK(0 == pthread_mutex_unlock(&globalLock_)); - } - #endif -} - - -JSValueRef translatePendingCppExceptionToJSError(JSContextRef ctx, const char *exceptionLocation) { - try { - throw; - } catch (const std::bad_alloc& ex) { - throw; // We probably shouldn't try to handle this in JS - } catch (const std::exception& ex) { - if (ExceptionHandling::platformErrorExtractor) { - auto extractedEror = ExceptionHandling::platformErrorExtractor(ex, exceptionLocation); - if (extractedEror.message.length() > 0) { - return Value::makeError(ctx, extractedEror.message.c_str(), extractedEror.stack.c_str()); - } - } - auto msg = folly::to("C++ exception in '", exceptionLocation, "'\n\n", ex.what()); - return Value::makeError(ctx, msg.c_str()); - } catch (const char* ex) { - auto msg = folly::to("C++ exception (thrown as a char*) in '", exceptionLocation, "'\n\n", ex); - return Value::makeError(ctx, msg.c_str()); - } catch (...) { - auto msg = folly::to("Unknown C++ exception in '", exceptionLocation, "'"); - return Value::makeError(ctx, msg.c_str()); - } -} - -JSValueRef translatePendingCppExceptionToJSError(JSContextRef ctx, JSObjectRef jsFunctionCause) { - try { - auto functionName = Object(ctx, jsFunctionCause).getProperty("name").toString().str(); - return translatePendingCppExceptionToJSError(ctx, functionName.c_str()); - } catch (...) { - return Value::makeError(ctx, "Failed to translate native exception"); - } -} - -} } diff --git a/ReactCommon/jschelpers/JSCHelpers.h b/ReactCommon/jschelpers/JSCHelpers.h deleted file mode 100644 index 2b06565e8b3a3e..00000000000000 --- a/ReactCommon/jschelpers/JSCHelpers.h +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include - -#include -#include - -#ifndef RN_EXPORT -#define RN_EXPORT __attribute__((visibility("default"))) -#endif - -namespace facebook { -namespace react { - -class RN_EXPORT JSException : public std::exception { -public: - explicit JSException(const char* msg) - : msg_(msg) {} - - explicit JSException(JSContextRef ctx, JSValueRef exn, const char* msg) { - buildMessage(ctx, exn, nullptr, msg); - } - - explicit JSException(JSContextRef ctx, JSValueRef exn, JSStringRef sourceURL) { - buildMessage(ctx, exn, sourceURL, nullptr); - } - - const std::string& getStack() const { - return stack_; - } - - virtual const char* what() const noexcept override { - return msg_.c_str(); - } - -private: - std::string msg_; - std::string stack_; - - void buildMessage(JSContextRef ctx, JSValueRef exn, JSStringRef sourceURL, const char* errorMsg); -}; - -namespace ExceptionHandling { - struct ExtractedEror { - std::string message; - // Stacktrace formatted like JS stack - // method@filename[:line[:column]] - std::string stack; - }; - typedef ExtractedEror(*PlatformErrorExtractor)(const std::exception &ex, const char *context); - extern PlatformErrorExtractor platformErrorExtractor; -} - -using JSFunction = std::function; - -JSObjectRef makeFunction( - JSContextRef ctx, - const char* name, - JSFunction function); - -RN_EXPORT void installGlobalFunction( - JSGlobalContextRef ctx, - const char* name, - JSFunction function); - -JSObjectRef makeFunction( - JSGlobalContextRef ctx, - const char* name, - JSObjectCallAsFunctionCallback callback); - -RN_EXPORT void installGlobalFunction( - JSGlobalContextRef ctx, - const char* name, - JSObjectCallAsFunctionCallback callback); - -void installGlobalProxy( - JSGlobalContextRef ctx, - const char* name, - JSObjectGetPropertyCallback callback); - -void removeGlobal(JSGlobalContextRef ctx, const char* name); - -JSValueRef evaluateScript( - JSContextRef ctx, - JSStringRef script, - JSStringRef sourceURL); - -#if WITH_FBJSCEXTENSIONS -JSValueRef evaluateSourceCode( - JSContextRef ctx, - JSSourceCodeRef source, - JSStringRef sourceURL); -#endif - -/** - * A lock for protecting accesses to the JSGlobalContext - * This will be a no-op for most compilations, where #if WITH_FBJSCEXTENSIONS is false, - * but avoids deadlocks in execution environments with advanced locking requirements, - * particularly with uses of the pthread mutex lock -**/ -class JSContextLock { -public: - JSContextLock(JSGlobalContextRef ctx) noexcept; - ~JSContextLock() noexcept; -private: -#if WITH_FBJSCEXTENSIONS - JSGlobalContextRef ctx_; - pthread_mutex_t globalLock_; -#endif -}; - -JSValueRef translatePendingCppExceptionToJSError(JSContextRef ctx, const char *exceptionLocation); -JSValueRef translatePendingCppExceptionToJSError(JSContextRef ctx, JSObjectRef jsFunctionCause); - -template -inline JSObjectCallAsFunctionCallback exceptionWrapMethod() { - struct funcWrapper { - static JSValueRef call( - JSContextRef ctx, - JSObjectRef function, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef *exception) { - try { - return (*method)(ctx, function, thisObject, argumentCount, arguments, exception); - } catch (...) { - *exception = translatePendingCppExceptionToJSError(ctx, function); - return JSC_JSValueMakeUndefined(ctx); - } - } - }; - - return &funcWrapper::call; -} - -} } diff --git a/ReactCommon/jschelpers/JSCWrapper.cpp b/ReactCommon/jschelpers/JSCWrapper.cpp deleted file mode 100644 index 68107c4ea82175..00000000000000 --- a/ReactCommon/jschelpers/JSCWrapper.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "JSCWrapper.h" - -#if defined(__APPLE__) - -// TODO: use glog in OSS too -#if __has_include() -#define USE_GLOG 1 -#include -#else -#define USE_GLOG 0 -#endif - -namespace facebook { -namespace react { - -static const JSCWrapper* s_customWrapper = nullptr; - -bool isCustomJSCWrapperSet() { - return s_customWrapper != nullptr; -} - -const JSCWrapper* customJSCWrapper() { - #if USE_GLOG - CHECK(s_customWrapper != nullptr) << "Accessing custom JSC wrapper before it's set"; - #endif - return s_customWrapper; -} - -void setCustomJSCWrapper(const JSCWrapper* wrapper) { - #if USE_GLOG - CHECK(s_customWrapper == nullptr) << "Can't set custom JSC wrapper multiple times"; - #endif - s_customWrapper = wrapper; -} - -} } - -#endif diff --git a/ReactCommon/jschelpers/JSCWrapper.h b/ReactCommon/jschelpers/JSCWrapper.h deleted file mode 100644 index 3e44793fc265b0..00000000000000 --- a/ReactCommon/jschelpers/JSCWrapper.h +++ /dev/null @@ -1,189 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include - -#if defined(JSCINTERNAL) || (!defined(__APPLE__)) -#define JSC_IMPORT extern "C" -#else -#define JSC_IMPORT extern -#endif - -#ifndef RN_EXPORT -#define RN_EXPORT __attribute__((visibility("default"))) -#endif - -namespace facebook { -namespace react { - class IInspector; -} -} - -JSC_IMPORT void JSGlobalContextEnableDebugger( - JSGlobalContextRef ctx, - facebook::react::IInspector &globalInspector, - const char *title, - const std::function &checkIsInspectedRemote); -JSC_IMPORT void JSGlobalContextDisableDebugger( - JSGlobalContextRef ctx, - facebook::react::IInspector &globalInspector); - -// This is used to substitute an alternate JSC implementation for -// testing. These calls must all be ABI compatible with the standard JSC. -JSC_IMPORT JSValueRef JSEvaluateBytecodeBundle(JSContextRef, JSObjectRef, int, JSStringRef, JSValueRef*); -JSC_IMPORT bool JSSamplingProfilerEnabled(); -JSC_IMPORT void JSStartSamplingProfilingOnMainJSCThread(JSGlobalContextRef); -JSC_IMPORT JSValueRef JSPokeSamplingProfiler(JSContextRef); -#ifdef __cplusplus -extern "C" { -#endif -JSC_IMPORT void configureJSCForIOS(std::string); // TODO: replace with folly::dynamic once supported -JSC_IMPORT void FBJSContextStartGCTimers(JSContextRef); -#ifdef __cplusplus -} -#endif - -#if defined(__APPLE__) -#include -#include -#include - -/** - * JSNoBytecodeFileFormatVersion - * - * Version number indicating that bytecode is not supported by this runtime. - */ -RN_EXPORT extern const int32_t JSNoBytecodeFileFormatVersion; - -namespace facebook { -namespace react { - -#define JSC_WRAPPER_METHOD(m) decltype(&m) m - -struct JSCWrapper { - // JSGlobalContext - JSC_WRAPPER_METHOD(JSGlobalContextCreateInGroup); - JSC_WRAPPER_METHOD(JSGlobalContextRelease); - JSC_WRAPPER_METHOD(JSGlobalContextSetName); - - // JSContext - JSC_WRAPPER_METHOD(JSContextGetGlobalContext); - JSC_WRAPPER_METHOD(JSContextGetGlobalObject); - JSC_WRAPPER_METHOD(FBJSContextStartGCTimers); - - // JSEvaluate - JSC_WRAPPER_METHOD(JSEvaluateScript); - JSC_WRAPPER_METHOD(JSEvaluateBytecodeBundle); - - // JSString - JSC_WRAPPER_METHOD(JSStringCreateWithUTF8CString); - JSC_WRAPPER_METHOD(JSStringCreateWithCFString); - #if WITH_FBJSCEXTENSIONS - JSC_WRAPPER_METHOD(JSStringCreateWithUTF8CStringExpectAscii); - #endif - JSC_WRAPPER_METHOD(JSStringCopyCFString); - JSC_WRAPPER_METHOD(JSStringGetCharactersPtr); - JSC_WRAPPER_METHOD(JSStringGetLength); - JSC_WRAPPER_METHOD(JSStringGetMaximumUTF8CStringSize); - JSC_WRAPPER_METHOD(JSStringIsEqualToUTF8CString); - JSC_WRAPPER_METHOD(JSStringRelease); - JSC_WRAPPER_METHOD(JSStringRetain); - - // JSClass - JSC_WRAPPER_METHOD(JSClassCreate); - JSC_WRAPPER_METHOD(JSClassRetain); - JSC_WRAPPER_METHOD(JSClassRelease); - - // JSObject - JSC_WRAPPER_METHOD(JSObjectCallAsConstructor); - JSC_WRAPPER_METHOD(JSObjectCallAsFunction); - JSC_WRAPPER_METHOD(JSObjectGetPrivate); - JSC_WRAPPER_METHOD(JSObjectGetProperty); - JSC_WRAPPER_METHOD(JSObjectGetPropertyAtIndex); - JSC_WRAPPER_METHOD(JSObjectIsConstructor); - JSC_WRAPPER_METHOD(JSObjectIsFunction); - JSC_WRAPPER_METHOD(JSObjectMake); - JSC_WRAPPER_METHOD(JSObjectMakeArray); - JSC_WRAPPER_METHOD(JSObjectMakeDate); - JSC_WRAPPER_METHOD(JSObjectMakeError); - JSC_WRAPPER_METHOD(JSObjectMakeFunctionWithCallback); - JSC_WRAPPER_METHOD(JSObjectSetPrivate); - JSC_WRAPPER_METHOD(JSObjectSetProperty); - JSC_WRAPPER_METHOD(JSObjectSetPropertyAtIndex); - - // JSPropertyNameArray - JSC_WRAPPER_METHOD(JSObjectCopyPropertyNames); - JSC_WRAPPER_METHOD(JSPropertyNameArrayGetCount); - JSC_WRAPPER_METHOD(JSPropertyNameArrayGetNameAtIndex); - JSC_WRAPPER_METHOD(JSPropertyNameArrayRelease); - - // JSValue - JSC_WRAPPER_METHOD(JSValueCreateJSONString); - JSC_WRAPPER_METHOD(JSValueGetType); - JSC_WRAPPER_METHOD(JSValueMakeFromJSONString); - JSC_WRAPPER_METHOD(JSValueMakeBoolean); - JSC_WRAPPER_METHOD(JSValueMakeNull); - JSC_WRAPPER_METHOD(JSValueMakeNumber); - JSC_WRAPPER_METHOD(JSValueMakeString); - JSC_WRAPPER_METHOD(JSValueMakeUndefined); - JSC_WRAPPER_METHOD(JSValueProtect); - JSC_WRAPPER_METHOD(JSValueToBoolean); - JSC_WRAPPER_METHOD(JSValueToNumber); - JSC_WRAPPER_METHOD(JSValueToObject); - JSC_WRAPPER_METHOD(JSValueToStringCopy); - JSC_WRAPPER_METHOD(JSValueUnprotect); - JSC_WRAPPER_METHOD(JSValueIsNull); - - // Sampling profiler - JSC_WRAPPER_METHOD(JSSamplingProfilerEnabled); - JSC_WRAPPER_METHOD(JSPokeSamplingProfiler); - JSC_WRAPPER_METHOD(JSStartSamplingProfilingOnMainJSCThread); - - JSC_WRAPPER_METHOD(JSGlobalContextEnableDebugger); - JSC_WRAPPER_METHOD(JSGlobalContextDisableDebugger); - - JSC_WRAPPER_METHOD(configureJSCForIOS); - - // Objective-C API - Class JSContext; - Class JSValue; - - int32_t JSBytecodeFileFormatVersion; -}; - -template -bool isCustomJSCPtr(T *x) { - return (uintptr_t)x & 0x1; -} - -RN_EXPORT bool isCustomJSCWrapperSet(); -RN_EXPORT void setCustomJSCWrapper(const JSCWrapper* wrapper); - -// This will return a single value for the whole life of the process. -RN_EXPORT const JSCWrapper *systemJSCWrapper(); -RN_EXPORT const JSCWrapper *customJSCWrapper(); - -} } - -#else - -namespace facebook { -namespace react { - -template -bool isCustomJSCPtr(T *x) { - // Always use system JSC pointers - return false; -} - -} } - -#endif diff --git a/ReactCommon/jschelpers/JavaScriptCore.h b/ReactCommon/jschelpers/JavaScriptCore.h deleted file mode 100644 index 5a1e8d4a611dff..00000000000000 --- a/ReactCommon/jschelpers/JavaScriptCore.h +++ /dev/null @@ -1,212 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -#if defined(__APPLE__) - -// Use for methods that are taking JSContextRef as a first param -#define __jsc_wrapper(method, ctx, ...) \ - (facebook::react::isCustomJSCPtr(ctx) ? \ - facebook::react::customJSCWrapper() : \ - facebook::react::systemJSCWrapper() \ - )->method(ctx, ## __VA_ARGS__) - -// Use for methods that don't take a JSContextRef as a first param. The wrapped version -// of this method will require context as an additional param, but it will be dropped -// before calling into the JSC method. -#define __jsc_drop_ctx_wrapper(method, ctx, ...) \ - (facebook::react::isCustomJSCPtr(ctx) ? \ - facebook::react::customJSCWrapper() : \ - facebook::react::systemJSCWrapper() \ - )->method(__VA_ARGS__) - -// Use for methods were access to a JSContextRef is impractical. The first bool param -// will be dropped before the JSC method is invoked. -#define __jsc_ensure_bool(field) \ - static_assert(std::is_same::type, bool>::value, "useCustomJSC must be bool"); -#define __jsc_bool_wrapper(method, useCustomJSC, ...) \ - ([]{ __jsc_ensure_bool(useCustomJSC) }, useCustomJSC ? \ - facebook::react::customJSCWrapper() : \ - facebook::react::systemJSCWrapper() \ - )->method(__VA_ARGS__) - -// Used for wrapping properties -#define __jsc_prop_wrapper(prop, ctx) \ - (facebook::react::isCustomJSCPtr(ctx) ? \ - facebook::react::customJSCWrapper() : \ - facebook::react::systemJSCWrapper() \ - )->prop - -// Poison all regular versions of the JSC API in shared code. This prevents accidental -// mixed usage of regular and custom JSC methods. -// See https://gcc.gnu.org/onlinedocs/gcc-3.3/cpp/Pragmas.html for details -#define jsc_pragma(x) _Pragma(#x) -#ifndef NO_JSC_POISON -#define jsc_poison(methods) jsc_pragma(GCC poison methods) -#else -#define jsc_poison(methods) -#endif - -#else - -#define __jsc_wrapper(method, ctx, ...) method(ctx, ## __VA_ARGS__) -#define __jsc_drop_ctx_wrapper(method, ctx, ...) ((void)ctx, method(__VA_ARGS__)) -#define __jsc_bool_wrapper(method, useCustomJSC, ...) \ - ((void)useCustomJSC, method(__VA_ARGS__)) -#define __jsc_prop_wrapper(prop, ctx) prop - -#define jsc_pragma(x) -#define jsc_poison(methods) - -#endif - -// JSGlobalContext -#define JSC_JSGlobalContextCreateInGroup(...) __jsc_bool_wrapper(JSGlobalContextCreateInGroup, __VA_ARGS__) -#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) - -// JSContext -#define JSC_JSContextGetGlobalContext(...) __jsc_wrapper(JSContextGetGlobalContext, __VA_ARGS__) -#define JSC_JSContextGetGlobalObject(...) __jsc_wrapper(JSContextGetGlobalObject, __VA_ARGS__) -#define JSC_FBJSContextStartGCTimers(...) __jsc_wrapper(FBJSContextStartGCTimers, __VA_ARGS__) - -jsc_poison(JSContextGetGlobalContext JSContextGetGlobalObject JSContextGetGroup FBJSContextStartGCTimers) - -// JSEvaluate -#define JSC_JSEvaluateScript(...) __jsc_wrapper(JSEvaluateScript, __VA_ARGS__) -#define JSC_JSEvaluateBytecodeBundle(...) __jsc_wrapper(JSEvaluateBytecodeBundle, __VA_ARGS__) - -jsc_poison(JSCheckScriptSyntax JSEvaluateScript JSEvaluateBytecodeBundle JSGarbageCollect) - -// JSString -#define JSC_JSStringCreateWithCFString(...) __jsc_drop_ctx_wrapper(JSStringCreateWithCFString, __VA_ARGS__) -#define JSC_JSStringCreateWithUTF8CString(...) __jsc_drop_ctx_wrapper(JSStringCreateWithUTF8CString, __VA_ARGS__) -#define JSC_JSStringCreateWithUTF8CStringExpectAscii(...) __jsc_drop_ctx_wrapper(JSStringCreateWithUTF8CStringExpectAscii, __VA_ARGS__) -#define JSC_JSStringCopyCFString(...) __jsc_drop_ctx_wrapper(JSStringCopyCFString, __VA_ARGS__) -#define JSC_JSStringGetCharactersPtr(...) __jsc_drop_ctx_wrapper(JSStringGetCharactersPtr, __VA_ARGS__) -#define JSC_JSStringGetLength(...) __jsc_drop_ctx_wrapper(JSStringGetLength, __VA_ARGS__) -#define JSC_JSStringGetMaximumUTF8CStringSize(...) __jsc_drop_ctx_wrapper(JSStringGetMaximumUTF8CStringSize, __VA_ARGS__) -#define JSC_JSStringIsEqualToUTF8CString(...) __jsc_drop_ctx_wrapper(JSStringIsEqualToUTF8CString, __VA_ARGS__) -#define JSC_JSStringRelease(...) __jsc_drop_ctx_wrapper(JSStringRelease, __VA_ARGS__) -#define JSC_JSStringRetain(...) __jsc_drop_ctx_wrapper(JSStringRetain, __VA_ARGS__) - -jsc_poison(JSStringCopyCFString JSStringCreateWithCharacters JSStringCreateWithCFString - JSStringCreateWithUTF8CString JSStringCreateWithUTF8CStringExpectAscii - JSStringGetCharactersPtr JSStringGetLength JSStringGetMaximumUTF8CStringSize - JSStringGetUTF8CString JSStringIsEqual JSStringIsEqualToUTF8CString - JSStringRelease JSStringRetain) - -// JSValueRef -#define JSC_JSValueCreateJSONString(...) __jsc_wrapper(JSValueCreateJSONString, __VA_ARGS__) -#define JSC_JSValueGetType(...) __jsc_wrapper(JSValueGetType, __VA_ARGS__) -#define JSC_JSValueMakeFromJSONString(...) __jsc_wrapper(JSValueMakeFromJSONString, __VA_ARGS__) -#define JSC_JSValueMakeBoolean(...) __jsc_wrapper(JSValueMakeBoolean, __VA_ARGS__) -#define JSC_JSValueMakeNull(...) __jsc_wrapper(JSValueMakeNull, __VA_ARGS__) -#define JSC_JSValueMakeNumber(...) __jsc_wrapper(JSValueMakeNumber, __VA_ARGS__) -#define JSC_JSValueMakeString(...) __jsc_wrapper(JSValueMakeString, __VA_ARGS__) -#define JSC_JSValueMakeUndefined(...) __jsc_wrapper(JSValueMakeUndefined, __VA_ARGS__) -#define JSC_JSValueProtect(...) __jsc_wrapper(JSValueProtect, __VA_ARGS__) -#define JSC_JSValueToBoolean(...) __jsc_wrapper(JSValueToBoolean, __VA_ARGS__) -#define JSC_JSValueToNumber(...) __jsc_wrapper(JSValueToNumber, __VA_ARGS__) -#define JSC_JSValueToObject(...) __jsc_wrapper(JSValueToObject, __VA_ARGS__) -#define JSC_JSValueToStringCopy(...) __jsc_wrapper(JSValueToStringCopy, __VA_ARGS__) -#define JSC_JSValueUnprotect(...) __jsc_wrapper(JSValueUnprotect, __VA_ARGS__) -#define JSC_JSValueIsNull(...) __jsc_wrapper(JSValueIsNull, __VA_ARGS__) - -jsc_poison(JSValueCreateJSONString JSValueGetType JSValueGetTypedArrayType JSValueIsArray - JSValueIsBoolean JSValueIsDate JSValueIsEqual JSValueIsInstanceOfConstructor - JSValueIsNull JSValueIsNumber JSValueIsObject JSValueIsObjectOfClass - JSValueIsStrictEqual JSValueIsString JSValueIsString JSValueIsUndefined - JSValueMakeBoolean JSValueMakeFromJSONString JSValueMakeNull JSValueMakeNumber - JSValueMakeString JSValueMakeUndefined JSValueProtect JSValueToBoolean - JSValueToNumber JSValueToObject JSValueToStringCopy JSValueUnprotect) - -// 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) - -// JSObject -#define JSC_JSObjectCallAsConstructor(...) __jsc_wrapper(JSObjectCallAsConstructor, __VA_ARGS__) -#define JSC_JSObjectCallAsFunction(...) __jsc_wrapper(JSObjectCallAsFunction, __VA_ARGS__) -#define JSC_JSObjectGetPrivate(...) __jsc_bool_wrapper(JSObjectGetPrivate, __VA_ARGS__) -#define JSC_JSObjectGetProperty(...) __jsc_wrapper(JSObjectGetProperty, __VA_ARGS__) -#define JSC_JSObjectGetPropertyAtIndex(...) __jsc_wrapper(JSObjectGetPropertyAtIndex, __VA_ARGS__) -#define JSC_JSObjectIsConstructor(...) __jsc_wrapper(JSObjectIsConstructor, __VA_ARGS__) -#define JSC_JSObjectIsFunction(...) __jsc_wrapper(JSObjectIsFunction, __VA_ARGS__) -#define JSC_JSObjectMake(...) __jsc_wrapper(JSObjectMake, __VA_ARGS__) -#define JSC_JSObjectMakeArray(...) __jsc_wrapper(JSObjectMakeArray, __VA_ARGS__) -#define JSC_JSObjectMakeDate(...) __jsc_wrapper(JSObjectMakeDate, __VA_ARGS__) -#define JSC_JSObjectMakeError(...) __jsc_wrapper(JSObjectMakeError, __VA_ARGS__) -#define JSC_JSObjectMakeFunctionWithCallback(...) __jsc_wrapper(JSObjectMakeFunctionWithCallback, __VA_ARGS__) -#define JSC_JSObjectSetPrivate(...) __jsc_bool_wrapper(JSObjectSetPrivate, __VA_ARGS__) -#define JSC_JSObjectSetProperty(...) __jsc_wrapper(JSObjectSetProperty, __VA_ARGS__) -#define JSC_JSObjectSetPropertyAtIndex(...) __jsc_wrapper(JSObjectSetPropertyAtIndex, __VA_ARGS__) - -jsc_poison(JSObjectCallAsConstructor JSObjectCallAsFunction JSObjectDeleteProperty - JSObjectGetPrivate JSObjectGetProperty JSObjectGetPropertyAtIndex - JSObjectGetPrototype JSObjectHasProperty JSObjectIsConstructor - JSObjectIsFunction JSObjectMake JSObjectMakeArray JSObjectMakeConstructor - JSObjectMakeDate JSObjectMakeError JSObjectMakeFunction - JSObjectMakeFunctionWithCallback JSObjectMakeRegExp JSObjectSetPrivate - JSObjectSetPrototype JSObjectSetProperty JSObjectSetPropertyAtIndex) - -// JSPropertyNameArray -#define JSC_JSObjectCopyPropertyNames(...) __jsc_wrapper(JSObjectCopyPropertyNames, __VA_ARGS__) -#define JSC_JSPropertyNameArrayGetCount(...) __jsc_drop_ctx_wrapper(JSPropertyNameArrayGetCount, __VA_ARGS__) -#define JSC_JSPropertyNameArrayGetNameAtIndex(...) __jsc_drop_ctx_wrapper(JSPropertyNameArrayGetNameAtIndex, __VA_ARGS__) -#define JSC_JSPropertyNameArrayRelease(...) __jsc_drop_ctx_wrapper(JSPropertyNameArrayRelease, __VA_ARGS__) - -jsc_poison(JSObjectCopyPropertyNames JSPropertyNameAccumulatorAddName - JSPropertyNameArrayGetCount JSPropertyNameArrayGetNameAtIndex - JSPropertyNameArrayRelease JSPropertyNameArrayRetain) - -// JSTypedArray -jsc_poison(JSObjectMakeArrayBufferWithBytesNoCopy JSObjectMakeTypedArray - JSObjectMakeTypedArrayWithArrayBuffer - JSObjectMakeTypedArrayWithArrayBufferAndOffset - JSObjectMakeTypedArrayWithBytesNoCopy JSObjectGetTypedArrayByteLength - JSObjectGetTypedArrayByteOffset JSObjectGetTypedArrayBytesPtr - JSObjectGetTypedArrayBuffer JSObjectGetTypedArrayLength - JSObjectGetArrayBufferBytesPtr JSObjectGetArrayBufferByteLength) - -// Sampling profiler -#define JSC_JSSamplingProfilerEnabled(...) __jsc_drop_ctx_wrapper(JSSamplingProfilerEnabled, __VA_ARGS__) -#define JSC_JSPokeSamplingProfiler(...) __jsc_wrapper(JSPokeSamplingProfiler, __VA_ARGS__) -#define JSC_JSStartSamplingProfilingOnMainJSCThread(...) __jsc_wrapper(JSStartSamplingProfilingOnMainJSCThread, __VA_ARGS__) - -jsc_poison(JSSamplingProfilerEnabled JSPokeSamplingProfiler - JSStartSamplingProfilingOnMainJSCThread) - -#define JSC_JSGlobalContextEnableDebugger(...) __jsc_wrapper(JSGlobalContextEnableDebugger, __VA_ARGS__) -// no need to poison JSGlobalContextEnableDebugger because it's not defined for System JSC / standard SDK header -// jsc_poison(JSGlobalContextEnableDebugger) - -#define JSC_JSGlobalContextDisableDebugger(...) __jsc_wrapper(JSGlobalContextDisableDebugger, __VA_ARGS__) -// no need to poison JSGlobalContextDisableDebugger because it's not defined for System JSC / standard SDK header -// jsc_poison(JSGlobalContextDisableDebugger) - - -#define JSC_configureJSCForIOS(...) __jsc_bool_wrapper(configureJSCForIOS, __VA_ARGS__) - -jsc_poison(configureJSCForIOS) - -// Objective-C API -#define JSC_JSContext(ctx) __jsc_prop_wrapper(JSContext, ctx) -#define JSC_JSValue(ctx) __jsc_prop_wrapper(JSValue, ctx) - -#undef jsc_poison -#undef jsc_pragma diff --git a/ReactCommon/jschelpers/Unicode.cpp b/ReactCommon/jschelpers/Unicode.cpp deleted file mode 100644 index 2abbc1ebd2b7c3..00000000000000 --- a/ReactCommon/jschelpers/Unicode.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "Unicode.h" - -namespace facebook { -namespace react { -namespace unicode { -namespace { - -// TODO(12827176): Don't duplicate this code here and fbjni. - -const uint16_t kUtf8OneByteBoundary = 0x80; -const uint16_t kUtf8TwoBytesBoundary = 0x800; -const uint16_t kUtf16HighSubLowBoundary = 0xD800; -const uint16_t kUtf16HighSubHighBoundary = 0xDC00; -const uint16_t kUtf16LowSubHighBoundary = 0xE000; - -// Calculate how many bytes are needed to convert an UTF16 string into UTF8 -// UTF16 string -size_t utf16toUTF8Length(const uint16_t* utf16String, size_t utf16StringLen) { - if (!utf16String || utf16StringLen == 0) { - return 0; - } - - uint32_t utf8StringLen = 0; - auto utf16StringEnd = utf16String + utf16StringLen; - auto idx16 = utf16String; - while (idx16 < utf16StringEnd) { - auto ch = *idx16++; - if (ch < kUtf8OneByteBoundary) { - utf8StringLen++; - } else if (ch < kUtf8TwoBytesBoundary) { - utf8StringLen += 2; - } else if ( - (ch >= kUtf16HighSubLowBoundary) && (ch < kUtf16HighSubHighBoundary) && - (idx16 < utf16StringEnd) && - (*idx16 >= kUtf16HighSubHighBoundary) && (*idx16 < kUtf16LowSubHighBoundary)) { - utf8StringLen += 4; - idx16++; - } else { - utf8StringLen += 3; - } - } - - return utf8StringLen; -} - -} // namespace - -std::string utf16toUTF8(const uint16_t* utf16String, size_t utf16StringLen) noexcept { - if (!utf16String || utf16StringLen <= 0) { - return ""; - } - - std::string utf8String(utf16toUTF8Length(utf16String, utf16StringLen), '\0'); - auto idx8 = utf8String.begin(); - auto idx16 = utf16String; - auto utf16StringEnd = utf16String + utf16StringLen; - while (idx16 < utf16StringEnd) { - auto ch = *idx16++; - if (ch < kUtf8OneByteBoundary) { - *idx8++ = (ch & 0x7F); - } else if (ch < kUtf8TwoBytesBoundary) { - *idx8++ = 0b11000000 | (ch >> 6); - *idx8++ = 0b10000000 | (ch & 0x3F); - } else if ( - (ch >= kUtf16HighSubLowBoundary) && (ch < kUtf16HighSubHighBoundary) && - (idx16 < utf16StringEnd) && - (*idx16 >= kUtf16HighSubHighBoundary) && (*idx16 < kUtf16LowSubHighBoundary)) { - auto ch2 = *idx16++; - uint8_t trunc_byte = (((ch >> 6) & 0x0F) + 1); - *idx8++ = 0b11110000 | (trunc_byte >> 2); - *idx8++ = 0b10000000 | ((trunc_byte & 0x03) << 4) | ((ch >> 2) & 0x0F); - *idx8++ = 0b10000000 | ((ch & 0x03) << 4) | ((ch2 >> 6) & 0x0F); - *idx8++ = 0b10000000 | (ch2 & 0x3F); - } else { - *idx8++ = 0b11100000 | (ch >> 12); - *idx8++ = 0b10000000 | ((ch >> 6) & 0x3F); - *idx8++ = 0b10000000 | (ch & 0x3F); - } - } - - return utf8String; -} - -} // namespace unicode -} // namespace react -} // namespace facebook diff --git a/ReactCommon/jschelpers/Unicode.h b/ReactCommon/jschelpers/Unicode.h deleted file mode 100644 index 3948d29eb25cc5..00000000000000 --- a/ReactCommon/jschelpers/Unicode.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include - -namespace facebook { -namespace react { -namespace unicode { -__attribute__((visibility("default"))) std::string utf16toUTF8(const uint16_t* utf16, size_t length) noexcept; -} -} -} diff --git a/ReactCommon/jschelpers/Value.cpp b/ReactCommon/jschelpers/Value.cpp deleted file mode 100644 index 9ced5c2e5413f3..00000000000000 --- a/ReactCommon/jschelpers/Value.cpp +++ /dev/null @@ -1,325 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "Value.h" - -#include -#include - -#include "JSCHelpers.h" -#include "JavaScriptCore.h" - -// See the comment under Value::fromDynamic() -#if !defined(__APPLE__) && defined(WITH_FB_JSC_TUNING) -#define USE_FAST_FOLLY_DYNAMIC_CONVERSION 1 -#else -#define USE_FAST_FOLLY_DYNAMIC_CONVERSION 0 -#endif - -namespace facebook { -namespace react { - -/* static */ -Object Object::makeDate(JSContextRef ctx, Object::TimeType time) { - using std::chrono::duration_cast; - using std::chrono::milliseconds; - - JSValueRef arguments[1]; - arguments[0] = JSC_JSValueMakeNumber( - ctx, - duration_cast(time.time_since_epoch()).count()); - - JSValueRef exn; - auto result = JSC_JSObjectMakeDate(ctx, 1, arguments, &exn); - if (!result) { - throw JSException(ctx, exn, "Failed to create Date"); - } - return Object(ctx, result); -} - -Object Object::makeArray(JSContextRef ctx, JSValueRef* elements, unsigned length) { - JSValueRef exn; - auto arr = JSC_JSObjectMakeArray(ctx, length, elements, &exn); - if (!arr) { - throw JSException(ctx, exn, "Failed to create an Array"); - } - return Object(ctx, arr); -} - -Value::Value(JSContextRef context, JSValueRef value) - : m_context(context), m_value(value) {} - -Value::Value(JSContextRef context, JSStringRef str) - : m_context(context), m_value(JSC_JSValueMakeString(context, str)) {} - -JSContextRef Value::context() const { - return m_context; -} - -/* static */ -std::string Value::toJSONString(unsigned indent) const { - JSValueRef exn; - auto stringToAdopt = JSC_JSValueCreateJSONString(m_context, m_value, indent, &exn); - if (!stringToAdopt) { - throw JSException(m_context, exn, "Exception creating JSON string"); - } - return String::adopt(m_context, stringToAdopt).str(); -} - -/* static */ -Value Value::fromJSON(const String& json) { - JSContextRef ctx = json.context(); - auto result = JSC_JSValueMakeFromJSONString(ctx, json); - if (!result) { - throw JSException(folly::to( - "Failed to create Value from JSON: ", json.str()).c_str()); - } - return Value(ctx, result); -} - -Value Value::fromDynamic(JSContextRef ctx, const folly::dynamic& value) { -// JavaScriptCore's iOS APIs have their own version of this direct conversion. -// In addition, using this requires exposing some of JSC's private APIs, -// so it's limited to non-apple platforms and to builds that use the custom JSC. -// Otherwise, we use the old way of converting through JSON. -#if USE_FAST_FOLLY_DYNAMIC_CONVERSION - // Defer GC during the creation of the JSValue, as we don't want - // intermediate objects to be collected. - // We could use JSValueProtect(), but it will make the process much slower. - JSDeferredGCRef deferGC = JSDeferGarbageCollection(ctx); - // Set a global lock for the whole process, - // instead of re-acquiring the lock for each operation. - JSLock(ctx); - JSValueRef jsVal = Value::fromDynamicInner(ctx, value); - JSUnlock(ctx); - JSResumeGarbageCollection(ctx, deferGC); - return Value(ctx, jsVal); -#else - auto json = folly::toJson(value); - return fromJSON(String(ctx, json.c_str())); -#endif -} - -JSValueRef Value::fromDynamicInner(JSContextRef ctx, const folly::dynamic& obj) { - switch (obj.type()) { - // For primitive types (and strings), just create and return an equivalent JSValue - case folly::dynamic::Type::NULLT: - return JSC_JSValueMakeNull(ctx); - - case folly::dynamic::Type::BOOL: - return JSC_JSValueMakeBoolean(ctx, obj.getBool()); - - case folly::dynamic::Type::DOUBLE: - return JSC_JSValueMakeNumber(ctx, obj.getDouble()); - - case folly::dynamic::Type::INT64: - return JSC_JSValueMakeNumber(ctx, obj.asDouble()); - - case folly::dynamic::Type::STRING: - return JSC_JSValueMakeString(ctx, String(ctx, obj.getString().c_str())); - - case folly::dynamic::Type::ARRAY: { - // Collect JSValue for every element in the array - JSValueRef vals[obj.size()]; - for (size_t i = 0; i < obj.size(); ++i) { - vals[i] = fromDynamicInner(ctx, obj[i]); - } - // Create a JSArray with the values - JSValueRef arr = JSC_JSObjectMakeArray(ctx, obj.size(), vals, nullptr); - return arr; - } - - case folly::dynamic::Type::OBJECT: { - // Create an empty object - JSObjectRef jsObj = JSC_JSObjectMake(ctx, nullptr, nullptr); - // Create a JSValue for each of the object's children and set them in the object - for (auto it = obj.items().begin(); it != obj.items().end(); ++it) { - JSC_JSObjectSetProperty( - ctx, - jsObj, - String(ctx, it->first.asString().c_str()), - fromDynamicInner(ctx, it->second), - kJSPropertyAttributeNone, - nullptr); - } - return jsObj; - } - default: - // Assert not reached - LOG(FATAL) << "Trying to convert a folly object of unsupported type."; - return JSC_JSValueMakeNull(ctx); - } -} - -Object Value::asObject() const { - JSValueRef exn; - JSObjectRef jsObj = JSC_JSValueToObject(context(), m_value, &exn); - if (!jsObj) { - throw JSException(m_context, exn, "Failed to convert to object"); - } - return Object(context(), jsObj); -} - -String Value::toString() const { - JSValueRef exn; - JSStringRef jsStr = JSC_JSValueToStringCopy(context(), m_value, &exn); - if (!jsStr) { - throw JSException(m_context, exn, "Failed to convert to string"); - } - return String::adopt(context(), jsStr); -} - -Value Value::makeError(JSContextRef ctx, const char *error, const char *stack) -{ - auto errorMsg = Value(ctx, String(ctx, error)); - JSValueRef args[] = {errorMsg}; - if (stack) { - // Using this instead of JSObjectMakeError to actually get a stack property. - // MakeError only sets it stack when returning from the invoked function, so we - // can't extend it here. - auto errorConstructor = Object::getGlobalObject(ctx).getProperty("Error").asObject(); - auto jsError = errorConstructor.callAsConstructor({errorMsg}); - auto fullStack = std::string(stack) + jsError.getProperty("stack").toString().str(); - jsError.setProperty("stack", String(ctx, fullStack.c_str())); - return jsError; - } else { - JSValueRef exn; - JSObjectRef errorObj = JSC_JSObjectMakeError(ctx, 1, args, &exn); - if (!errorObj) { - throw JSException(ctx, exn, "Exception making error"); - } - return Value(ctx, errorObj); - } -} - -void Value::throwTypeException(const std::string &expectedType) const { - std::string wat("TypeError: Expected "); - wat += expectedType; - wat += ", instead got '"; - wat += toString().str(); - wat += "'"; - throw JSException(wat.c_str()); -} - -Object::operator Value() const { - return Value(m_context, m_obj); -} - -Value Object::callAsFunction(std::initializer_list args) const { - return callAsFunction(nullptr, args.size(), args.begin()); -} - -Value Object::callAsFunction(const Object& thisObj, std::initializer_list args) const { - return callAsFunction((JSObjectRef)thisObj, args.size(), args.begin()); -} - -Value Object::callAsFunction(int nArgs, const JSValueRef args[]) const { - return callAsFunction(nullptr, nArgs, args); -} - -Value Object::callAsFunction(const Object& thisObj, int nArgs, const JSValueRef args[]) const { - return callAsFunction(static_cast(thisObj), nArgs, args); -} - -Value Object::callAsFunction(JSObjectRef thisObj, int nArgs, const JSValueRef args[]) const { - JSValueRef exn; - JSValueRef result = JSC_JSObjectCallAsFunction(m_context, m_obj, thisObj, nArgs, args, &exn); - if (!result) { - throw JSException(m_context, exn, "Exception calling object as function"); - } - return Value(m_context, result); -} - -Object Object::callAsConstructor(std::initializer_list args) const { - JSValueRef exn; - JSObjectRef result = JSC_JSObjectCallAsConstructor(m_context, m_obj, args.size(), args.begin(), &exn); - if (!result) { - throw JSException(m_context, exn, "Exception calling object as constructor"); - } - return Object(m_context, result); -} - -Value Object::getProperty(const String& propName) const { - JSValueRef exn; - JSValueRef property = JSC_JSObjectGetProperty(m_context, m_obj, propName, &exn); - if (!property) { - throw JSException(m_context, exn, folly::to( - "Failed to get property '", propName.str(), "'").c_str()); - } - return Value(m_context, property); -} - -Value Object::getPropertyAtIndex(unsigned int index) const { - JSValueRef exn; - JSValueRef property = JSC_JSObjectGetPropertyAtIndex(m_context, m_obj, index, &exn); - if (!property) { - throw JSException(m_context, exn, folly::to( - "Failed to get property at index ", index).c_str()); - } - return Value(m_context, property); -} - -Value Object::getProperty(const char *propName) const { - return getProperty(String(m_context, propName)); -} - -void Object::setProperty(const String& propName, const Value& value) { - JSValueRef exn = nullptr; - JSC_JSObjectSetProperty(m_context, m_obj, propName, value, kJSPropertyAttributeNone, &exn); - if (exn) { - throw JSException(m_context, exn, folly::to( - "Failed to set property '", propName.str(), "'").c_str()); - } -} - -void Object::setPropertyAtIndex(unsigned int index, const Value& value) { - JSValueRef exn = nullptr; - JSC_JSObjectSetPropertyAtIndex(m_context, m_obj, index, value, &exn); - if (exn) { - throw JSException(m_context, exn, folly::to( - "Failed to set property at index ", index).c_str()); - } -} - -void Object::setProperty(const char *propName, const Value& value) { - setProperty(String(m_context, propName), value); -} - -std::vector Object::getPropertyNames() const { - auto namesRef = JSC_JSObjectCopyPropertyNames(m_context, m_obj); - size_t count = JSC_JSPropertyNameArrayGetCount(m_context, namesRef); - std::vector names; - names.reserve(count); - for (size_t i = 0; i < count; i++) { - names.emplace_back(String::ref(m_context, - JSC_JSPropertyNameArrayGetNameAtIndex(m_context, namesRef, i))); - } - JSC_JSPropertyNameArrayRelease(m_context, namesRef); - return names; -} - -std::unordered_map Object::toJSONMap() const { - std::unordered_map map; - auto namesRef = JSC_JSObjectCopyPropertyNames(m_context, m_obj); - size_t count = JSC_JSPropertyNameArrayGetCount(m_context, namesRef); - for (size_t i = 0; i < count; i++) { - auto key = String::ref(m_context, - JSC_JSPropertyNameArrayGetNameAtIndex(m_context, namesRef, i)); - map.emplace(key.str(), getProperty(key).toJSONString()); - } - JSC_JSPropertyNameArrayRelease(m_context, namesRef); - return map; -} - -/* static */ -Object Object::create(JSContextRef ctx) { - JSObjectRef newObj = JSC_JSObjectMake( - ctx, - NULL, // create instance of default object class - NULL); // no private data - return Object(ctx, newObj); -} - -} } diff --git a/ReactCommon/jschelpers/Value.h b/ReactCommon/jschelpers/Value.h deleted file mode 100644 index 13036e75a2b404..00000000000000 --- a/ReactCommon/jschelpers/Value.h +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#ifndef RN_EXPORT -#define RN_EXPORT __attribute__((visibility("default"))) -#endif - -namespace facebook { -namespace react { - -class Value; - -// C++ object wrapper for JSStringRef -class String : public noncopyable { -public: - explicit String(): m_context(nullptr), m_string(nullptr) {} // dummy empty constructor - - explicit String(JSContextRef context, const char* utf8) - : m_context(context), m_string(JSC_JSStringCreateWithUTF8CString(context, utf8)) {} - - String(String&& other) : - m_context(other.m_context), m_string(other.m_string) - { - other.m_string = nullptr; - } - - String(const String& other) : - m_context(other.m_context), m_string(other.m_string) - { - if (m_string) { - JSC_JSStringRetain(m_context, m_string); - } - } - - ~String() { - if (m_string) { - JSC_JSStringRelease(m_context, m_string); - } - } - - String& operator=(String&& other) { - if (m_string) { - JSC_JSStringRelease(m_context, m_string); - } - - m_context = other.m_context; - m_string = other.m_string; - other.m_string = nullptr; - - return *this; - } - - operator JSStringRef() const { - return m_string; - } - - JSContextRef context() const { - return m_context; - } - - // Length in characters - size_t length() const { - return m_string ? JSC_JSStringGetLength(m_context, m_string) : 0; - } - - // Length in bytes of a nul-terminated utf8 encoded value - size_t utf8Size() const { - return m_string ? JSC_JSStringGetMaximumUTF8CStringSize(m_context, m_string) : 0; - } - - /* - * JavaScriptCore is built with strict utf16 -> utf8 conversion. - * This means if JSC's built-in conversion function encounters a JavaScript - * string which contains half of a 32-bit UTF-16 symbol, it produces an error - * rather than returning a string. - * - * Instead of relying on this, we use our own utf16 -> utf8 conversion function - * which is more lenient and always returns a string. When an invalid UTF-16 - * string is provided, it'll likely manifest as a rendering glitch in the app for - * the invalid symbol. - * - * For details on JavaScript's unicode support see: - * https://mathiasbynens.be/notes/javascript-unicode - */ - std::string str() const { - if (!m_string) { - return ""; - } - const JSChar* utf16 = JSC_JSStringGetCharactersPtr(m_context, m_string); - size_t stringLength = JSC_JSStringGetLength(m_context, m_string); - return unicode::utf16toUTF8(utf16, stringLength); - } - - // Assumes that utf8 is nul-terminated - bool equals(const char* utf8) { - return m_string ? JSC_JSStringIsEqualToUTF8CString(m_context, m_string, utf8) : false; - } - - // This assumes ascii is nul-terminated. - static String createExpectingAscii(JSContextRef context, const char* ascii, size_t len) { -#if WITH_FBJSCEXTENSIONS - return String(context, JSC_JSStringCreateWithUTF8CStringExpectAscii(context, ascii, len), true); -#else - return String(context, JSC_JSStringCreateWithUTF8CString(context, ascii), true); -#endif - } - - static String createExpectingAscii(JSContextRef context, std::string const &ascii) { - return createExpectingAscii(context, ascii.c_str(), ascii.size()); - } - - // Creates a String wrapper and increases the refcount of the JSStringRef - static String ref(JSContextRef context, JSStringRef string) { - return String(context, string, false); - } - - // Creates a String wrapper that takes over ownership of the string. The - // JSStringRef passed in must previously have been created or retained. - static String adopt(JSContextRef context, JSStringRef string) { - return String(context, string, true); - } - -private: - explicit String(JSContextRef context, JSStringRef string, bool adopt) : - m_context(context), m_string(string) - { - if (!adopt && string) { - JSC_JSStringRetain(context, string); - } - } - - JSContextRef m_context; - JSStringRef m_string; -}; - -// C++ object wrapper for JSObjectRef. The underlying JSObjectRef can be -// optionally protected. You must protect the object if it is ever -// heap-allocated, since otherwise you may end up with an invalid reference. -class Object : public noncopyable { -public: - using TimeType = std::chrono::time_point; - - Object(JSContextRef context, JSObjectRef obj) : - m_context(context), - m_obj(obj) - {} - - Object(Object&& other) : - m_context(other.m_context), - m_obj(other.m_obj), - m_isProtected(other.m_isProtected) { - other.m_obj = nullptr; - other.m_isProtected = false; - } - - ~Object() { - if (m_isProtected && m_obj) { - JSC_JSValueUnprotect(m_context, m_obj); - } - } - - Object& operator=(Object&& other) { - std::swap(m_context, other.m_context); - std::swap(m_obj, other.m_obj); - std::swap(m_isProtected, other.m_isProtected); - return *this; - } - - operator JSObjectRef() const { - return m_obj; - } - - operator Value() const; - - bool isFunction() const { - return JSC_JSObjectIsFunction(m_context, m_obj); - } - - Value callAsFunction(std::initializer_list args) const; - Value callAsFunction(const Object& thisObj, std::initializer_list args) const; - Value callAsFunction(int nArgs, const JSValueRef args[]) const; - Value callAsFunction(const Object& thisObj, int nArgs, const JSValueRef args[]) const; - - Object callAsConstructor(std::initializer_list args) const; - - Value getProperty(const String& propName) const; - Value getProperty(const char *propName) const; - Value getPropertyAtIndex(unsigned int index) const; - void setProperty(const String& propName, const Value& value); - void setProperty(const char *propName, const Value& value); - void setPropertyAtIndex(unsigned int index, const Value& value); - std::vector getPropertyNames() const; - std::unordered_map toJSONMap() const; - - void makeProtected() { - if (!m_isProtected && m_obj) { - JSC_JSValueProtect(m_context, m_obj); - m_isProtected = true; - } - } - - RN_EXPORT static Object makeArray(JSContextRef ctx, JSValueRef* elements, unsigned length); - RN_EXPORT static Object makeDate(JSContextRef ctx, TimeType time); - - template - ReturnType* getPrivate() const { - const bool isCustomJSC = isCustomJSCPtr(m_context); - return PrivateDataBase::cast(JSC_JSObjectGetPrivate(isCustomJSC, m_obj)); - } - - void setPrivate(PrivateDataBase* data) const { - const bool isCustomJSC = isCustomJSCPtr(m_context); - JSC_JSObjectSetPrivate(isCustomJSC, m_obj, data); - } - - JSContextRef context() const { - return m_context; - } - - static Object getGlobalObject(JSContextRef ctx) { - auto globalObj = JSC_JSContextGetGlobalObject(ctx); - return Object(ctx, globalObj); - } - - /** - * Creates an instance of the default object class. - */ - static Object create(JSContextRef ctx); - -private: - JSContextRef m_context; - JSObjectRef m_obj; - bool m_isProtected = false; - - Value callAsFunction(JSObjectRef thisObj, int nArgs, const JSValueRef args[]) const; -}; - -// C++ object wrapper for JSValueRef. The underlying JSValueRef is not -// protected, so this class should always be used as a stack-allocated -// variable. -class Value : public noncopyable { -public: - RN_EXPORT Value(JSContextRef context, JSValueRef value); - RN_EXPORT Value(JSContextRef context, JSStringRef value); - - RN_EXPORT Value(const Value &o) : Value(o.m_context, o.m_value) {} - RN_EXPORT Value(const String &o) : Value(o.context(), o) {} - - Value& operator=(Value&& other) { - m_context = other.m_context; - m_value = other.m_value; - other.m_value = NULL; - return *this; - }; - - operator JSValueRef() const { - return m_value; - } - - JSType getType() const { - return JSC_JSValueGetType(m_context, m_value); - } - - bool isBoolean() const { - return getType() == kJSTypeBoolean; - } - - bool asBoolean() const { - return JSC_JSValueToBoolean(context(), m_value); - } - - bool isNumber() const { - return getType() == kJSTypeNumber; - } - - bool isNull() const { - return getType() == kJSTypeNull; - } - - bool isUndefined() const { - return getType() == kJSTypeUndefined; - } - - double asNumber() const { - if (isNumber()) { - return JSC_JSValueToNumber(context(), m_value, nullptr); - } else { - return 0.0f; - } - } - - double getNumberOrThrow() const { - if (!isNumber()) { - throwTypeException("Number"); - } - return JSC_JSValueToNumber(context(), m_value, nullptr); - } - - int32_t asInteger() const { - return static_cast(asNumber()); - } - - uint32_t asUnsignedInteger() const { - return static_cast(asNumber()); - } - - bool isObject() const { - return getType() == kJSTypeObject; - } - - RN_EXPORT Object asObject() const; - - bool isString() const { - return getType() == kJSTypeString; - } - - RN_EXPORT String toString() const; - - // Create an error, optionally adding an additional number of lines to the stack. - // Stack must be empty or newline terminated. - RN_EXPORT static Value makeError(JSContextRef ctx, const char *error, const char *stack = nullptr); - - static Value makeNumber(JSContextRef ctx, double value) { - return Value(ctx, JSC_JSValueMakeNumber(ctx, value)); - } - - static Value makeUndefined(JSContextRef ctx) { - return Value(ctx, JSC_JSValueMakeUndefined(ctx)); - } - - static Value makeNull(JSContextRef ctx) { - return Value(ctx, JSC_JSValueMakeNull(ctx)); - } - - static Value makeBoolean(JSContextRef ctx, bool value) { - return Value(ctx, JSC_JSValueMakeBoolean(ctx, value)); - } - - static Value makeString(JSContextRef ctx, const char* utf8) { - return Value(ctx, String(ctx, utf8)); - } - - RN_EXPORT std::string toJSONString(unsigned indent = 0) const; - RN_EXPORT static Value fromJSON(const String& json); - RN_EXPORT static Value fromDynamic(JSContextRef ctx, const folly::dynamic& value); - RN_EXPORT JSContextRef context() const; - -private: - JSContextRef m_context; - JSValueRef m_value; - - void throwTypeException(const std::string &expectedType) const; - static JSValueRef fromDynamicInner(JSContextRef ctx, const folly::dynamic& obj); - -}; - -} } diff --git a/ReactCommon/jschelpers/noncopyable.h b/ReactCommon/jschelpers/noncopyable.h deleted file mode 100644 index 1528c1ff1e3f68..00000000000000 --- a/ReactCommon/jschelpers/noncopyable.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once -namespace facebook { -namespace react { -struct noncopyable { - noncopyable(const noncopyable&) = delete; - noncopyable& operator=(const noncopyable&) = delete; - protected: - noncopyable() = default; -}; -}} diff --git a/ReactCommon/jschelpers/systemJSCWrapper.cpp b/ReactCommon/jschelpers/systemJSCWrapper.cpp deleted file mode 100644 index 23a686be7b25b1..00000000000000 --- a/ReactCommon/jschelpers/systemJSCWrapper.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#if defined(__APPLE__) - -#include - -#include - -// Crash the app (with a descriptive stack trace) if a function that is not supported by -// the system JSC is called. -#define UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(FUNC_NAME) \ -static void Unimplemented_##FUNC_NAME(__unused void* args...) { \ - assert(false); \ -} - -UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSEvaluateBytecodeBundle) -#if WITH_FBJSCEXTENSIONS -UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSStringCreateWithUTF8CStringExpectAscii) -#endif -UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSPokeSamplingProfiler) -UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSStartSamplingProfilingOnMainJSCThread) - -UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSGlobalContextEnableDebugger) -UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(JSGlobalContextDisableDebugger) - -UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(configureJSCForIOS) - -UNIMPLEMENTED_SYSTEM_JSC_FUNCTION(FBJSContextStartGCTimers) - -bool JSSamplingProfilerEnabled() { - return false; -} - -const int32_t JSNoBytecodeFileFormatVersion = -1; - -namespace facebook { -namespace react { - -static JSCWrapper s_systemWrapper = {}; - -const JSCWrapper* systemJSCWrapper() { - // Note that this is not used on Android. All methods are statically linked instead. - // Some fields are lazily initialized - static std::once_flag flag; - std::call_once(flag, []() { - s_systemWrapper = { - .JSGlobalContextCreateInGroup = JSGlobalContextCreateInGroup, - .JSGlobalContextRelease = JSGlobalContextRelease, - .JSGlobalContextSetName = JSGlobalContextSetName, - - .JSContextGetGlobalContext = JSContextGetGlobalContext, - .JSContextGetGlobalObject = JSContextGetGlobalObject, - .FBJSContextStartGCTimers = - (decltype(&FBJSContextStartGCTimers)) - Unimplemented_FBJSContextStartGCTimers, - - .JSEvaluateScript = JSEvaluateScript, - .JSEvaluateBytecodeBundle = - (decltype(&JSEvaluateBytecodeBundle)) - Unimplemented_JSEvaluateBytecodeBundle, - - .JSStringCreateWithUTF8CString = JSStringCreateWithUTF8CString, - .JSStringCreateWithCFString = JSStringCreateWithCFString, - #if WITH_FBJSCEXTENSIONS - .JSStringCreateWithUTF8CStringExpectAscii = - (decltype(&JSStringCreateWithUTF8CStringExpectAscii)) - Unimplemented_JSStringCreateWithUTF8CStringExpectAscii, - #endif - .JSStringCopyCFString = JSStringCopyCFString, - .JSStringGetCharactersPtr = JSStringGetCharactersPtr, - .JSStringGetLength = JSStringGetLength, - .JSStringGetMaximumUTF8CStringSize = JSStringGetMaximumUTF8CStringSize, - .JSStringIsEqualToUTF8CString = JSStringIsEqualToUTF8CString, - .JSStringRelease = JSStringRelease, - .JSStringRetain = JSStringRetain, - - .JSClassCreate = JSClassCreate, - .JSClassRetain = JSClassRetain, - .JSClassRelease = JSClassRelease, - - .JSObjectCallAsConstructor = JSObjectCallAsConstructor, - .JSObjectCallAsFunction = JSObjectCallAsFunction, - .JSObjectGetPrivate = JSObjectGetPrivate, - .JSObjectGetProperty = JSObjectGetProperty, - .JSObjectGetPropertyAtIndex = JSObjectGetPropertyAtIndex, - .JSObjectIsConstructor = JSObjectIsConstructor, - .JSObjectIsFunction = JSObjectIsFunction, - .JSObjectMake = JSObjectMake, - .JSObjectMakeArray = JSObjectMakeArray, - .JSObjectMakeDate = JSObjectMakeDate, - .JSObjectMakeError = JSObjectMakeError, - .JSObjectMakeFunctionWithCallback = JSObjectMakeFunctionWithCallback, - .JSObjectSetPrivate = JSObjectSetPrivate, - .JSObjectSetProperty = JSObjectSetProperty, - .JSObjectSetPropertyAtIndex = JSObjectSetPropertyAtIndex, - - .JSObjectCopyPropertyNames = JSObjectCopyPropertyNames, - .JSPropertyNameArrayGetCount = JSPropertyNameArrayGetCount, - .JSPropertyNameArrayGetNameAtIndex = JSPropertyNameArrayGetNameAtIndex, - .JSPropertyNameArrayRelease = JSPropertyNameArrayRelease, - - .JSValueCreateJSONString = JSValueCreateJSONString, - .JSValueGetType = JSValueGetType, - .JSValueMakeFromJSONString = JSValueMakeFromJSONString, - .JSValueMakeBoolean = JSValueMakeBoolean, - .JSValueMakeNull = JSValueMakeNull, - .JSValueMakeNumber = JSValueMakeNumber, - .JSValueMakeString = JSValueMakeString, - .JSValueMakeUndefined = JSValueMakeUndefined, - .JSValueProtect = JSValueProtect, - .JSValueToBoolean = JSValueToBoolean, - .JSValueToNumber = JSValueToNumber, - .JSValueToObject = JSValueToObject, - .JSValueToStringCopy = JSValueToStringCopy, - .JSValueUnprotect = JSValueUnprotect, - .JSValueIsNull = JSValueIsNull, - - .JSSamplingProfilerEnabled = JSSamplingProfilerEnabled, - .JSPokeSamplingProfiler = - (decltype(&JSPokeSamplingProfiler)) - Unimplemented_JSPokeSamplingProfiler, - .JSStartSamplingProfilingOnMainJSCThread = - (decltype(&JSStartSamplingProfilingOnMainJSCThread)) - Unimplemented_JSStartSamplingProfilingOnMainJSCThread, - - .JSGlobalContextEnableDebugger = - (decltype(&JSGlobalContextEnableDebugger)) - Unimplemented_JSGlobalContextEnableDebugger, - .JSGlobalContextDisableDebugger = - (decltype(&JSGlobalContextDisableDebugger)) - Unimplemented_JSGlobalContextDisableDebugger, - - .configureJSCForIOS = - (decltype(&configureJSCForIOS))Unimplemented_configureJSCForIOS, - - .JSContext = objc_getClass("JSContext"), - .JSValue = objc_getClass("JSValue"), - - .JSBytecodeFileFormatVersion = JSNoBytecodeFileFormatVersion, - }; - }); - return &s_systemWrapper; -} - -} } - -#endif diff --git a/ReactCommon/jsi/Android.mk b/ReactCommon/jsi/Android.mk new file mode 100644 index 00000000000000..1b27989ff058ad --- /dev/null +++ b/ReactCommon/jsi/Android.mk @@ -0,0 +1,15 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := jsi + +LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) + +LOCAL_C_INCLUDES += $(LOCAL_PATH)/.. +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) + +LOCAL_CFLAGS := -fexceptions -frtti -O3 +LOCAL_SHARED_LIBRARIES := libfolly_json libjsc glog + +include $(BUILD_STATIC_LIBRARY) diff --git a/ReactCommon/jsi/BUCK b/ReactCommon/jsi/BUCK new file mode 100644 index 00000000000000..d7b4ba8f434437 --- /dev/null +++ b/ReactCommon/jsi/BUCK @@ -0,0 +1,90 @@ +# BUILD FILE SYNTAX: SKYLARK + +load("//tools/build_defs/oss:rn_defs.bzl", "rn_xplat_cxx_library", "react_native_xplat_dep") + +rn_xplat_cxx_library( + name = "jsi", + srcs = [ + "jsi.cpp", + ], + header_namespace = "jsi", + exported_headers = [ + "instrumentation.h", + "jsi.h", + "jsi-inl.h", + ], + compiler_flags = [ + "-O3", + "-fexceptions", + "-frtti", + "-std=c++14", + "-Wall", + "-Werror", + "-Wextra", + "-Wcast-qual", + "-Wdelete-non-virtual-dtor", + "-Wwrite-strings", + ], + cxx_compiler_flags = [ + "-Wglobal-constructors", + "-Wmissing-prototypes", + ], + fbobjc_compiler_flags = [ + "-Wglobal-constructors", + "-Wmissing-prototypes", + ], + visibility = ["PUBLIC"], +) + +rn_xplat_cxx_library( + name = "JSIDynamic", + srcs = [ + "JSIDynamic.cpp", + ], + header_namespace = "jsi", + exported_headers = [ + "JSIDynamic.h", + ], + compiler_flags = [ + "-fexceptions", + "-frtti", + ], + fbobjc_force_static = True, + visibility = [ + "PUBLIC", + ], + xcode_public_headers_symlinks = True, + deps = [ + "xplat//folly:molly", + react_native_xplat_dep("jsi:jsi"), + ], +) + +rn_xplat_cxx_library( + name = "JSCRuntime", + xplat_mangled_args = { + "soname": "libjscjsi.$(ext)", + }, + exported_headers = [ + "JSCRuntime.h" + ], + srcs = [ + "JSCRuntime.cpp", + ], + fbandroid_compiler_flags = [ + "-fexceptions", + "-frtti", + "-O3", + ], + fbobjc_compiler_flags = [ + "-Os", + ], + deps = [ + "xplat//jsc:jsc", + ], + header_namespace = "jsi", + visibility = ["PUBLIC"], + exported_deps = [ + react_native_xplat_dep("jsi:jsi"), + ], +) diff --git a/ReactCommon/jsi/JSCRuntime.cpp b/ReactCommon/jsi/JSCRuntime.cpp new file mode 100644 index 00000000000000..09cbb7aab9de00 --- /dev/null +++ b/ReactCommon/jsi/JSCRuntime.cpp @@ -0,0 +1,1300 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#include "JSCRuntime.h" + +#include +#include +#include +#include +#include +#include +#include + +#ifndef NDEBUG +#include +#endif + +namespace facebook { +namespace jsc { + +namespace detail { +class ArgsConverter; +class ProtectionQueue; +} // namespace detail + +class JSCRuntime; + +struct Lock { + void lock(const jsc::JSCRuntime&) const {} + void unlock(const jsc::JSCRuntime&) const {} +}; + +class JSCRuntime : public jsi::Runtime { + public: + // Creates new context in new context group + JSCRuntime(); + // Retains ctx + JSCRuntime(JSGlobalContextRef ctx); + ~JSCRuntime(); + + void evaluateJavaScript( + std::unique_ptr buffer, + const std::string& sourceURL) override; + jsi::Object global() override; + + std::string description() override; + + bool isInspectable() override; + + void setDescription(const std::string& desc); + + // Please don't use the following two functions, only exposed for + // integration efforts. + JSGlobalContextRef getContext() { + return ctx_; + } + + // JSValueRef->JSValue (needs make.*Value so it must be member function) + jsi::Value createValue(JSValueRef value) const; + + // Value->JSValueRef (similar to above) + JSValueRef valueRef(const jsi::Value& value); + + protected: + friend class detail::ArgsConverter; + friend class detail::ProtectionQueue; + class JSCStringValue final : public PointerValue { +#ifndef NDEBUG + JSCStringValue(JSStringRef str, std::atomic& counter); +#else + JSCStringValue(JSStringRef str); +#endif + ~JSCStringValue(); + + void invalidate() override; + + JSStringRef str_; +#ifndef NDEBUG + std::atomic& counter_; +#endif + protected: + friend class JSCRuntime; + }; + + class JSCObjectValue final : public PointerValue { +#ifndef NDEBUG + JSCObjectValue( + JSGlobalContextRef ctx, + detail::ProtectionQueue& pq, + JSObjectRef obj, + std::atomic& counter); +#else + JSCObjectValue( + JSGlobalContextRef context, + detail::ProtectionQueue& pq, + JSObjectRef obj); +#endif + ~JSCObjectValue(); + + void invalidate() override; + + JSGlobalContextRef ctx_; + JSObjectRef obj_; + detail::ProtectionQueue& protectionQueue_; +#ifndef NDEBUG + std::atomic& counter_; +#endif + protected: + friend class JSCRuntime; + friend class detail::ProtectionQueue; + }; + + PointerValue* cloneString(const Runtime::PointerValue* pv) override; + PointerValue* cloneObject(const Runtime::PointerValue* pv) override; + PointerValue* clonePropNameID(const Runtime::PointerValue* pv) override; + + jsi::PropNameID createPropNameIDFromAscii(const char* str, size_t length) + override; + jsi::PropNameID createPropNameIDFromUtf8(const uint8_t* utf8, size_t length) + override; + jsi::PropNameID createPropNameIDFromString(const jsi::String& str) override; + std::string utf8(const jsi::PropNameID&) override; + bool compare(const jsi::PropNameID&, const jsi::PropNameID&) override; + + jsi::String createStringFromAscii(const char* str, size_t length) override; + jsi::String createStringFromUtf8(const uint8_t* utf8, size_t length) override; + std::string utf8(const jsi::String&) override; + + jsi::Object createObject() override; + jsi::Object createObject(std::shared_ptr ho) override; + virtual std::shared_ptr getHostObject( + const jsi::Object&) override; + jsi::HostFunctionType& getHostFunction(const jsi::Function&) override; + + jsi::Value getProperty(const jsi::Object&, const jsi::String& name) override; + jsi::Value getProperty(const jsi::Object&, const jsi::PropNameID& name) + override; + bool hasProperty(const jsi::Object&, const jsi::String& name) override; + bool hasProperty(const jsi::Object&, const jsi::PropNameID& name) override; + void setPropertyValue( + jsi::Object&, + const jsi::String& name, + const jsi::Value& value) override; + void setPropertyValue( + jsi::Object&, + const jsi::PropNameID& name, + const jsi::Value& value) override; + bool isArray(const jsi::Object&) const override; + bool isArrayBuffer(const jsi::Object&) const override; + bool isFunction(const jsi::Object&) const override; + bool isHostObject(const jsi::Object&) const override; + bool isHostFunction(const jsi::Function&) const override; + jsi::Array getPropertyNames(const jsi::Object&) override; + + jsi::WeakObject createWeakObject(const jsi::Object&) override; + jsi::Value lockWeakObject(const jsi::WeakObject&) override; + + jsi::Array createArray(size_t length) override; + size_t size(const jsi::Array&) override; + size_t size(const jsi::ArrayBuffer&) override; + uint8_t* data(const jsi::ArrayBuffer&) override; + jsi::Value getValueAtIndex(const jsi::Array&, size_t i) override; + void setValueAtIndexImpl(jsi::Array&, size_t i, const jsi::Value& value) + override; + + jsi::Function createFunctionFromHostFunction( + const jsi::PropNameID& name, + unsigned int paramCount, + jsi::HostFunctionType func) override; + jsi::Value call( + const jsi::Function&, + const jsi::Value& jsThis, + const jsi::Value* args, + size_t count) override; + jsi::Value callAsConstructor( + const jsi::Function&, + const jsi::Value* args, + size_t count) override; + + bool strictEquals(const jsi::String& a, const jsi::String& b) const override; + bool strictEquals(const jsi::Object& a, const jsi::Object& b) const override; + bool instanceOf(const jsi::Object& o, const jsi::Function& f) override; + + private: + // Basically convenience casts + static JSStringRef stringRef(const jsi::String& str); + static JSStringRef stringRef(const jsi::PropNameID& sym); + static JSObjectRef objectRef(const jsi::Object& obj); + + // Factory methods for creating String/Object + jsi::String createString(JSStringRef stringRef) const; + jsi::PropNameID createPropNameID(JSStringRef stringRef); + jsi::Object createObject(JSObjectRef objectRef) const; + + // Used by factory methods and clone methods + jsi::Runtime::PointerValue* makeStringValue(JSStringRef str) const; + jsi::Runtime::PointerValue* makeObjectValue(JSObjectRef obj) const; + + void checkException(JSValueRef exc); + void checkException(JSValueRef res, JSValueRef exc); + void checkException(JSValueRef exc, const char* msg); + void checkException(JSValueRef res, JSValueRef exc, const char* msg); + + JSGlobalContextRef ctx_; + std::string desc_; + // We make this a pointer so that we can control explicitly when it's deleted + // namely before the context is released. + mutable std::unique_ptr protectionQueue_; +#ifndef NDEBUG + mutable std::atomic objectCounter_; + mutable std::atomic stringCounter_; +#endif +}; + +#if __has_builtin(__builtin_expect) +#define JSC_LIKELY(EXPR) __builtin_expect((bool)(EXPR), true) +#define JSC_UNLIKELY(EXPR) __builtin_expect((bool)(EXPR), false) +#else +#define JSC_LIKELY(EXPR) (EXPR) +#define JSC_UNLIKELY(EXPR) (EXPR) +#endif + +#define JSC_ASSERT(x) \ + do { \ + if (JSC_UNLIKELY(!!(x))) { \ + abort(); \ + } \ + } while (0) + +// Unsure if both are set ever, but we'll support the lower of the two +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) +// This takes care of watch and tvos (due to backwards compatibility in +// Availability.h +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0 +#define _JSC_FAST_IS_ARRAY +#endif +#endif +#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11 +#define _JSC_FAST_IS_ARRAY +#endif +#endif + +// JSStringRef utilities +namespace { +std::string JSStringToSTLString(JSStringRef str) { + std::string result; + size_t maxBytes = JSStringGetMaximumUTF8CStringSize(str); + result.resize(maxBytes); + size_t bytesWritten = JSStringGetUTF8CString(str, &result[0], maxBytes); + // JSStringGetUTF8CString writes the null terminator, so we want to resize + // to `bytesWritten - 1` so that `result` has the correct length. + result.resize(bytesWritten - 1); + return result; +} + +JSStringRef getLengthString() { + static JSStringRef length = JSStringCreateWithUTF8CString("length"); + return length; +} + +JSStringRef getNameString() { + static JSStringRef name = JSStringCreateWithUTF8CString("name"); + return name; +} + +JSStringRef getFunctionString() { + static JSStringRef func = JSStringCreateWithUTF8CString("Function"); + return func; +} + +#if !defined(_JSC_FAST_IS_ARRAY) +JSStringRef getArrayString() { + static JSStringRef array = JSStringCreateWithUTF8CString("Array"); + return array; +} + +JSStringRef getIsArrayString() { + static JSStringRef isArray = JSStringCreateWithUTF8CString("isArray"); + return isArray; +} +#endif +} // namespace + +// std::string utility +namespace { +std::string to_string(void* value) { + std::ostringstream ss; + ss << value; + return ss.str(); +} +} // namespace + +// UnprotectQueue +namespace detail { +class ProtectionQueue { + public: + ProtectionQueue() + : shuttingDown_(false) +#ifndef NDEBUG + , + didShutdown_ { + false + } +#endif + , unprotectorThread_(&ProtectionQueue::unprotectThread, this) {} + + void shutdown() { + { + std::lock_guard locker(mutex_); + shuttingDown_ = true; + notEmpty_.notify_one(); + } + unprotectorThread_.join(); + } + + void push(JSCRuntime::JSCObjectValue* value) { + std::lock_guard locker(mutex_); + assert(!didShutdown_); + queue_.push(value); + notEmpty_.notify_one(); + } + + private: + // This this the function that runs in the background deleting (and thus + // unprotecting JSObjectRefs as need be). This needs to be explicitly on a + // separate thread so that we don't have the API lock when `JSValueUnprotect` + // is called already (i.e. if we did this on the same thread that calls + // invalidate() on an Object then we might be in the middle of a GC pass, and + // already have the API lock). + void unprotectThread() { +#if defined(__APPLE__) + pthread_setname_np("jsc-protectionqueue-unprotectthread"); +#endif + + std::unique_lock locker(mutex_); + while (!shuttingDown_ || !queue_.empty()) { + if (queue_.empty()) { + // This will wake up when shuttingDown_ becomes true + notEmpty_.wait(locker); + } else { + JSCRuntime::JSCObjectValue* value = queue_.front(); + queue_.pop(); + // We need to drop the lock here since this calls JSValueUnprotect and + // that may make another GC pass, which could call another finalizer + // and thus attempt to push to this queue then, and deadlock. + locker.unlock(); + delete value; + locker.lock(); + } + } +#ifndef NDEBUG + didShutdown_ = true; +#endif + } + // Used to lock the queue_/shuttingDown_ ivars + std::mutex mutex_; + // Used to signal queue_ empty status changing + std::condition_variable notEmpty_; + // The actual underlying queue + std::queue queue_; + // A flag dictating whether or not we need to stop all execution + bool shuttingDown_; +#ifndef NDEBUG + std::atomic didShutdown_; +#endif + // The thread that dequeues and processes the queue. Note this is the last + // member on purpose so the thread starts up after all state has been + // properly initialized + std::thread unprotectorThread_; +}; +} // namespace detail + +JSCRuntime::JSCRuntime() + : JSCRuntime(JSGlobalContextCreateInGroup(nullptr, nullptr)) { + JSGlobalContextRelease(ctx_); +} + +JSCRuntime::JSCRuntime(JSGlobalContextRef ctx) + : ctx_(JSGlobalContextRetain(ctx)), + protectionQueue_(std::make_unique()) +#ifndef NDEBUG + , + objectCounter_(0), + stringCounter_(0) +#endif +{ +} + +JSCRuntime::~JSCRuntime() { + protectionQueue_->shutdown(); +#ifndef NDEBUG + assert( + objectCounter_ == 0 && "JSCRuntime destroyed with a dangling API object"); + assert( + stringCounter_ == 0 && "JSCRuntime destroyed with a dangling API string"); +#endif + JSGlobalContextRelease(ctx_); +} + +void JSCRuntime::evaluateJavaScript( + std::unique_ptr buffer, + const std::string& sourceURL) { + std::string tmp( + reinterpret_cast(buffer->data()), buffer->size()); + JSStringRef sourceRef = JSStringCreateWithUTF8CString(tmp.c_str()); + JSStringRef sourceURLRef = nullptr; + if (!sourceURL.empty()) { + sourceURLRef = JSStringCreateWithUTF8CString(sourceURL.c_str()); + } + JSValueRef exc = nullptr; + JSValueRef res = + JSEvaluateScript(ctx_, sourceRef, nullptr, sourceURLRef, 0, &exc); + JSStringRelease(sourceRef); + if (sourceURLRef) { + JSStringRelease(sourceURLRef); + } + checkException(res, exc); +} + +jsi::Object JSCRuntime::global() { + return createObject(JSContextGetGlobalObject(ctx_)); +} + +std::string JSCRuntime::description() { + if (desc_.empty()) { + desc_ = std::string(""; + } + return desc_; +} + +bool JSCRuntime::isInspectable() { + return false; +} + +#ifndef NDEBUG +JSCRuntime::JSCStringValue::JSCStringValue( + JSStringRef str, + std::atomic& counter) + : str_(JSStringRetain(str)), counter_(counter) { + // Since std::atomic returns a copy instead of a reference when calling + // operator+= we must do this explicitly in the constructor + counter_ += 1; +} +#else +JSCRuntime::JSCStringValue::JSCStringValue(JSStringRef str) + : str_(JSStringRetain(str)) { +} +#endif + +void JSCRuntime::JSCStringValue::invalidate() { + // JSI needs to be flexible enough to allow Runtime to act as a root in + // hermes' case and just an interface in JSC's case. In hermes the + // objects/strings must be tracked in a list so that they can be marked + // on a GC sweep, while for JSC we want to immediately JSStringRelease once a + // String is released, and queue a JSObjectRef to unprotected (see comment + // on ProtectionQueue::unprotectThread above). + // + // In JSC's case these JSC{String,Object}Value objects are implicitly owned + // by the {String,Object} objects, thus when a String/Object is destructed + // the JSC{String,Object}Value should be released (again this has the caveat + // that objects must be unprotected on a separate thread). + // + // Angery reaccs only + delete this; +} + +JSCRuntime::JSCStringValue::~JSCStringValue() { +#ifndef NDEBUG + counter_ -= 1; +#endif + JSStringRelease(str_); +} + +JSCRuntime::JSCObjectValue::JSCObjectValue( + JSGlobalContextRef ctx, + detail::ProtectionQueue& pq, + JSObjectRef obj +#ifndef NDEBUG + , + std::atomic& counter +#endif + ) + : ctx_(ctx), + obj_(obj), + protectionQueue_(pq) +#ifndef NDEBUG + , + counter_(counter) +#endif +{ + JSValueProtect(ctx_, obj_); +#ifndef NDEBUG + counter_ += 1; +#endif +} + +void JSCRuntime::JSCObjectValue::invalidate() { + // See comment in JSCRuntime::JSCStringValue::invalidate as well as + // on ProtectionQueue::unprotectThread. + protectionQueue_.push(this); +} + +JSCRuntime::JSCObjectValue::~JSCObjectValue() { +#ifndef NDEBUG + counter_ -= 1; +#endif + JSValueUnprotect(ctx_, obj_); +} + +jsi::Runtime::PointerValue* JSCRuntime::cloneString( + const jsi::Runtime::PointerValue* pv) { + if (!pv) { + return nullptr; + } + const JSCStringValue* string = static_cast(pv); + return makeStringValue(string->str_); +} + +jsi::Runtime::PointerValue* JSCRuntime::cloneObject( + const jsi::Runtime::PointerValue* pv) { + if (!pv) { + return nullptr; + } + const JSCObjectValue* object = static_cast(pv); + assert( + object->ctx_ == ctx_ && + "Don't try to clone an object backed by a different Runtime"); + return makeObjectValue(object->obj_); +} + +jsi::Runtime::PointerValue* JSCRuntime::clonePropNameID( + const jsi::Runtime::PointerValue* pv) { + if (!pv) { + return nullptr; + } + const JSCStringValue* string = static_cast(pv); + return makeStringValue(string->str_); +} + +jsi::PropNameID JSCRuntime::createPropNameIDFromAscii( + const char* str, + size_t length) { + // For system JSC this must is identical to a string + std::string tmp(str, length); + JSStringRef strRef = JSStringCreateWithUTF8CString(tmp.c_str()); + auto res = createPropNameID(strRef); + JSStringRelease(strRef); + return res; +} + +jsi::PropNameID JSCRuntime::createPropNameIDFromUtf8( + const uint8_t* utf8, + size_t length) { + std::string tmp(reinterpret_cast(utf8), length); + JSStringRef strRef = JSStringCreateWithUTF8CString(tmp.c_str()); + auto res = createPropNameID(strRef); + JSStringRelease(strRef); + return res; +} + +jsi::PropNameID JSCRuntime::createPropNameIDFromString(const jsi::String& str) { + return createPropNameID(stringRef(str)); +} + +std::string JSCRuntime::utf8(const jsi::PropNameID& sym) { + return JSStringToSTLString(stringRef(sym)); +} + +bool JSCRuntime::compare(const jsi::PropNameID& a, const jsi::PropNameID& b) { + return JSStringIsEqual(stringRef(a), stringRef(b)); +} + +jsi::String JSCRuntime::createStringFromAscii(const char* str, size_t length) { + // Yes we end up double casting for semantic reasons (UTF8 contains ASCII, + // not the other way around) + return this->createStringFromUtf8( + reinterpret_cast(str), length); +} + +jsi::String JSCRuntime::createStringFromUtf8( + const uint8_t* str, + size_t length) { + std::string tmp(reinterpret_cast(str), length); + JSStringRef stringRef = JSStringCreateWithUTF8CString(tmp.c_str()); + return createString(stringRef); +} + +std::string JSCRuntime::utf8(const jsi::String& str) { + return JSStringToSTLString(stringRef(str)); +} + +jsi::Object JSCRuntime::createObject() { + return createObject(static_cast(nullptr)); +} + +// HostObject details +namespace detail { +struct HostObjectProxyBase { + HostObjectProxyBase( + JSCRuntime& rt, + const std::shared_ptr& sho) + : runtime(rt), hostObject(sho) {} + + JSCRuntime& runtime; + std::shared_ptr hostObject; +}; +} // namespace detail + +namespace { +std::once_flag hostObjectClassOnceFlag; +JSClassRef hostObjectClass{}; +} // namespace + +jsi::Object JSCRuntime::createObject(std::shared_ptr ho) { + struct HostObjectProxy : public detail::HostObjectProxyBase { + static JSValueRef getProperty( + JSContextRef ctx, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) { + auto proxy = static_cast(JSObjectGetPrivate(object)); + auto& rt = proxy->runtime; + jsi::PropNameID sym = rt.createPropNameID(propertyName); + jsi::Value ret; + try { + ret = proxy->hostObject->get(rt, sym); + } catch (const jsi::JSError& error) { + *exception = rt.valueRef(error.value()); + return JSValueMakeUndefined(ctx); + } catch (const std::exception& ex) { + auto excValue = + rt.global() + .getPropertyAsFunction(rt, "Error") + .call( + rt, + std::string("Exception in HostObject::get: ") + ex.what()); + *exception = rt.valueRef(excValue); + return JSValueMakeUndefined(ctx); + } catch (...) { + auto excValue = + rt.global() + .getPropertyAsFunction(rt, "Error") + .call(rt, "Exception in HostObject::get: "); + *exception = rt.valueRef(excValue); + return JSValueMakeUndefined(ctx); + } + return rt.valueRef(ret); + } + + static bool setProperty( + JSContextRef ctx, + JSObjectRef object, + JSStringRef propName, + JSValueRef value, + JSValueRef* exception) { + auto proxy = static_cast(JSObjectGetPrivate(object)); + auto& rt = proxy->runtime; + jsi::PropNameID sym = rt.createPropNameID(propName); + try { + proxy->hostObject->set(rt, sym, rt.createValue(value)); + } catch (const jsi::JSError& error) { + *exception = rt.valueRef(error.value()); + return false; + } catch (const std::exception& ex) { + auto excValue = + rt.global() + .getPropertyAsFunction(rt, "Error") + .call( + rt, + std::string("Exception in HostObject::set: ") + ex.what()); + *exception = rt.valueRef(excValue); + return false; + } catch (...) { + auto excValue = + rt.global() + .getPropertyAsFunction(rt, "Error") + .call(rt, "Exception in HostObject::set: "); + *exception = rt.valueRef(excValue); + return false; + } + return true; + } + + // JSC does not provide means to communicate errors from this callback, + // so the error handling strategy is very brutal - we'll just crash + // due to noexcept. + static void getPropertyNames( + JSContextRef ctx, + JSObjectRef object, + JSPropertyNameAccumulatorRef propertyNames) noexcept { + auto proxy = static_cast(JSObjectGetPrivate(object)); + auto& rt = proxy->runtime; + auto names = proxy->hostObject->getPropertyNames(rt); + for (auto& name : names) { + JSPropertyNameAccumulatorAddName(propertyNames, stringRef(name)); + } + } + + static void finalize(JSObjectRef obj) { + auto hostObject = static_cast(JSObjectGetPrivate(obj)); + JSObjectSetPrivate(obj, nullptr); + delete hostObject; + } + + using HostObjectProxyBase::HostObjectProxyBase; + }; + + std::call_once(hostObjectClassOnceFlag, []() { + JSClassDefinition hostObjectClassDef = kJSClassDefinitionEmpty; + hostObjectClassDef.version = 0; + hostObjectClassDef.attributes = kJSClassAttributeNoAutomaticPrototype; + hostObjectClassDef.finalize = HostObjectProxy::finalize; + hostObjectClassDef.getProperty = HostObjectProxy::getProperty; + hostObjectClassDef.setProperty = HostObjectProxy::setProperty; + hostObjectClassDef.getPropertyNames = HostObjectProxy::getPropertyNames; + hostObjectClass = JSClassCreate(&hostObjectClassDef); + }); + + JSObjectRef obj = + JSObjectMake(ctx_, hostObjectClass, new HostObjectProxy(*this, ho)); + return createObject(obj); +} + +std::shared_ptr JSCRuntime::getHostObject( + const jsi::Object& obj) { + // We are guarenteed at this point to have isHostObject(obj) == true + // so the private data should be HostObjectMetadata + JSObjectRef object = objectRef(obj); + auto metadata = + static_cast(JSObjectGetPrivate(object)); + assert(metadata); + return metadata->hostObject; +} + +jsi::Value JSCRuntime::getProperty( + const jsi::Object& obj, + const jsi::String& name) { + JSObjectRef objRef = objectRef(obj); + JSValueRef exc = nullptr; + JSValueRef res = JSObjectGetProperty(ctx_, objRef, stringRef(name), &exc); + checkException(exc); + return createValue(res); +} + +jsi::Value JSCRuntime::getProperty( + const jsi::Object& obj, + const jsi::PropNameID& name) { + JSObjectRef objRef = objectRef(obj); + JSValueRef exc = nullptr; + JSValueRef res = JSObjectGetProperty(ctx_, objRef, stringRef(name), &exc); + checkException(exc); + return createValue(res); +} + +bool JSCRuntime::hasProperty(const jsi::Object& obj, const jsi::String& name) { + JSObjectRef objRef = objectRef(obj); + return JSObjectHasProperty(ctx_, objRef, stringRef(name)); +} + +bool JSCRuntime::hasProperty( + const jsi::Object& obj, + const jsi::PropNameID& name) { + JSObjectRef objRef = objectRef(obj); + return JSObjectHasProperty(ctx_, objRef, stringRef(name)); +} + +void JSCRuntime::setPropertyValue( + jsi::Object& object, + const jsi::PropNameID& name, + const jsi::Value& value) { + JSValueRef exc = nullptr; + JSObjectSetProperty( + ctx_, + objectRef(object), + stringRef(name), + valueRef(value), + kJSPropertyAttributeNone, + &exc); + checkException(exc); +} + +void JSCRuntime::setPropertyValue( + jsi::Object& object, + const jsi::String& name, + const jsi::Value& value) { + JSValueRef exc = nullptr; + JSObjectSetProperty( + ctx_, + objectRef(object), + stringRef(name), + valueRef(value), + kJSPropertyAttributeNone, + &exc); + checkException(exc); +} + +bool JSCRuntime::isArray(const jsi::Object& obj) const { +#if !defined(_JSC_FAST_IS_ARRAY) + JSObjectRef global = JSContextGetGlobalObject(ctx_); + JSStringRef arrayString = getArrayString(); + JSValueRef exc = nullptr; + JSValueRef arrayCtorValue = + JSObjectGetProperty(ctx_, global, arrayString, &exc); + JSC_ASSERT(exc); + JSObjectRef arrayCtor = JSValueToObject(ctx_, arrayCtorValue, &exc); + JSC_ASSERT(exc); + JSStringRef isArrayString = getIsArrayString(); + JSValueRef isArrayValue = + JSObjectGetProperty(ctx_, arrayCtor, isArrayString, &exc); + JSC_ASSERT(exc); + JSObjectRef isArray = JSValueToObject(ctx_, isArrayValue, &exc); + JSC_ASSERT(exc); + JSValueRef arg = objectRef(obj); + JSValueRef result = + JSObjectCallAsFunction(ctx_, isArray, nullptr, 1, &arg, &exc); + JSC_ASSERT(exc); + return JSValueToBoolean(ctx_, result); +#else + return JSValueIsArray(ctx_, objectRef(obj)); +#endif +} + +bool JSCRuntime::isArrayBuffer(const jsi::Object& /*obj*/) const { + // TODO: T23270523 - This would fail on builds that use our custom JSC + // auto typedArrayType = JSValueGetTypedArrayType(ctx_, objectRef(obj), + // nullptr); return typedArrayType == kJSTypedArrayTypeArrayBuffer; + throw std::runtime_error("Unsupported"); +} + +uint8_t* JSCRuntime::data(const jsi::ArrayBuffer& /*obj*/) { + // TODO: T23270523 - This would fail on builds that use our custom JSC + // return static_cast( + // JSObjectGetArrayBufferBytesPtr(ctx_, objectRef(obj), nullptr)); + throw std::runtime_error("Unsupported"); +} + +size_t JSCRuntime::size(const jsi::ArrayBuffer& /*obj*/) { + // TODO: T23270523 - This would fail on builds that use our custom JSC + // return JSObjectGetArrayBufferByteLength(ctx_, objectRef(obj), nullptr); + throw std::runtime_error("Unsupported"); +} + +bool JSCRuntime::isFunction(const jsi::Object& obj) const { + return JSObjectIsFunction(ctx_, objectRef(obj)); +} + +bool JSCRuntime::isHostObject(const jsi::Object& obj) const { + auto cls = hostObjectClass; + return cls != nullptr && JSValueIsObjectOfClass(ctx_, objectRef(obj), cls); +} + +// Very expensive +jsi::Array JSCRuntime::getPropertyNames(const jsi::Object& obj) { + JSPropertyNameArrayRef names = + JSObjectCopyPropertyNames(ctx_, objectRef(obj)); + size_t len = JSPropertyNameArrayGetCount(names); + // Would be better if we could create an array with explicit elements + auto result = createArray(len); + for (size_t i = 0; i < len; i++) { + JSStringRef str = JSPropertyNameArrayGetNameAtIndex(names, i); + result.setValueAtIndex(*this, i, createString(str)); + } + JSPropertyNameArrayRelease(names); + return result; +} + +jsi::WeakObject JSCRuntime::createWeakObject(const jsi::Object&) { + throw std::logic_error("Not implemented"); +} + +jsi::Value JSCRuntime::lockWeakObject(const jsi::WeakObject&) { + throw std::logic_error("Not implemented"); +} + +jsi::Array JSCRuntime::createArray(size_t length) { + JSValueRef exc = nullptr; + JSObjectRef obj = JSObjectMakeArray(ctx_, 0, nullptr, &exc); + checkException(obj, exc); + JSObjectSetProperty( + ctx_, + obj, + getLengthString(), + JSValueMakeNumber(ctx_, static_cast(length)), + 0, + &exc); + checkException(exc); + return createObject(obj).getArray(*this); +} + +size_t JSCRuntime::size(const jsi::Array& arr) { + return static_cast( + getProperty(arr, createPropNameID(getLengthString())).getNumber()); +} + +jsi::Value JSCRuntime::getValueAtIndex(const jsi::Array& arr, size_t i) { + JSValueRef exc = nullptr; + auto res = JSObjectGetPropertyAtIndex(ctx_, objectRef(arr), i, &exc); + checkException(exc); + return createValue(res); +} + +void JSCRuntime::setValueAtIndexImpl( + jsi::Array& arr, + size_t i, + const jsi::Value& value) { + JSValueRef exc = nullptr; + JSObjectSetPropertyAtIndex(ctx_, objectRef(arr), i, valueRef(value), &exc); + checkException(exc); +} + +namespace { +std::once_flag hostFunctionClassOnceFlag; +JSClassRef hostFunctionClass{}; + +class HostFunctionProxy { + public: + HostFunctionProxy(jsi::HostFunctionType hostFunction) + : hostFunction_(hostFunction) {} + + jsi::HostFunctionType& getHostFunction() { + return hostFunction_; + } + + protected: + jsi::HostFunctionType hostFunction_; +}; +} // namespace + +jsi::Function JSCRuntime::createFunctionFromHostFunction( + const jsi::PropNameID& name, + unsigned int paramCount, + jsi::HostFunctionType func) { + class HostFunctionMetadata : public HostFunctionProxy { + public: + static void initialize(JSContextRef ctx, JSObjectRef object) { + // We need to set up the prototype chain properly here. In theory we + // could set func.prototype.prototype = Function.prototype to get the + // same result. Not sure which approach is better. + HostFunctionMetadata* metadata = + static_cast(JSObjectGetPrivate(object)); + + JSValueRef exc = nullptr; + JSObjectSetProperty( + ctx, + object, + getLengthString(), + JSValueMakeNumber(ctx, metadata->argCount), + kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | + kJSPropertyAttributeDontDelete, + &exc); + if (exc) { + // Silently fail to set length + exc = nullptr; + } + + JSStringRef name = nullptr; + std::swap(metadata->name, name); + JSObjectSetProperty( + ctx, + object, + getNameString(), + JSValueMakeString(ctx, name), + kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | + kJSPropertyAttributeDontDelete, + &exc); + JSStringRelease(name); + if (exc) { + // Silently fail to set name + exc = nullptr; + } + + JSObjectRef global = JSContextGetGlobalObject(ctx); + JSValueRef value = + JSObjectGetProperty(ctx, global, getFunctionString(), &exc); + // If we don't have Function then something bad is going on. + if (JSC_UNLIKELY(exc)) { + abort(); + } + JSObjectRef funcCtor = JSValueToObject(ctx, value, &exc); + if (!funcCtor) { + // We can't do anything if Function is not an object + return; + } + JSValueRef funcProto = JSObjectGetPrototype(ctx, funcCtor); + JSObjectSetPrototype(ctx, object, funcProto); + } + + static JSValueRef makeError(JSCRuntime& rt, const std::string& desc) { + jsi::Value value = + rt.global().getPropertyAsFunction(rt, "Error").call(rt, desc); + return rt.valueRef(value); + } + + static JSValueRef call( + JSContextRef ctx, + JSObjectRef function, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception) { + HostFunctionMetadata* metadata = + static_cast(JSObjectGetPrivate(function)); + JSCRuntime& rt = *(metadata->runtime); + const unsigned maxStackArgCount = 8; + jsi::Value stackArgs[maxStackArgCount]; + std::unique_ptr heapArgs; + jsi::Value* args; + if (argumentCount > maxStackArgCount) { + heapArgs = std::make_unique(argumentCount); + for (size_t i = 0; i < argumentCount; i++) { + heapArgs[i] = rt.createValue(arguments[i]); + } + args = heapArgs.get(); + } else { + for (size_t i = 0; i < argumentCount; i++) { + stackArgs[i] = rt.createValue(arguments[i]); + } + args = stackArgs; + } + JSValueRef res; + jsi::Value thisVal(rt.createObject(thisObject)); + try { + res = rt.valueRef( + metadata->hostFunction_(rt, thisVal, args, argumentCount)); + } catch (const jsi::JSError& error) { + *exception = rt.valueRef(error.value()); + res = JSValueMakeUndefined(ctx); + } catch (const std::exception& ex) { + std::string exceptionString("Exception in HostFunction: "); + exceptionString += ex.what(); + *exception = makeError(rt, exceptionString); + res = JSValueMakeUndefined(ctx); + } catch (...) { + std::string exceptionString("Exception in HostFunction: "); + *exception = makeError(rt, exceptionString); + res = JSValueMakeUndefined(ctx); + } + return res; + } + + static void finalize(JSObjectRef object) { + HostFunctionMetadata* metadata = + static_cast(JSObjectGetPrivate(object)); + JSObjectSetPrivate(object, nullptr); + delete metadata; + } + + HostFunctionMetadata( + JSCRuntime* rt, + jsi::HostFunctionType hf, + unsigned ac, + JSStringRef n) + : HostFunctionProxy(hf), + runtime(rt), + argCount(ac), + name(JSStringRetain(n)) {} + + JSCRuntime* runtime; + unsigned argCount; + JSStringRef name; + }; + + std::call_once(hostFunctionClassOnceFlag, []() { + JSClassDefinition functionClass = kJSClassDefinitionEmpty; + functionClass.version = 0; + functionClass.attributes = kJSClassAttributeNoAutomaticPrototype; + functionClass.initialize = HostFunctionMetadata::initialize; + functionClass.finalize = HostFunctionMetadata::finalize; + functionClass.callAsFunction = HostFunctionMetadata::call; + + hostFunctionClass = JSClassCreate(&functionClass); + }); + + JSObjectRef funcRef = JSObjectMake( + ctx_, + hostFunctionClass, + new HostFunctionMetadata(this, func, paramCount, stringRef(name))); + return createObject(funcRef).getFunction(*this); +} + +namespace detail { + +class ArgsConverter { + public: + ArgsConverter(JSCRuntime& rt, const jsi::Value* args, size_t count) { + JSValueRef* destination = inline_; + if (count > maxStackArgs) { + outOfLine_ = std::make_unique(count); + destination = outOfLine_.get(); + } + + for (size_t i = 0; i < count; ++i) { + destination[i] = rt.valueRef(args[i]); + } + } + + operator JSValueRef*() { + return outOfLine_ ? outOfLine_.get() : inline_; + } + + private: + constexpr static unsigned maxStackArgs = 8; + JSValueRef inline_[maxStackArgs]; + std::unique_ptr outOfLine_; +}; +} // namespace detail + +bool JSCRuntime::isHostFunction(const jsi::Function& obj) const { + auto cls = hostFunctionClass; + return cls != nullptr && JSValueIsObjectOfClass(ctx_, objectRef(obj), cls); +} + +jsi::HostFunctionType& JSCRuntime::getHostFunction(const jsi::Function& obj) { + // We know that isHostFunction(obj) is true here, so its safe to proceed + auto proxy = + static_cast(JSObjectGetPrivate(objectRef(obj))); + return proxy->getHostFunction(); +} + +jsi::Value JSCRuntime::call( + const jsi::Function& f, + const jsi::Value& jsThis, + const jsi::Value* args, + size_t count) { + JSValueRef exc = nullptr; + auto res = JSObjectCallAsFunction( + ctx_, + objectRef(f), + jsThis.isUndefined() ? nullptr : objectRef(jsThis.getObject(*this)), + count, + detail::ArgsConverter(*this, args, count), + &exc); + checkException(exc); + return createValue(res); +} + +jsi::Value JSCRuntime::callAsConstructor( + const jsi::Function& f, + const jsi::Value* args, + size_t count) { + JSValueRef exc = nullptr; + auto res = JSObjectCallAsConstructor( + ctx_, + objectRef(f), + count, + detail::ArgsConverter(*this, args, count), + &exc); + checkException(exc); + return createValue(res); +} + +bool JSCRuntime::strictEquals(const jsi::String& a, const jsi::String& b) + const { + return JSStringIsEqual(stringRef(a), stringRef(b)); +} + +bool JSCRuntime::strictEquals(const jsi::Object& a, const jsi::Object& b) + const { + return objectRef(a) == objectRef(b); +} + +bool JSCRuntime::instanceOf(const jsi::Object& o, const jsi::Function& f) { + JSValueRef exc = nullptr; + bool res = + JSValueIsInstanceOfConstructor(ctx_, objectRef(o), objectRef(f), &exc); + checkException(exc); + return res; +} + +namespace { +JSStringRef getEmptyString() { + static JSStringRef empty = JSStringCreateWithUTF8CString(""); + return empty; +} +} // namespace + +jsi::Runtime::PointerValue* JSCRuntime::makeStringValue( + JSStringRef stringRef) const { + if (!stringRef) { + stringRef = getEmptyString(); + } +#ifndef NDEBUG + return new JSCStringValue(stringRef, stringCounter_); +#else + return new JSCStringValue(stringRef); +#endif +} + +jsi::String JSCRuntime::createString(JSStringRef str) const { + return make(makeStringValue(str)); +} + +jsi::PropNameID JSCRuntime::createPropNameID(JSStringRef str) { + return make(makeStringValue(str)); +} + +jsi::Runtime::PointerValue* JSCRuntime::makeObjectValue( + JSObjectRef objectRef) const { + if (!objectRef) { + objectRef = JSObjectMake(ctx_, nullptr, nullptr); + } +#ifndef NDEBUG + return new JSCObjectValue(ctx_, *protectionQueue_, objectRef, objectCounter_); +#else + return new JSCObjectValue(ctx_, *protectionQueue_, objectRef); +#endif +} + +jsi::Object JSCRuntime::createObject(JSObjectRef obj) const { + return make(makeObjectValue(obj)); +} + +jsi::Value JSCRuntime::createValue(JSValueRef value) const { + if (JSValueIsNumber(ctx_, value)) { + return jsi::Value(JSValueToNumber(ctx_, value, nullptr)); + } else if (JSValueIsBoolean(ctx_, value)) { + return jsi::Value(JSValueToBoolean(ctx_, value)); + } else if (JSValueIsNull(ctx_, value)) { + return jsi::Value(nullptr); + } else if (JSValueIsUndefined(ctx_, value)) { + return jsi::Value(); + } else if (JSValueIsString(ctx_, value)) { + JSStringRef str = JSValueToStringCopy(ctx_, value, nullptr); + auto result = jsi::Value(createString(str)); + JSStringRelease(str); + return result; + } else if (JSValueIsObject(ctx_, value)) { + JSObjectRef objRef = JSValueToObject(ctx_, value, nullptr); + return jsi::Value(createObject(objRef)); + } else { + // WHAT ARE YOU + abort(); + } +} + +JSValueRef JSCRuntime::valueRef(const jsi::Value& value) { + // I would rather switch on value.kind_ + if (value.isUndefined()) { + return JSValueMakeUndefined(ctx_); + } else if (value.isNull()) { + return JSValueMakeNull(ctx_); + } else if (value.isBool()) { + return JSValueMakeBoolean(ctx_, value.getBool()); + } else if (value.isNumber()) { + return JSValueMakeNumber(ctx_, value.getNumber()); + } else if (value.isString()) { + return JSValueMakeString(ctx_, stringRef(value.getString(*this))); + } else if (value.isObject()) { + return objectRef(value.getObject(*this)); + } else { + // What are you? + abort(); + } +} + +JSStringRef JSCRuntime::stringRef(const jsi::String& str) { + return static_cast(getPointerValue(str))->str_; +} + +JSStringRef JSCRuntime::stringRef(const jsi::PropNameID& sym) { + return static_cast(getPointerValue(sym))->str_; +} + +JSObjectRef JSCRuntime::objectRef(const jsi::Object& obj) { + return static_cast(getPointerValue(obj))->obj_; +} + +void JSCRuntime::checkException(JSValueRef exc) { + if (JSC_UNLIKELY(exc)) { + throw jsi::JSError(*this, createValue(exc)); + } +} + +void JSCRuntime::checkException(JSValueRef res, JSValueRef exc) { + if (JSC_UNLIKELY(!res)) { + throw jsi::JSError(*this, createValue(exc)); + } +} + +void JSCRuntime::checkException(JSValueRef exc, const char* msg) { + if (JSC_UNLIKELY(exc)) { + throw jsi::JSError(std::string(msg), *this, createValue(exc)); + } +} + +void JSCRuntime::checkException( + JSValueRef res, + JSValueRef exc, + const char* msg) { + if (JSC_UNLIKELY(!res)) { + throw jsi::JSError(std::string(msg), *this, createValue(exc)); + } +} + +std::unique_ptr makeJSCRuntime() { + return std::make_unique(); +} + +} // namespace jsc +} // namespace facebook diff --git a/ReactCommon/jsi/JSCRuntime.h b/ReactCommon/jsi/JSCRuntime.h new file mode 100644 index 00000000000000..e39e6453234dd6 --- /dev/null +++ b/ReactCommon/jsi/JSCRuntime.h @@ -0,0 +1,14 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#pragma once + +#include +#include + +namespace facebook { +namespace jsc { + +std::unique_ptr makeJSCRuntime(); + +} // namespace jsc +} // namespace facebook diff --git a/ReactCommon/jsi/JSIDynamic.cpp b/ReactCommon/jsi/JSIDynamic.cpp new file mode 100644 index 00000000000000..938f362bb0443b --- /dev/null +++ b/ReactCommon/jsi/JSIDynamic.cpp @@ -0,0 +1,93 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#include "JSIDynamic.h" + +#include +#include + +using namespace facebook::jsi; + +namespace facebook { +namespace jsi { + +Value valueFromDynamic(Runtime& runtime, const folly::dynamic& dyn) { + switch (dyn.type()) { + case folly::dynamic::NULLT: + return Value::null(); + case folly::dynamic::ARRAY: { + Array ret = Array(runtime, dyn.size()); + for (size_t i = 0; i < dyn.size(); ++i) { + ret.setValueAtIndex(runtime, i, valueFromDynamic(runtime, dyn[i])); + } + return std::move(ret); + } + case folly::dynamic::BOOL: + return dyn.getBool(); + case folly::dynamic::DOUBLE: + return dyn.getDouble(); + case folly::dynamic::INT64: + // Can't use asDouble() here. If the int64 value is too bit to be + // represented precisely as a double, folly will throw an + // exception. + return (double)dyn.getInt(); + case folly::dynamic::OBJECT: { + Object ret(runtime); + for (const auto& element : dyn.items()) { + Value value = valueFromDynamic(runtime, element.second); + if (element.first.isNumber() || element.first.isString()) { + ret.setProperty(runtime, element.first.asString().c_str(), value); + } + } + return std::move(ret); + } + case folly::dynamic::STRING: + return String::createFromUtf8(runtime, dyn.getString()); + } + CHECK(false); +} + +folly::dynamic dynamicFromValue(Runtime& runtime, const Value& value) { + if (value.isUndefined() || value.isNull()) { + return nullptr; + } else if (value.isBool()) { + return value.getBool(); + } else if (value.isNumber()) { + return value.getNumber(); + } else if (value.isString()) { + return value.getString(runtime).utf8(runtime); + } else { + Object obj = value.getObject(runtime); + if (obj.isArray(runtime)) { + Array array = obj.getArray(runtime); + folly::dynamic ret = folly::dynamic::array(); + for (size_t i = 0; i < array.size(runtime); ++i) { + ret.push_back(dynamicFromValue(runtime, array.getValueAtIndex(runtime, i))); + } + return ret; + } else if (obj.isFunction(runtime)) { + throw JSError(runtime, "JS Functions are not convertible to dynamic"); + } else { + folly::dynamic ret = folly::dynamic::object(); + Array names = obj.getPropertyNames(runtime); + for (size_t i = 0; i < names.size(runtime); ++i) { + String name = names.getValueAtIndex(runtime, i).getString(runtime); + Value prop = obj.getProperty(runtime, name); + if (prop.isUndefined()) { + continue; + } + // The JSC conversion uses JSON.stringify, which substitutes + // null for a function, so we do the same here. Just dropping + // the pair might also work, but would require more testing. + if (prop.isObject() && prop.getObject(runtime).isFunction(runtime)) { + prop = Value::null(); + } + ret.insert( + name.utf8(runtime), dynamicFromValue(runtime, std::move(prop))); + } + return ret; + } + } +} + +} +} diff --git a/ReactCommon/jsi/JSIDynamic.h b/ReactCommon/jsi/JSIDynamic.h new file mode 100644 index 00000000000000..0daf273dcd3896 --- /dev/null +++ b/ReactCommon/jsi/JSIDynamic.h @@ -0,0 +1,18 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#pragma once + +#include +#include + +namespace facebook { +namespace jsi { + +facebook::jsi::Value valueFromDynamic( + facebook::jsi::Runtime& runtime, const folly::dynamic& dyn); + +folly::dynamic dynamicFromValue(facebook::jsi::Runtime& runtime, + const facebook::jsi::Value& value); + +} +} diff --git a/ReactCommon/jsi/instrumentation.h b/ReactCommon/jsi/instrumentation.h new file mode 100644 index 00000000000000..4b3480df1ed3d6 --- /dev/null +++ b/ReactCommon/jsi/instrumentation.h @@ -0,0 +1,67 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#pragma once + +#include + +#include + +namespace facebook { +namespace jsi { + +/// Methods for starting and collecting instrumentation, an \c Instrumentation +/// instance is associated with a particular \c Runtime instance, which it +/// controls the instrumentation of. +class Instrumentation { + public: + virtual ~Instrumentation() = default; + + /// Returns GC statistics as a JSON-encoded string, with an object containing + /// "type" and "version" fields outermost. "type" is a string, unique to a + /// particular implementation of \c jsi::Instrumentation, and "version" is a + /// number to indicate any revision to that implementation and its output + /// format. + /// + /// \pre This call can only be made on the instrumentation instance of a + /// runtime initialised to collect GC statistics. + /// + /// \post All cumulative measurements mentioned in the output are accumulated + /// across the entire lifetime of the Runtime. + /// + /// \return the GC statistics collected so far, as a JSON-encoded string. + virtual std::string getRecordedGCStats() = 0; + + /// Request statistics about the current state of the runtime's heap. This + /// function can be called at any time, and should produce information that is + /// correct at the instant it is called (i.e, not stale). + /// + /// \return a jsi Value containing whichever statistics the runtime supports + /// for its heap. + virtual Value getHeapInfo(bool includeExpensive) = 0; + + /// perform a full garbage collection + virtual void collectGarbage() = 0; + + /// Captures the heap to a file + /// + /// \param path to save the heap capture + /// + /// \param compact Whether the JSON should be compact or pretty + /// + /// \return true iff the heap capture succeeded + virtual bool createSnapshotToFile(const std::string& path, bool compact) = 0; + + /// Write a trace of bridge traffic to the given file name. + virtual void writeBridgeTrafficTraceToFile( + const std::string& fileName) const = 0; + + /// Write basic block profile trace to the given file name. + virtual void writeBasicBlockProfileTraceToFile( + const std::string& fileName) const = 0; + + /// Dump external profiler symbols to the given file name. + virtual void dumpProfilerSymbolsToFile(const std::string& fileName) const = 0; +}; + +} // namespace jsi +} // namespace facebook diff --git a/ReactCommon/jsi/jsi-inl.h b/ReactCommon/jsi/jsi-inl.h new file mode 100644 index 00000000000000..155a840ceef64a --- /dev/null +++ b/ReactCommon/jsi/jsi-inl.h @@ -0,0 +1,306 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#pragma once + +namespace facebook { +namespace jsi { +namespace detail { + +inline Value toValue(Runtime&, std::nullptr_t) { + return Value::null(); +} +inline Value toValue(Runtime&, bool b) { + return Value(b); +} +inline Value toValue(Runtime&, double d) { + return Value(d); +} +inline Value toValue(Runtime&, int i) { + return Value(i); +} +inline Value toValue(Runtime& runtime, const char* str) { + return String::createFromAscii(runtime, str); +} +inline Value toValue(Runtime& runtime, const std::string& str) { + return String::createFromAscii(runtime, str); +} +template +inline Value toValue(Runtime& runtime, const T& other) { + static_assert( + std::is_base_of::value, + "This type cannot be converted to Value"); + return Value(runtime, other); +} +inline Value toValue(Runtime& runtime, const Value& value) { + return Value(runtime, value); +} +inline Value&& toValue(Runtime&, Value&& value) { + return std::move(value); +} + +inline PropNameID toPropNameID(Runtime& runtime, const char* name) { + return PropNameID::forAscii(runtime, name); +} +inline PropNameID toPropNameID(Runtime& runtime, const std::string& name) { + return PropNameID::forUtf8(runtime, name); +} +inline PropNameID&& toPropNameID(Runtime&, PropNameID&& name) { + return std::move(name); +} + +void throwJSError(Runtime&, const char* msg); + +} // namespace detail + +template +inline T Runtime::make(Runtime::PointerValue* pv) { + return T(pv); +} + +inline const Runtime::PointerValue* Runtime::getPointerValue( + const jsi::Pointer& pointer) { + return pointer.ptr_; +} + +inline const Runtime::PointerValue* Runtime::getPointerValue( + const jsi::Value& value) { + return value.data_.pointer.ptr_; +} + +inline Value Object::getProperty(Runtime& runtime, const char* name) const { + return getProperty(runtime, String::createFromAscii(runtime, name)); +} + +inline Value Object::getProperty(Runtime& runtime, const String& name) const { + return runtime.getProperty(*this, name); +} + +inline Value Object::getProperty(Runtime& runtime, const PropNameID& name) + const { + return runtime.getProperty(*this, name); +} + +inline bool Object::hasProperty(Runtime& runtime, const char* name) const { + return hasProperty(runtime, String::createFromAscii(runtime, name)); +} + +inline bool Object::hasProperty(Runtime& runtime, const String& name) const { + return runtime.hasProperty(*this, name); +} + +inline bool Object::hasProperty(Runtime& runtime, const PropNameID& name) + const { + return runtime.hasProperty(*this, name); +} + +template +void Object::setProperty(Runtime& runtime, const char* name, T&& value) { + setProperty( + runtime, String::createFromAscii(runtime, name), std::forward(value)); +} + +template +void Object::setProperty(Runtime& runtime, const String& name, T&& value) { + setPropertyValue( + runtime, name, detail::toValue(runtime, std::forward(value))); +} + +template +void Object::setProperty(Runtime& runtime, const PropNameID& name, T&& value) { + setPropertyValue( + runtime, name, detail::toValue(runtime, std::forward(value))); +} + +inline Array Object::getArray(Runtime& runtime) const& { + assert(runtime.isArray(*this)); + (void)runtime; // when assert is disabled we need to mark this as used + return Array(runtime.cloneObject(ptr_)); +} + +inline Array Object::getArray(Runtime& runtime) && { + assert(runtime.isArray(*this)); + (void)runtime; // when assert is disabled we need to mark this as used + Runtime::PointerValue* value = ptr_; + ptr_ = nullptr; + return Array(value); +} + +inline ArrayBuffer Object::getArrayBuffer(Runtime& runtime) const& { + assert(runtime.isArrayBuffer(*this)); + (void)runtime; // when assert is disabled we need to mark this as used + return ArrayBuffer(runtime.cloneObject(ptr_)); +} + +inline ArrayBuffer Object::getArrayBuffer(Runtime& runtime) && { + assert(runtime.isArrayBuffer(*this)); + (void)runtime; // when assert is disabled we need to mark this as used + Runtime::PointerValue* value = ptr_; + ptr_ = nullptr; + return ArrayBuffer(value); +} + +inline Function Object::getFunction(Runtime& runtime) const& { + assert(runtime.isFunction(*this)); + return Function(runtime.cloneObject(ptr_)); +} + +inline Function Object::getFunction(Runtime& runtime) && { + assert(runtime.isFunction(*this)); + (void)runtime; // when assert is disabled we need to mark this as used + Runtime::PointerValue* value = ptr_; + ptr_ = nullptr; + return Function(value); +} + +template +inline bool Object::isHostObject(Runtime& runtime) const { + return runtime.isHostObject(*this) && + std::dynamic_pointer_cast(runtime.getHostObject(*this)); +} + +template <> +inline bool Object::isHostObject(Runtime& runtime) const { + return runtime.isHostObject(*this); +} + +template +inline std::shared_ptr Object::getHostObject(Runtime& runtime) const { + assert(isHostObject(runtime)); + return std::static_pointer_cast(runtime.getHostObject(*this)); +} + +template +inline std::shared_ptr Object::asHostObject(Runtime& runtime) const { + if (!isHostObject(runtime)) { + detail::throwJSError(runtime, "Object is not a HostObject of desired type"); + } + return std::static_pointer_cast(runtime.getHostObject(*this)); +} + +template <> +inline std::shared_ptr Object::getHostObject( + Runtime& runtime) const { + assert(runtime.isHostObject(*this)); + return runtime.getHostObject(*this); +} + +inline Array Object::getPropertyNames(Runtime& runtime) const { + return runtime.getPropertyNames(*this); +} + +inline Value WeakObject::lock(Runtime& runtime) { + return runtime.lockWeakObject(*this); +} + +template +void Array::setValueAtIndex(Runtime& runtime, size_t i, T&& value) { + setValueAtIndexImpl( + runtime, i, detail::toValue(runtime, std::forward(value))); +} + +inline Value Array::getValueAtIndex(Runtime& runtime, size_t i) const { + return runtime.getValueAtIndex(*this, i); +} + +inline Function Function::createFromHostFunction( + Runtime& runtime, + const jsi::PropNameID& name, + unsigned int paramCount, + jsi::HostFunctionType func) { + return runtime.createFunctionFromHostFunction( + name, paramCount, std::move(func)); +} + +inline Value Function::call(Runtime& runtime, const Value* args, size_t count) + const { + return runtime.call(*this, Value::undefined(), args, count); +} + +inline Value Function::call(Runtime& runtime, std::initializer_list args) + const { + return call(runtime, args.begin(), args.size()); +} + +template +inline Value Function::call(Runtime& runtime, Args&&... args) const { + // A more awesome version of this would be able to create raw values + // which can be used directly as HermesValues, instead of having to + // wrap the args in Values and hvFromValue on each to unwrap them. + // But this will do for now. + return call(runtime, {detail::toValue(runtime, std::forward(args))...}); +} + +inline Value Function::callWithThis( + Runtime& runtime, + const Object& jsThis, + const Value* args, + size_t count) const { + return runtime.call(*this, Value(runtime, jsThis), args, count); +} + +inline Value Function::callWithThis( + Runtime& runtime, + const Object& jsThis, + std::initializer_list args) const { + return callWithThis(runtime, jsThis, args.begin(), args.size()); +} + +template +inline Value Function::callWithThis( + Runtime& runtime, + const Object& jsThis, + Args&&... args) const { + // A more awesome version of this would be able to create raw values + // which can be used directly as HermesValues, instead of having to + // wrap the args in Values and hvFromValue on each to unwrap them. + // But this will do for now. + return callWithThis( + runtime, jsThis, {detail::toValue(runtime, std::forward(args))...}); +} + +template +inline Array Array::createWithElements(Runtime& runtime, Args&&... args) { + return createWithElements( + runtime, {detail::toValue(runtime, std::forward(args))...}); +} + +template +inline std::vector PropNameID::names( + Runtime& runtime, + Args&&... args) { + return names({detail::toPropNameID(runtime, std::forward(args))...}); +} + +template +inline std::vector PropNameID::names( + PropNameID(&&propertyNames)[N]) { + std::vector result; + result.reserve(N); + for (auto& name : propertyNames) { + result.push_back(std::move(name)); + } + return result; +} + +inline Value Function::callAsConstructor( + Runtime& runtime, + const Value* args, + size_t count) const { + return runtime.callAsConstructor(*this, args, count); +} + +inline Value Function::callAsConstructor( + Runtime& runtime, + std::initializer_list args) const { + return callAsConstructor(runtime, args.begin(), args.size()); +} + +template +inline Value Function::callAsConstructor(Runtime& runtime, Args&&... args) + const { + return callAsConstructor( + runtime, {detail::toValue(runtime, std::forward(args))...}); +} + +} // namespace jsi +} // namespace facebook diff --git a/ReactCommon/jsi/jsi.cpp b/ReactCommon/jsi/jsi.cpp new file mode 100644 index 00000000000000..b0f5a2cb7b7faf --- /dev/null +++ b/ReactCommon/jsi/jsi.cpp @@ -0,0 +1,342 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#include +#include +#include +#include + +#include +#include + +namespace facebook { +namespace jsi { + +namespace detail { + +void throwJSError(Runtime& rt, const char* msg) { + throw JSError(rt, msg); +} + +} // namespace detail + +Buffer::~Buffer() {} + +Value HostObject::get(Runtime&, const PropNameID&) { + return Value(); +} + +void HostObject::set(Runtime& rt, const PropNameID& name, const Value&) { + std::string msg("TypeError: Cannot assign to property '"); + msg += name.utf8(rt); + msg += "' on HostObject with default setter"; + throw JSError(rt, msg); +} + +HostObject::~HostObject() {} + +Runtime::~Runtime() {} + +Instrumentation& Runtime::instrumentation() { + class NoInstrumentation : public Instrumentation { + std::string getRecordedGCStats() override { + return ""; + } + + Value getHeapInfo(bool) override { + return Value::undefined(); + } + + void collectGarbage() override {} + + bool createSnapshotToFile(const std::string&, bool) override { + return false; + } + + void writeBridgeTrafficTraceToFile(const std::string&) const override { + std::abort(); + } + + void writeBasicBlockProfileTraceToFile(const std::string&) const override { + std::abort(); + } + + void dumpProfilerSymbolsToFile(const std::string&) const override { + std::abort(); + } + }; + + static NoInstrumentation sharedInstance; + return sharedInstance; +} + +Pointer& Pointer::operator=(Pointer&& other) { + if (ptr_) { + ptr_->invalidate(); + } + ptr_ = other.ptr_; + other.ptr_ = nullptr; + return *this; +} + +Object Object::getPropertyAsObject(Runtime& runtime, const char* name) const { + Value v = getProperty(runtime, name); + + if (!v.isObject()) { + throw JSError( + runtime, + std::string("getPropertyAsObject: property '") + name + + "' is not an Object"); + } + + return v.getObject(runtime); +} + +Function Object::getPropertyAsFunction(Runtime& runtime, const char* name) + const { + Object obj = getPropertyAsObject(runtime, name); + if (!obj.isFunction(runtime)) { + throw JSError( + runtime, + std::string("getPropertyAsFunction: property '") + name + + "' is not a Function"); + }; + + Runtime::PointerValue* value = obj.ptr_; + obj.ptr_ = nullptr; + return Function(value); +} + +Array Object::asArray(Runtime& runtime) const& { + if (!isArray(runtime)) { + throw JSError(runtime, "Object is not an array"); + } + return getArray(runtime); +} + +Array Object::asArray(Runtime& runtime) && { + if (!isArray(runtime)) { + throw JSError(runtime, "Object is not an array"); + } + return std::move(*this).getArray(runtime); +} + +Function Object::asFunction(Runtime& runtime) const& { + if (!isFunction(runtime)) { + throw JSError(runtime, "Object is not a function"); + } + return getFunction(runtime); +} + +Function Object::asFunction(Runtime& runtime) && { + if (!isFunction(runtime)) { + throw JSError(runtime, "Object is not a function"); + } + return std::move(*this).getFunction(runtime); +} + +Value::Value(Value&& other) : Value(other.kind_) { + if (kind_ == BooleanKind) { + data_.boolean = other.data_.boolean; + } else if (kind_ == NumberKind) { + data_.number = other.data_.number; + } else if (kind_ >= PointerKind) { + new (&data_.pointer) Pointer(std::move(other.data_.pointer)); + } + // when the other's dtor runs, nothing will happen. + other.kind_ = UndefinedKind; +} + +Value::Value(Runtime& runtime, const Value& other) : Value(other.kind_) { + // data_ is uninitialized, so use placement new to create non-POD + // types in it. Any other kind of initialization will call a dtor + // first, which is incorrect. + if (kind_ == BooleanKind) { + data_.boolean = other.data_.boolean; + } else if (kind_ == NumberKind) { + data_.number = other.data_.number; + } else if (kind_ == StringKind) { + new (&data_.pointer) Pointer(runtime.cloneString(other.data_.pointer.ptr_)); + } else if (kind_ >= ObjectKind) { + new (&data_.pointer) Pointer(runtime.cloneObject(other.data_.pointer.ptr_)); + } +} + +Value::~Value() { + if (kind_ >= PointerKind) { + data_.pointer.~Pointer(); + } +} + +Value Value::createFromJsonUtf8( + Runtime& runtime, + const uint8_t* json, + size_t length) { + Function parseJson = runtime.global() + .getPropertyAsObject(runtime, "JSON") + .getPropertyAsFunction(runtime, "parse"); + return parseJson.call(runtime, String::createFromUtf8(runtime, json, length)); +} + +bool Value::strictEquals(Runtime& runtime, const Value& a, const Value& b) { + if (a.kind_ != b.kind_) { + return false; + } + switch (a.kind_) { + case UndefinedKind: + case NullKind: + return true; + case BooleanKind: + return a.data_.boolean == b.data_.boolean; + case NumberKind: + return a.data_.number == b.data_.number; + case StringKind: + return runtime.strictEquals( + static_cast(a.data_.pointer), + static_cast(b.data_.pointer)); + case ObjectKind: + return runtime.strictEquals( + static_cast(a.data_.pointer), + static_cast(b.data_.pointer)); + } + return false; +} + +double Value::asNumber() const { + if (!isNumber()) { + throw JSINativeException("Value is not an Object"); + } + + return getNumber(); +} + +Object Value::asObject(Runtime& runtime) const& { + if (!isObject()) { + throw JSError(runtime, "Value is not an Object"); + } + + return getObject(runtime); +} + +Object Value::asObject(Runtime& rt) && { + if (!isObject()) { + throw JSError(rt, "Value is not an Object"); + } + auto ptr = data_.pointer.ptr_; + data_.pointer.ptr_ = nullptr; + return static_cast(ptr); +} + +String Value::asString(Runtime& rt) const& { + if (!isString()) { + throw JSError(rt, "Value is not a String"); + } + + return getString(rt); +} + +String Value::asString(Runtime& rt) && { + if (!isString()) { + throw JSError(rt, "Value is not a String"); + } + + return std::move(*this).getString(rt); +} + +String Value::toString(Runtime& runtime) const { + Function toString = runtime.global().getPropertyAsFunction(runtime, "String"); + return toString.call(runtime, *this).getString(runtime); +} + +Array Array::createWithElements( + Runtime& rt, + std::initializer_list elements) { + Array result(rt, elements.size()); + size_t index = 0; + for (const auto& element : elements) { + result.setValueAtIndex(rt, index++, element); + } + return result; +} + +std::vector HostObject::getPropertyNames(Runtime&) { + return {}; +} + +Runtime::ScopeState* Runtime::pushScope() { + return nullptr; +} + +void Runtime::popScope(ScopeState*) {} + +JSError::JSError(Runtime& rt, Value&& value) { + setValue(rt, std::move(value)); +} + +JSError::JSError(Runtime& rt, std::string msg) : message_(std::move(msg)) { + try { + setValue( + rt, rt.global().getPropertyAsFunction(rt, "Error").call(rt, message_)); + } catch (...) { + setValue(rt, Value()); + } +} + +JSError::JSError(Runtime& rt, std::string msg, std::string stack) + : message_(std::move(msg)), stack_(std::move(stack)) { + try { + Object e(rt); + e.setProperty(rt, "message", String::createFromUtf8(rt, message_)); + e.setProperty(rt, "stack", String::createFromUtf8(rt, stack_)); + setValue(rt, std::move(e)); + } catch (...) { + setValue(rt, Value()); + } +} + +JSError::JSError(std::string what, Runtime& rt, Value&& value) + : JSIException(std::move(what)) { + setValue(rt, std::move(value)); +} + +void JSError::setValue(Runtime& rt, Value&& value) { + value_ = std::make_shared(std::move(value)); + + try { + if ((message_.empty() || stack_.empty()) && value_->isObject()) { + auto obj = value_->getObject(rt); + + if (message_.empty()) { + jsi::Value message = obj.getProperty(rt, "message"); + if (!message.isUndefined()) { + message_ = message.toString(rt).utf8(rt); + } + } + + if (stack_.empty()) { + jsi::Value stack = obj.getProperty(rt, "stack"); + if (!stack.isUndefined()) { + stack_ = stack.toString(rt).utf8(rt); + } + } + } + + if (message_.empty()) { + message_ = value_->toString(rt).utf8(rt); + } + + if (stack_.empty()) { + stack_ = "no stack"; + } + + if (what_.empty()) { + what_ = message_ + "\n\n" + stack_; + } + } catch (...) { + message_ = "[Exception caught creating message string]"; + stack_ = "[Exception caught creating stack string]"; + what_ = "[Exception caught getting value fields]"; + } +} + +} // namespace jsi +} // namespace facebook diff --git a/ReactCommon/jsi/jsi.h b/ReactCommon/jsi/jsi.h new file mode 100644 index 00000000000000..b1b26ff6a3462d --- /dev/null +++ b/ReactCommon/jsi/jsi.h @@ -0,0 +1,1146 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#define JSI_EXPORT __attribute__((visibility("default"))) + +class FBJSRuntime; +namespace facebook { +namespace jsi { + +namespace detail { + +template +class ThreadSafeRuntimeImpl; +} + +class Buffer { + public: + virtual ~Buffer(); + virtual size_t size() const = 0; + virtual const uint8_t* data() const = 0; +}; + +class StringBuffer : public Buffer { + public: + StringBuffer(std::string s) : s_(std::move(s)) {} + size_t size() const override { + return s_.size(); + } + const uint8_t* data() const override { + return reinterpret_cast(s_.data()); + } + + private: + std::string s_; +}; + +class Runtime; +class Pointer; +class PropNameID; +class String; +class Object; +class WeakObject; +class Array; +class ArrayBuffer; +class Function; +class Value; +class Instrumentation; +class Scope; +class JSIException; +class JSError; + +/// A function which has this type can be registered as a function +/// callable from JavaScript using Function::createFromHostFunction(). +/// When the function is called, args will point to the arguments, and +/// count will indicate how many arguments are passed. The function +/// can return a Value to the caller, or throw an exception. If a C++ +/// exception is thrown, a JS Error will be created and thrown into +/// JS; if the C++ exception extends std::exception, the Error's +/// message will be whatever what() returns. Note that it is undefined whether +/// HostFunctions may or may not be called in strict mode; that is `thisVal` +/// can be any value - it will not necessarily be coerced to an object or +/// or set to the global object. +using HostFunctionType = std::function< + Value(Runtime& rt, const Value& thisVal, const Value* args, size_t count)>; + +/// An object which implements this interface can be registered as an +/// Object with the JS runtime. +class JSI_EXPORT HostObject { + public: + // The C++ object's dtor will be called when the GC finalizes this + // object. (This may be as late as when the Runtime is shut down.) + // You have no control over which thread it is called on. This will + // be called from inside the GC, so it is unsafe to do any VM + // operations which require a Runtime&. Derived classes' dtors + // should also avoid doing anything expensive. Calling the dtor on + // a jsi object is explicitly ok. If you want to do JS operations, + // or any nontrivial work, you should add it to a work queue, and + // manage it externally. + virtual ~HostObject(); + + // When JS wants a property with a given name from the HostObject, + // it will call this method. If it throws an exception, the call + // will throw a JS \c Error object. By default this returns undefined. + // \return the value for the property. + virtual Value get(Runtime&, const PropNameID& name); + + // When JS wants to set a property with a given name on the HostObject, + // it will call this method. If it throws an exception, the call will + // throw a JS \c Error object. By default this throws a type error exception + // mimicking the behavior of a frozen object in strict mode. + virtual void set(Runtime&, const PropNameID& name, const Value& value); + + // When JS wants a list of property names for the HostObject, it will + // call this method. If it throws an exception, the call will thow a + // JS \c Error object. The default implementation returns empty vector. + virtual std::vector getPropertyNames(Runtime& rt); +}; + +/// Represents a JS runtime. Movable, but not copyable. Note that +/// this object is not thread-aware, but cannot be used safely from +/// multiple threads at once. The application is responsible for +/// ensuring that it is used safely. This could mean using the +/// Runtime from a single thread, using a mutex, doing all work on a +/// serial queue, etc. This restriction applies to the methods of +/// this class, and any method in the API which take a Runtime& as an +/// argument. Destructors (all but ~Scope), operators, or other methods +/// which do not take Runtime& as an argument are safe to call from any +/// thread, but it is still forbidden to make write operations on a single +/// instance of any class from more than one thread. +class Runtime { + public: + virtual ~Runtime(); + + /// Evaluates the given JavaScript \c buffer. \c sourceURL is used + /// to annotate the stack trace if there is an exception. The + /// contents may be utf8-encoded JS source code, or binary bytcode + /// whose format is specific to the implementation. If the input + /// format is unknown, or evaluation causes an error, a JSIException + /// will be thrown. + virtual void evaluateJavaScript( + std::unique_ptr buffer, + const std::string& sourceURL) = 0; + /// \return the global object + virtual Object global() = 0; + + /// \return a short printable description of the instance. This + /// should only be used by logging, debugging, and other + /// developer-facing callers. + virtual std::string description() = 0; + + /// \return whether or not the underlying runtime supports debugging via the + /// Chrome remote debugging protocol. + /// + /// NOTE: the API for determining whether a runtime is debuggable and + /// registering a runtime with the debugger is still in flux, so please don't + /// use this API unless you know what you're doing. + virtual bool isInspectable() = 0; + + /// \return an interface to extract metrics from this \c Runtime. The default + /// implementation of this function returns an \c Instrumentation instance + /// which returns no metrics. + virtual Instrumentation& instrumentation(); + + protected: + friend class Pointer; + friend class PropNameID; + friend class String; + friend class Object; + friend class WeakObject; + friend class Array; + friend class ArrayBuffer; + friend class Function; + friend class Value; + friend class Scope; + friend class JSError; + + // Potential optimization: avoid the cloneFoo() virtual dispatch, + // and instead just fix the number of fields, and copy them, since + // in practice they are trivially copyable. Sufficient use of + // rvalue arguments/methods would also reduce the number of clones. + + struct PointerValue { + virtual void invalidate() = 0; + + protected: + ~PointerValue() = default; + }; + + virtual PointerValue* cloneString(const Runtime::PointerValue* pv) = 0; + virtual PointerValue* cloneObject(const Runtime::PointerValue* pv) = 0; + virtual PointerValue* clonePropNameID(const Runtime::PointerValue* pv) = 0; + + virtual PropNameID createPropNameIDFromAscii( + const char* str, + size_t length) = 0; + virtual PropNameID createPropNameIDFromUtf8( + const uint8_t* utf8, + size_t length) = 0; + virtual PropNameID createPropNameIDFromString(const String& str) = 0; + virtual std::string utf8(const PropNameID&) = 0; + virtual bool compare(const PropNameID&, const PropNameID&) = 0; + + virtual String createStringFromAscii(const char* str, size_t length) = 0; + virtual String createStringFromUtf8(const uint8_t* utf8, size_t length) = 0; + virtual std::string utf8(const String&) = 0; + + virtual Object createObject() = 0; + virtual Object createObject(std::shared_ptr ho) = 0; + virtual std::shared_ptr getHostObject(const jsi::Object&) = 0; + virtual HostFunctionType& getHostFunction(const jsi::Function&) = 0; + + virtual Value getProperty(const Object&, const PropNameID& name) = 0; + virtual Value getProperty(const Object&, const String& name) = 0; + virtual bool hasProperty(const Object&, const PropNameID& name) = 0; + virtual bool hasProperty(const Object&, const String& name) = 0; + virtual void + setPropertyValue(Object&, const PropNameID& name, const Value& value) = 0; + virtual void + setPropertyValue(Object&, const String& name, const Value& value) = 0; + + virtual bool isArray(const Object&) const = 0; + virtual bool isArrayBuffer(const Object&) const = 0; + virtual bool isFunction(const Object&) const = 0; + virtual bool isHostObject(const jsi::Object&) const = 0; + virtual bool isHostFunction(const jsi::Function&) const = 0; + virtual Array getPropertyNames(const Object&) = 0; + + virtual WeakObject createWeakObject(const Object&) = 0; + virtual Value lockWeakObject(const WeakObject&) = 0; + + virtual Array createArray(size_t length) = 0; + virtual size_t size(const Array&) = 0; + virtual size_t size(const ArrayBuffer&) = 0; + virtual uint8_t* data(const ArrayBuffer&) = 0; + virtual Value getValueAtIndex(const Array&, size_t i) = 0; + virtual void setValueAtIndexImpl(Array&, size_t i, const Value& value) = 0; + + virtual Function createFunctionFromHostFunction( + const PropNameID& name, + unsigned int paramCount, + HostFunctionType func) = 0; + virtual Value call( + const Function&, + const Value& jsThis, + const Value* args, + size_t count) = 0; + virtual Value + callAsConstructor(const Function&, const Value* args, size_t count) = 0; + + // Private data for managing scopes. + struct ScopeState; + virtual ScopeState* pushScope(); + virtual void popScope(ScopeState*); + + virtual bool strictEquals(const String& a, const String& b) const = 0; + virtual bool strictEquals(const Object& a, const Object& b) const = 0; + + virtual bool instanceOf(const Object& o, const Function& f) = 0; + + // These exist so derived classes can access the private parts of + // Value, String, and Object, which are all friends of Runtime. + template + static T make(PointerValue* pv); + static const PointerValue* getPointerValue(const Pointer& pointer); + static const PointerValue* getPointerValue(const Value& value); + + // TODO T25594389: think harder about this friend declaration (and + // it's forward decl above) + template + friend class detail::ThreadSafeRuntimeImpl; + friend class ::FBJSRuntime; +}; + +// Base class for pointer-storing types. +class Pointer { + protected: + explicit Pointer(Pointer&& other) : ptr_(other.ptr_) { + other.ptr_ = nullptr; + } + + ~Pointer() { + if (ptr_) { + ptr_->invalidate(); + } + } + + Pointer& operator=(Pointer&& other); + + friend class Runtime; + friend class Value; + + explicit Pointer(Runtime::PointerValue* ptr) : ptr_(ptr) {} + + typename Runtime::PointerValue* ptr_; +}; + +/// Represents something that can be a JS property key. Movable, not copyable. +class PropNameID : public Pointer { + public: + using Pointer::Pointer; + + PropNameID(Runtime& runtime, const PropNameID& other) + : PropNameID(runtime.clonePropNameID(other.ptr_)) {} + + PropNameID(PropNameID&& other) = default; + PropNameID& operator=(PropNameID&& other) = default; + + /// Create a JS property name id from ascii values. The data is + /// copied. + static PropNameID forAscii(Runtime& runtime, const char* str, size_t length) { + return runtime.createPropNameIDFromAscii(str, length); + } + + /// Create a property name id from a nul-terminated C ascii name. The data is + /// copied. + static PropNameID forAscii(Runtime& runtime, const char* str) { + return forAscii(runtime, str, strlen(str)); + } + + /// Create a PropNameID from a C++ string. The string is copied. + static PropNameID forAscii(Runtime& runtime, const std::string& str) { + return forAscii(runtime, str.c_str(), str.size()); + } + + /// Create a PropNameID from utf8 values. The data is copied. + static PropNameID + forUtf8(Runtime& runtime, const uint8_t* utf8, size_t length) { + return runtime.createPropNameIDFromUtf8(utf8, length); + } + + /// Create a PropNameID from utf8-encoded octets stored in a + /// std::string. The string data is transformed and copied. + static PropNameID forUtf8(Runtime& runtime, const std::string& utf8) { + return runtime.createPropNameIDFromUtf8( + reinterpret_cast(utf8.data()), utf8.size()); + } + + /// Create a PropNameID from a JS string. + static PropNameID forString(Runtime& runtime, const jsi::String& str) { + return runtime.createPropNameIDFromString(str); + } + + // Creates a vector of PropNameIDs constructed from given arguments. + template + static std::vector names(Runtime& runtime, Args&&... args); + + // Creates a vector of given PropNameIDs. + template + static std::vector names(PropNameID(&&propertyNames)[N]); + + /// Copies the data in a PropNameID as utf8 into a C++ string. + std::string utf8(Runtime& runtime) const { + return runtime.utf8(*this); + } + + static bool compare( + Runtime& runtime, + const jsi::PropNameID& a, + const jsi::PropNameID& b) { + return runtime.compare(a, b); + } + + friend class Runtime; + friend class Value; +}; + +/// Represents a JS String. Movable, not copyable. +class String : public Pointer { + public: + using Pointer::Pointer; + + String(String&& other) = default; + String& operator=(String&& other) = default; + + /// Create a JS string from ascii values. The string data is + /// copied. + static String + createFromAscii(Runtime& runtime, const char* str, size_t length) { + return runtime.createStringFromAscii(str, length); + } + + /// Create a JS string from a nul-terminated C ascii string. The + /// string data is copied. + static String createFromAscii(Runtime& runtime, const char* str) { + return createFromAscii(runtime, str, strlen(str)); + } + + /// Create a JS string from a C++ string. The string data is + /// copied. + static String createFromAscii(Runtime& runtime, const std::string& str) { + return createFromAscii(runtime, str.c_str(), str.size()); + } + + /// Create a JS string from utf8-encoded octets. The string data is + /// transformed and copied. + static String + createFromUtf8(Runtime& runtime, const uint8_t* utf8, size_t length) { + return runtime.createStringFromUtf8(utf8, length); + } + + /// Create a JS string from utf8-encoded octets stored in a + /// std::string. The string data is transformed and copied. + static String createFromUtf8(Runtime& runtime, const std::string& utf8) { + return runtime.createStringFromUtf8( + reinterpret_cast(utf8.data()), utf8.length()); + } + + /// \return whether a and b contain the same characters. + static bool strictEquals(Runtime& runtime, const String& a, const String& b) { + return runtime.strictEquals(a, b); + } + + /// Copies the data in a JS string as utf8 into a C++ string. + std::string utf8(Runtime& runtime) const { + return runtime.utf8(*this); + } + + friend class Runtime; + friend class Value; +}; + +class Array; +class Function; + +/// Represents a JS Object. Movable, not copyable. +class Object : public Pointer { + public: + using Pointer::Pointer; + + Object(Object&& other) = default; + Object& operator=(Object&& other) = default; + + /// Creates a new Object instance, like '{}' in JS. + Object(Runtime& runtime) : Object(runtime.createObject()) {} + + static Object createFromHostObject( + Runtime& runtime, + std::shared_ptr ho) { + return runtime.createObject(ho); + } + + /// \return whether this and \c obj are the same JSObject or not. + static bool strictEquals(Runtime& runtime, const Object& a, const Object& b) { + return runtime.strictEquals(a, b); + } + + /// \return the result of `this instanceOf ctor` in JS. + bool instanceOf(Runtime& rt, const Function& ctor) { + return rt.instanceOf(*this, ctor); + } + + /// \return the property of the object with the given ascii name. + /// If the name isn't a property on the object, returns the + /// undefined value. + Value getProperty(Runtime& runtime, const char* name) const; + + /// \return the property of the object with the String name. + /// If the name isn't a property on the object, returns the + /// undefined value. + Value getProperty(Runtime& runtime, const String& name) const; + + /// \return the property of the object with the given JS PropNameID + /// name. If the name isn't a property on the object, returns the + /// undefined value. + Value getProperty(Runtime& runtime, const PropNameID& name) const; + + /// \return true if and only if the object has a property with the + /// given ascii name. + bool hasProperty(Runtime& runtime, const char* name) const; + + /// \return true if and only if the object has a property with the + /// given String name. + bool hasProperty(Runtime& runtime, const String& name) const; + + /// \return true if and only if the object has a property with the + /// given PropNameID name. + bool hasProperty(Runtime& runtime, const PropNameID& name) const; + + /// Sets the property value from a Value or anything which can be + /// used to make one: nullptr_t, bool, double, int, const char*, + /// String, or Object. + template + void setProperty(Runtime& runtime, const char* name, T&& value); + + /// Sets the property value from a Value or anything which can be + /// used to make one: nullptr_t, bool, double, int, const char*, + /// String, or Object. + template + void setProperty(Runtime& runtime, const String& name, T&& value); + + /// Sets the property value from a Value or anything which can be + /// used to make one: nullptr_t, bool, double, int, const char*, + /// String, or Object. + template + void setProperty(Runtime& runtime, const PropNameID& name, T&& value); + + /// \return true iff JS \c Array.isArray() would return \c true. If + /// so, then \c getArray() will succeed. + bool isArray(Runtime& runtime) const { + return runtime.isArray(*this); + } + + /// \return true iff the Object is an ArrayBuffer. If so, then \c + /// getArrayBuffer() will succeed. + bool isArrayBuffer(Runtime& runtime) const { + return runtime.isArrayBuffer(*this); + } + + /// \return true iff the Object is callable. If so, then \c + /// getFunction will succeed. + bool isFunction(Runtime& runtime) const { + return runtime.isFunction(*this); + } + + /// \return true iff the Object was initialized with \c createFromHostObject + /// and the HostObject passed is of type \c T. If returns \c true then + /// \c getHostObject will succeed. + template + bool isHostObject(Runtime& runtime) const; + + /// \return an Array instance which refers to the same underlying + /// object. If \c isArray() would return false, this will assert. + Array getArray(Runtime& runtime) const&; + + /// \return an Array instance which refers to the same underlying + /// object. If \c isArray() would return false, this will assert. + Array getArray(Runtime& runtime) &&; + + /// \return an Array instance which refers to the same underlying + /// object. If \c isArray() would return false, this will throw + /// JSIException. + Array asArray(Runtime& runtime) const&; + + /// \return an Array instance which refers to the same underlying + /// object. If \c isArray() would return false, this will throw + /// JSIException. + Array asArray(Runtime& runtime) &&; + + /// \return an ArrayBuffer instance which refers to the same underlying + /// object. If \c isArrayBuffer() would return false, this will assert. + ArrayBuffer getArrayBuffer(Runtime& runtime) const&; + + /// \return an ArrayBuffer instance which refers to the same underlying + /// object. If \c isArrayBuffer() would return false, this will assert. + ArrayBuffer getArrayBuffer(Runtime& runtime) &&; + + /// \return a Function instance which refers to the same underlying + /// object. If \c isFunction() would return false, this will assert. + Function getFunction(Runtime& runtime) const&; + + /// \return a Function instance which refers to the same underlying + /// object. If \c isFunction() would return false, this will assert. + Function getFunction(Runtime& runtime) &&; + + /// \return a Function instance which refers to the same underlying + /// object. If \c isFunction() would return false, this will throw + /// JSIException. + Function asFunction(Runtime& runtime) const&; + + /// \return a Function instance which refers to the same underlying + /// object. If \c isFunction() would return false, this will throw + /// JSIException. + Function asFunction(Runtime& runtime) &&; + + /// \return a shared_ptr which refers to the same underlying + /// \c HostObject that was used to create this object. If \c isHostObject + /// is false, this will assert. Note that this does a type check and will + /// assert if the underlying HostObject isn't of type \c T + template + std::shared_ptr getHostObject(Runtime& runtime) const; + + /// \return a shared_ptr which refers to the same underlying + /// \c HostObject that was used to crete this object. If \c isHostObject + /// is false, this will throw. + template + std::shared_ptr asHostObject(Runtime& runtime) const; + + /// \return same as \c getProperty(name).asObject(), except with + /// a better exception message. + Object getPropertyAsObject(Runtime& runtime, const char* name) const; + + /// \return similar to \c + /// getProperty(name).getObject().getFunction(), except it will + /// throw JSIException instead of asserting if the property is + /// not an object, or the object is not callable. + Function getPropertyAsFunction(Runtime& runtime, const char* name) const; + + /// \return an Array consisting of all enumerable property names in + /// the object and its prototype chain. All values in the return + /// will be isString(). (This is probably not optimal, but it + /// works. I only need it in one place.) + Array getPropertyNames(Runtime& runtime) const; + + protected: + void + setPropertyValue(Runtime& runtime, const String& name, const Value& value) { + return runtime.setPropertyValue(*this, name, value); + } + + void setPropertyValue( + Runtime& runtime, + const PropNameID& name, + const Value& value) { + return runtime.setPropertyValue(*this, name, value); + } + + friend class Runtime; + friend class Value; +}; + +/// Represents a weak reference to a JS Object. If the only reference +/// to an Object are these, the object is eligible for GC. Method +/// names are inspired by C++ weak_ptr. Movable, not copyable. +class WeakObject : public Pointer { + public: + using Pointer::Pointer; + + WeakObject(WeakObject&& other) = default; + WeakObject& operator=(WeakObject&& other) = default; + + /// Create a WeakObject from an Object. + WeakObject(Runtime& runtime, const Object& o) + : WeakObject(runtime.createWeakObject(o)) {} + + /// \return a Value representing the underlying Object if it is still valid; + /// otherwise returns \c undefined. Note that this method has nothing to do + /// with threads or concurrency. The name is based on std::weak_ptr::lock() + /// which serves a similar purpose. + Value lock(Runtime& runtime); + + friend class Runtime; +}; + +/// Represents a JS Object which can be efficiently used as an array +/// with integral indices. +class Array : public Object { + public: + Array(Array&&) = default; + /// Creates a new Array instance, with \c length undefined elements. + Array(Runtime& runtime, size_t length) : Array(runtime.createArray(length)) {} + + Array& operator=(Array&&) = default; + + /// \return the size of the Array, according to its length property. + /// (C++ naming convention) + size_t size(Runtime& runtime) const { + return runtime.size(*this); + } + + /// \return the size of the Array, according to its length property. + /// (JS naming convention) + size_t length(Runtime& runtime) const { + return size(runtime); + } + + /// \return the property of the array at index \c i. If there is no + /// such property, returns the undefined value. If \c i is out of + /// range [ 0..\c length ] throws a JSIException. + Value getValueAtIndex(Runtime& runtime, size_t i) const; + + /// Sets the property of the array at index \c i. The argument + /// value behaves as with Object::setProperty(). If \c i is out of + /// range [ 0..\c length ] throws a JSIException. + template + void setValueAtIndex(Runtime& runtime, size_t i, T&& value); + + /// There is no current API for changing the size of an array once + /// created. We'll probably need that eventually. + + /// Creates a new Array instance from provided values + template + static Array createWithElements(Runtime&, Args&&... args); + + /// Creates a new Array instance from intitializer list. + static Array createWithElements( + Runtime& runtime, + std::initializer_list elements); + + private: + friend class Object; + friend class Value; + + void setValueAtIndexImpl(Runtime& runtime, size_t i, const Value& value) { + return runtime.setValueAtIndexImpl(*this, i, value); + } + + Array(Runtime::PointerValue* value) : Object(value) {} +}; + +/// Represents a JSArrayBuffer +class ArrayBuffer : public Object { + public: + ArrayBuffer(ArrayBuffer&&) = default; + ArrayBuffer& operator=(ArrayBuffer&&) = default; + + /// \return the size of the ArrayBuffer, according to its byteLength property. + /// (C++ naming convention) + size_t size(Runtime& runtime) const { + return runtime.size(*this); + } + + size_t length(Runtime& runtime) const { + return runtime.size(*this); + } + + uint8_t* data(Runtime& runtime) { + return runtime.data(*this); + } + + private: + friend class Object; + friend class Value; + + ArrayBuffer(Runtime::PointerValue* value) : Object(value) {} +}; + +/// Represents a JS Object which is guaranteed to be Callable. +class Function : public Object { + public: + Function(Function&&) = default; + Function& operator=(Function&&) = default; + + /// Create a function which, when invoked, calls C++ code. If the + /// function throws an exception, a JS Error will be created and + /// thrown. + /// \param name the name property for the function. + /// \param paramCount the length property for the function, which + /// may not be the number of arguments the function is passed. + static Function createFromHostFunction( + Runtime& runtime, + const jsi::PropNameID& name, + unsigned int paramCount, + jsi::HostFunctionType func); + + /// Calls the function with \c count \c args. The \c this value of + /// the JS function will be undefined. + Value call(Runtime& runtime, const Value* args, size_t count) const; + + /// Calls the function with a \c std::initializer_list of Value + /// arguments. The \c this value of the JS function will be + /// undefined. + Value call(Runtime& runtime, std::initializer_list args) const; + + /// Calls the function with any number of arguments similarly to + /// Object::setProperty(). The \c this value of the JS function + /// will be undefined. + template + Value call(Runtime& runtime, Args&&... args) const; + + /// Calls the function with \c count \c args and \c jsThis value passed + /// as this value. + Value callWithThis( + Runtime& Runtime, + const Object& jsThis, + const Value* args, + size_t count) const; + + /// Calls the function with a \c std::initializer_list of Value + /// arguments. The \c this value of the JS function will be + /// undefined. + Value callWithThis( + Runtime& runtime, + const Object& jsThis, + std::initializer_list args) const; + + /// Calls the function with any number of arguments similarly to + /// Object::setProperty(). The \c this value of the JS function + /// will be undefined. + template + Value callWithThis(Runtime& runtime, const Object& jsThis, Args&&... args) + const; + + /// Calls the function as a constructor with \c count \c args. Equivalent + /// to calling `new Func` where `Func` is the js function reqresented by + /// this. + Value callAsConstructor(Runtime& runtime, const Value* args, size_t count) + const; + + /// Same as above `callAsConstructor`, except use an initializer_list to + /// supply the arguments. + Value callAsConstructor(Runtime& runtime, std::initializer_list args) + const; + + /// Same as above `callAsConstructor`, but automatically converts/wraps + /// any argument with a jsi Value. + template + Value callAsConstructor(Runtime& runtime, Args&&... args) const; + + /// Returns whether this was created with Function::createFromHostFunction. + /// If true then you can use getHostFunction to get the underlying + /// HostFunctionType. + bool isHostFunction(Runtime& runtime) const { + return runtime.isHostFunction(*this); + } + + /// Returns the underlying HostFunctionType iff isHostFunction returns true + /// and asserts otherwise. You can use this to use std::function<>::target + /// to get the object that was passed to create the HostFunctionType. + /// + /// Note: The reference returned is borrowed from the JS object underlying + /// \c this, and thus only lasts as long as the object underlying + /// \c this does. + HostFunctionType& getHostFunction(Runtime& runtime) const { + assert(isHostFunction(runtime)); + return runtime.getHostFunction(*this); + } + + private: + friend class Object; + friend class Value; + + Function(Runtime::PointerValue* value) : Object(value) {} +}; + +/// Represents any JS Value (undefined, null, boolean, number, string, +/// or object). Movable, or explicitly copyable (has no copy ctor). +class Value { + public: + /// Default ctor creates an \c undefined JS value. + Value() : Value(UndefinedKind) {} + + /// Creates a \c null JS value. + /* implicit */ Value(std::nullptr_t) : kind_(NullKind) {} + + /// Creates a boolean JS value. + /* implicit */ Value(bool b) : Value(BooleanKind) { + data_.boolean = b; + } + + /// Creates a number JS value. + /* implicit */ Value(double d) : Value(NumberKind) { + data_.number = d; + } + + /// Creates a number JS value. + /* implicit */ Value(int i) : Value(NumberKind) { + data_.number = i; + } + + /// Moves a String or Object rvalue into a new JS value. + template + /* implicit */ Value(T&& other) : Value(kindOf(other)) { + static_assert( + std::is_base_of::value || std::is_base_of::value, + "Value cannot be implictly move-constructed from this type"); + new (&data_.pointer) T(std::move(other)); + } + + /// Value("foo") will treat foo as a bool. This makes doing that a + /// compile error. + template + Value(const char*) { + static_assert( + !std::is_same::value, + "Value cannot be constructed directly from const char*"); + } + + Value(Value&& value); + + /// Copies a String lvalue into a new JS value. + Value(Runtime& runtime, const String& str) : Value(StringKind) { + new (&data_.pointer) String(runtime.cloneString(str.ptr_)); + } + + /// Copies a Object lvalue into a new JS value. + Value(Runtime& runtime, const Object& obj) : Value(ObjectKind) { + new (&data_.pointer) Object(runtime.cloneObject(obj.ptr_)); + } + + /// Creates a JS value from another Value lvalue. + Value(Runtime& runtime, const Value& value); + + /// Value(rt, "foo") will treat foo as a bool. This makes doing + /// that a compile error. + template + Value(Runtime&, const char*) { + static_assert( + !std::is_same::value, + "Value cannot be constructed directly from const char*"); + } + + ~Value(); + // \return the undefined \c Value. + static Value undefined() { + return Value(); + } + + // \return the null \c Value. + static Value null() { + return Value(nullptr); + } + + // \return a \c Value created from a utf8-encoded JSON string. + static Value + createFromJsonUtf8(Runtime& runtime, const uint8_t* json, size_t length); + + /// \return according to the SameValue algorithm see more here: + // https://www.ecma-international.org/ecma-262/5.1/#sec-11.9.4 + static bool strictEquals(Runtime& runtime, const Value& a, const Value& b); + + Value& operator=(Value&& other) { + this->~Value(); + new (this) Value(std::move(other)); + return *this; + } + + bool isUndefined() const { + return kind_ == UndefinedKind; + } + + bool isNull() const { + return kind_ == NullKind; + } + + bool isBool() const { + return kind_ == BooleanKind; + } + + bool isNumber() const { + return kind_ == NumberKind; + } + + bool isString() const { + return kind_ == StringKind; + } + + bool isObject() const { + return kind_ == ObjectKind; + } + + /// \return the boolean value, or asserts if not a boolean. + bool getBool() const { + assert(isBool()); + return data_.boolean; + } + + /// \return the number value, or asserts if not a number. + double getNumber() const { + assert(isNumber()); + return data_.number; + } + + /// \return the number value, or throws JSIException if not a + /// number. + double asNumber() const; + + /// \return the String value, or asserts if not a string. + String getString(Runtime& runtime) const& { + assert(isString()); + return String(runtime.cloneString(data_.pointer.ptr_)); + } + + /// \return the String value, or asserts if not a string. + /// Can be used on rvalue references to avoid cloning more strings. + String getString(Runtime&) && { + assert(isString()); + auto ptr = data_.pointer.ptr_; + data_.pointer.ptr_ = nullptr; + return static_cast(ptr); + } + + String asString(Runtime& runtime) const&; + String asString(Runtime& runtime) &&; + + /// \return the Object value, or asserts if not an object. + Object getObject(Runtime& runtime) const& { + assert(isObject()); + return Object(runtime.cloneObject(data_.pointer.ptr_)); + } + + /// \return the Object value, or asserts if not an object. + /// Can be used on rvalue references to avoid cloning more objects. + Object getObject(Runtime&) && { + assert(isObject()); + auto ptr = data_.pointer.ptr_; + data_.pointer.ptr_ = nullptr; + return static_cast(ptr); + } + + /// \return the Object value, or throws JSIException if not an + /// object. + Object asObject(Runtime& runtime) const&; + Object asObject(Runtime& runtime) &&; + + // \return a String like JS .toString() would do. + String toString(Runtime& runtime) const; + + private: + friend class Runtime; + + enum ValueKind { + UndefinedKind, + NullKind, + BooleanKind, + NumberKind, + StringKind, + ObjectKind, + PointerKind = StringKind, + }; + + union Data { + // Value's ctor and dtor will manage the lifecycle of the contained Data. + Data() { + static_assert( + sizeof(Data) == sizeof(uint64_t), + "Value data should fit in a 64-bit register"); + } + ~Data() {} + + // scalars + bool boolean; + double number; + // pointers + Pointer pointer; // String, Object, Array, Function + }; + + Value(ValueKind kind) : kind_(kind) {} + + constexpr static ValueKind kindOf(const String&) { + return StringKind; + } + constexpr static ValueKind kindOf(const Object&) { + return ObjectKind; + } + + ValueKind kind_; + Data data_; + + // In the future: Value becomes NaN-boxed. In the Hermes impl, if + // the object contains a PinnedHermesValue, we need to be able to + // get a pointer to it; this can be casted from 'this'. In the JSC + // impl, we need to be able to convert the boxed value into a JSC + // ref. This can be done by casting this, deferencing it to get a + // number, doing some bit masks, and then casting again into the + // desired JSC ref type. +}; + +/// Not movable and not copyable RAII marker advising the underlying +/// JavaScript VM to track resources allocated since creation until +/// destruction so that they can be recycled eagerly when the Scope +/// goes out of scope instead of floating in the air until the next +/// garbage collection or any other delayed release occurs. +/// +/// This API should be treated only as advice, implementations can +/// choose to ignore the fact that Scopes are created or destroyed. +/// +/// This class is an exception to the rule allowing destructors to be +/// called without proper synchronization (see Runtime documentation). +/// The whole point of this class is to enable all sorts of clean ups +/// when the destructor is called and this proper synchronization is +/// required at that time. +/// +/// Instances of this class are intended to be created as automatic stack +/// variables in which case destructor calls don't require any additional +/// locking, provided that the lock (if any) is managed with RAII helpers. +class Scope { + public: + explicit Scope(Runtime& rt) : rt_(rt), prv_(rt.pushScope()) {} + ~Scope() { + rt_.popScope(prv_); + }; + + Scope(const Scope&) = delete; + Scope(Scope&&) = delete; + + Scope& operator=(const Scope&) = delete; + Scope& operator=(Scope&&) = delete; + + template + static auto callInNewScope(Runtime& rt, F f) -> decltype(f()) { + Scope s(rt); + return f(); + } + + private: + Runtime& rt_; + Runtime::ScopeState* prv_; +}; + +/// Base class for jsi exceptions +class JSIException : public std::exception { + protected: + JSIException(){}; + JSIException(std::string what) : what_(std::move(what)){}; + + public: + virtual const char* what() const noexcept override { + return what_.c_str(); + } + + protected: + std::string what_; +}; + +/// This exception will be thrown by API functions on errors not related to +/// JavaScript execution. +class JSINativeException : public JSIException { + public: + JSINativeException(std::string what) : JSIException(std::move(what)) {} +}; + +/// This exception will be thrown by API functions whenever a JS +/// operation causes an exception as described by the spec, or as +/// otherwise described. +class JSError : public JSIException { + public: + /// Creates a JSError referring to provided \c value + JSError(Runtime& r, Value&& value); + + /// Creates a JSError referring to new \c Error instance capturing current + /// JavaScript stack. The error message property is set to given \c message. + JSError(Runtime& rt, std::string message); + + /// Creates a JSError referring to new \c Error instance capturing current + /// JavaScript stack. The error message property is set to given \c message. + JSError(Runtime& rt, const char* message) + : JSError(rt, std::string(message)){}; + + /// Creates a JSError referring to a JavaScript Object having message and + /// stack properties set to provided values. + JSError(Runtime& rt, std::string message, std::string stack); + + /// Creates a JSError referring to provided value and what string + /// set to provided message. This argument order is a bit weird, + /// but necessary to avoid ambiguity with the above. + JSError(std::string what, Runtime& rt, Value&& value); + + const std::string& getStack() const { + return stack_; + } + + const std::string& getMessage() const { + return message_; + } + + const jsi::Value& value() const { + assert(value_); + return *value_; + } + + private: + // This initializes the value_ member and does some other + // validation, so it must be called by every branch through the + // constructors. + void setValue(Runtime& rt, Value&& value); + + // This needs to be on the heap, because throw requires the object + // be copyable, and Value is not. + std::shared_ptr value_; + std::string message_; + std::string stack_; +}; + +} // namespace jsi +} // namespace facebook + +#include diff --git a/ReactCommon/jsiexecutor/Android.mk b/ReactCommon/jsiexecutor/Android.mk new file mode 100644 index 00000000000000..dd211e993195a6 --- /dev/null +++ b/ReactCommon/jsiexecutor/Android.mk @@ -0,0 +1,17 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := jsireact + +LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) + +LOCAL_C_INCLUDES := $(LOCAL_PATH) +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) + +LOCAL_CFLAGS := -fexceptions -frtti -O3 + +LOCAL_STATIC_LIBRARIES := libjsi reactnative +LOCAL_SHARED_LIBRARIES := libfolly_json glog + +include $(BUILD_STATIC_LIBRARY) diff --git a/ReactCommon/jsiexecutor/BUCK b/ReactCommon/jsiexecutor/BUCK new file mode 100644 index 00000000000000..e394a309a37001 --- /dev/null +++ b/ReactCommon/jsiexecutor/BUCK @@ -0,0 +1,39 @@ +load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "APPLE", "cxx_library", "react_native_xplat_dep", "react_native_xplat_target") + +cxx_library( + name = "jsiexecutor", + srcs = [ + "JSIExecutor.cpp", + "JSINativeModules.cpp", + ], + header_namespace = "", + exported_headers = { + "jsireact/JSIExecutor.h": "jsireact/JSIExecutor.h", + "jsireact/JSINativeModules.h": "jsireact/JSINativeModules.h", + }, + compiler_flags = [ + "-fexceptions", + "-frtti", + ], + fbandroid_deps = [ + "xplat//folly:molly", + "xplat//third-party/glog:glog", + ], + fbobjc_force_static = True, + fbobjc_header_path_prefix = "", + platforms = (ANDROID, APPLE), + preprocessor_flags = [ + "-DLOG_TAG=\"ReactNative\"", + "-DWITH_FBSYSTRACE=1", + ], + visibility = [ + "PUBLIC", + ], + xcode_public_headers_symlinks = True, + deps = [ + "xplat//third-party/linker_lib:atomic", + react_native_xplat_dep("jsi:jsi"), + react_native_xplat_dep("jsi:JSIDynamic"), + react_native_xplat_target("cxxreact:bridge"), + ], +) diff --git a/ReactCommon/jsiexecutor/JSIExecutor.cpp b/ReactCommon/jsiexecutor/JSIExecutor.cpp new file mode 100644 index 00000000000000..f243d8d7e32148 --- /dev/null +++ b/ReactCommon/jsiexecutor/JSIExecutor.cpp @@ -0,0 +1,405 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#include "jsireact/JSIExecutor.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace facebook::jsi; + +namespace facebook { +namespace react { + +JSIExecutorFactory::JSIExecutorFactory( + std::shared_ptr runtime, + JSIExecutor::Logger logger, + JSIExecutor::RuntimeInstaller runtimeInstaller) + : runtime_(runtime), + logger_(logger), + runtimeInstaller_(runtimeInstaller) {} + +std::unique_ptr JSIExecutorFactory::createJSExecutor( + std::shared_ptr delegate, + std::shared_ptr) { + return std::make_unique( + runtime_, + delegate, + logger_, + JSIExecutor::defaultTimeoutInvoker, + runtimeInstaller_); +} + +class JSIExecutor::NativeModuleProxy : public jsi::HostObject { + public: + NativeModuleProxy(JSIExecutor& executor) : executor_(executor) {} + + Value get(Runtime& rt, const PropNameID& name) override { + if (name.utf8(rt) == "name") { + return jsi::String::createFromAscii(rt, "NativeModules"); + } + + return executor_.nativeModules_.getModule(rt, name); + } + + void set(Runtime&, const PropNameID&, const Value&) override { + throw std::runtime_error( + "Unable to put on NativeModules: Operation unsupported"); + } + + private: + JSIExecutor& executor_; +}; + +namespace { + +// basename_r isn't in all iOS SDKs, so use this simple version instead. +std::string simpleBasename(const std::string& path) { + size_t pos = path.rfind("/"); + return (pos != std::string::npos) ? path.substr(pos) : path; +} + +} // namespace + +JSIExecutor::JSIExecutor( + std::shared_ptr runtime, + std::shared_ptr delegate, + Logger logger, + const JSIScopedTimeoutInvoker& scopedTimeoutInvoker, + RuntimeInstaller runtimeInstaller) + : runtime_(runtime), + delegate_(delegate), + nativeModules_(delegate ? delegate->getModuleRegistry() : nullptr), + logger_(logger), + scopedTimeoutInvoker_(scopedTimeoutInvoker), + runtimeInstaller_(runtimeInstaller) { + runtime_->global().setProperty( + *runtime, "__jsiExecutorDescription", runtime->description()); +} + +void JSIExecutor::loadApplicationScript( + std::unique_ptr script, + std::string sourceURL) { + SystraceSection s("JSIExecutor::loadApplicationScript"); + + // TODO: check for and use precompiled HBC + + runtime_->global().setProperty( + *runtime_, + "nativeModuleProxy", + Object::createFromHostObject( + *runtime_, std::make_shared(*this))); + + runtime_->global().setProperty( + *runtime_, + "nativeFlushQueueImmediate", + Function::createFromHostFunction( + *runtime_, + PropNameID::forAscii(*runtime_, "nativeFlushQueueImmediate"), + 1, + [this]( + jsi::Runtime&, + const jsi::Value&, + const jsi::Value* args, + size_t count) { + if (count != 1) { + throw std::invalid_argument( + "nativeFlushQueueImmediate arg count must be 1"); + } + callNativeModules(args[0], false); + return Value::undefined(); + })); + + runtime_->global().setProperty( + *runtime_, + "nativeCallSyncHook", + Function::createFromHostFunction( + *runtime_, + PropNameID::forAscii(*runtime_, "nativeCallSyncHook"), + 1, + [this]( + jsi::Runtime&, + const jsi::Value&, + const jsi::Value* args, + size_t count) { return nativeCallSyncHook(args, count); })); + + if (logger_) { + // Only inject the logging function if it was supplied by the caller. + runtime_->global().setProperty( + *runtime_, + "nativeLoggingHook", + Function::createFromHostFunction( + *runtime_, + PropNameID::forAscii(*runtime_, "nativeLoggingHook"), + 2, + [this]( + jsi::Runtime&, + const jsi::Value&, + const jsi::Value* args, + size_t count) { + if (count != 2) { + throw std::invalid_argument( + "nativeLoggingHook takes 2 arguments"); + } + logger_( + args[0].asString(*runtime_).utf8(*runtime_), + folly::to(args[1].asNumber())); + return Value::undefined(); + })); + } + + if (runtimeInstaller_) { + runtimeInstaller_(*runtime_); + } + + bool hasLogger(ReactMarker::logTaggedMarker); + std::string scriptName = simpleBasename(sourceURL); + if (hasLogger) { + ReactMarker::logTaggedMarker( + ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str()); + } + runtime_->evaluateJavaScript( + std::make_unique(std::move(script)), sourceURL); + flush(); + if (hasLogger) { + ReactMarker::logMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP); + ReactMarker::logTaggedMarker( + ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str()); + } +} + +void JSIExecutor::setBundleRegistry(std::unique_ptr r) { + if (!bundleRegistry_) { + runtime_->global().setProperty( + *runtime_, + "nativeRequire", + Function::createFromHostFunction( + *runtime_, + PropNameID::forAscii(*runtime_, "nativeRequire"), + 2, + [this]( + Runtime& rt, + const facebook::jsi::Value&, + const facebook::jsi::Value* args, + size_t count) { return nativeRequire(args, count); })); + } + bundleRegistry_ = std::move(r); +} + +void JSIExecutor::registerBundle( + uint32_t bundleId, + const std::string& bundlePath) { + const auto tag = folly::to(bundleId); + ReactMarker::logTaggedMarker( + ReactMarker::REGISTER_JS_SEGMENT_START, tag.c_str()); + if (bundleRegistry_) { + bundleRegistry_->registerBundle(bundleId, bundlePath); + } else { + auto script = JSBigFileString::fromPath(bundlePath); + runtime_->evaluateJavaScript( + std::make_unique(std::move(script)), + JSExecutor::getSyntheticBundlePath(bundleId, bundlePath)); + } + ReactMarker::logTaggedMarker( + ReactMarker::REGISTER_JS_SEGMENT_STOP, tag.c_str()); +} + +void JSIExecutor::callFunction( + const std::string& moduleId, + const std::string& methodId, + const folly::dynamic& arguments) { + SystraceSection s( + "JSIExecutor::callFunction", "moduleId", moduleId, "methodId", methodId); + if (!callFunctionReturnFlushedQueue_) { + bindBridge(); + } + + // Construct the error message producer in case this times out. + // This is executed on a background thread, so it must capture its parameters + // by value. + auto errorProducer = [=] { + std::stringstream ss; + ss << "moduleID: " << moduleId << " methodID: " << methodId + << " arguments: " << folly::toJson(arguments); + return ss.str(); + }; + + Value ret = Value::undefined(); + try { + scopedTimeoutInvoker_( + [&] { + ret = callFunctionReturnFlushedQueue_->call( + *runtime_, + moduleId, + methodId, + valueFromDynamic(*runtime_, arguments)); + }, + std::move(errorProducer)); + } catch (...) { + std::throw_with_nested( + std::runtime_error("Error calling " + moduleId + "." + methodId)); + } + + callNativeModules(ret, true); +} + +void JSIExecutor::invokeCallback( + const double callbackId, + const folly::dynamic& arguments) { + SystraceSection s("JSIExecutor::invokeCallback", "callbackId", callbackId); + if (!invokeCallbackAndReturnFlushedQueue_) { + bindBridge(); + } + Value ret; + try { + ret = invokeCallbackAndReturnFlushedQueue_->call( + *runtime_, callbackId, valueFromDynamic(*runtime_, arguments)); + } catch (...) { + std::throw_with_nested(std::runtime_error( + folly::to("Error invoking callback ", callbackId))); + } + + callNativeModules(ret, true); +} + +void JSIExecutor::setGlobalVariable( + std::string propName, + std::unique_ptr jsonValue) { + SystraceSection s("JSIExecutor::setGlobalVariable", "propName", propName); + runtime_->global().setProperty( + *runtime_, + propName.c_str(), + Value::createFromJsonUtf8( + *runtime_, + reinterpret_cast(jsonValue->c_str()), + jsonValue->size())); +} + +std::string JSIExecutor::getDescription() { + return "JSI " + runtime_->description(); +} + +void* JSIExecutor::getJavaScriptContext() { + return runtime_.get(); +} + +bool JSIExecutor::isInspectable() { + return runtime_->isInspectable(); +} + +void JSIExecutor::bindBridge() { + std::call_once(bindFlag_, [this] { + SystraceSection s("JSIExecutor::bindBridge (once)"); + Value batchedBridgeValue = + runtime_->global().getProperty(*runtime_, "__fbBatchedBridge"); + if (batchedBridgeValue.isUndefined()) { + Function requireBatchedBridge = runtime_->global().getPropertyAsFunction( + *runtime_, "__fbRequireBatchedBridge"); + batchedBridgeValue = requireBatchedBridge.call(*runtime_); + if (batchedBridgeValue.isUndefined()) { + throw JSINativeException( + "Could not get BatchedBridge, make sure your bundle is packaged correctly"); + } + } + + Object batchedBridge = batchedBridgeValue.asObject(*runtime_); + callFunctionReturnFlushedQueue_ = batchedBridge.getPropertyAsFunction( + *runtime_, "callFunctionReturnFlushedQueue"); + invokeCallbackAndReturnFlushedQueue_ = batchedBridge.getPropertyAsFunction( + *runtime_, "invokeCallbackAndReturnFlushedQueue"); + flushedQueue_ = + batchedBridge.getPropertyAsFunction(*runtime_, "flushedQueue"); + callFunctionReturnResultAndFlushedQueue_ = + batchedBridge.getPropertyAsFunction( + *runtime_, "callFunctionReturnResultAndFlushedQueue"); + }); +} + +void JSIExecutor::callNativeModules(const Value& queue, bool isEndOfBatch) { + SystraceSection s("JSIExecutor::callNativeModules"); + // If this fails, you need to pass a fully functional delegate with a + // module registry to the factory/ctor. + CHECK(delegate_) << "Attempting to use native modules without a delegate"; +#if 0 // maybe useful for debugging + std::string json = runtime_->global().getPropertyAsObject(*runtime_, "JSON") + .getPropertyAsFunction(*runtime_, "stringify").call(*runtime_, queue) + .getString(*runtime_).utf8(*runtime_); +#endif + delegate_->callNativeModules( + *this, dynamicFromValue(*runtime_, queue), isEndOfBatch); +} + +void JSIExecutor::flush() { + SystraceSection s("JSIExecutor::flush"); + if (flushedQueue_) { + callNativeModules(flushedQueue_->call(*runtime_), true); + return; + } + + // When a native module is called from JS, BatchedBridge.enqueueNativeCall() + // is invoked. For that to work, require('BatchedBridge') has to be called, + // and when that happens, __fbBatchedBridge is set as a side effect. + Value batchedBridge = + runtime_->global().getProperty(*runtime_, "__fbBatchedBridge"); + // So here, if __fbBatchedBridge doesn't exist, then we know no native calls + // have happened, and we were able to determine this without forcing + // BatchedBridge to be loaded as a side effect. + if (!batchedBridge.isUndefined()) { + // If calls were made, we bind to the JS bridge methods, and use them to + // get the pending queue of native calls. + bindBridge(); + callNativeModules(flushedQueue_->call(*runtime_), true); + } else if (delegate_) { + // If we have a delegate, we need to call it; we pass a null list to + // callNativeModules, since we know there are no native calls, without + // calling into JS again. If no calls were made and there's no delegate, + // nothing happens, which is correct. + callNativeModules(nullptr, true); + } +} + +Value JSIExecutor::nativeRequire(const Value* args, size_t count) { + if (count > 2 || count == 0) { + throw std::invalid_argument("Got wrong number of args"); + } + + uint32_t moduleId = folly::to(args[0].getNumber()); + uint32_t bundleId = count == 2 ? folly::to(args[1].getNumber()) : 0; + auto module = bundleRegistry_->getModule(bundleId, moduleId); + + runtime_->evaluateJavaScript( + std::make_unique(module.code), module.name); + return facebook::jsi::Value(); +} + +Value JSIExecutor::nativeCallSyncHook(const Value* args, size_t count) { + if (count != 3) { + throw std::invalid_argument("nativeCallSyncHook arg count must be 3"); + } + + if (!args[2].asObject(*runtime_).isArray(*runtime_)) { + throw std::invalid_argument( + folly::to("method parameters should be array")); + } + + MethodCallResult result = delegate_->callSerializableNativeHook( + *this, + static_cast(args[0].getNumber()), // moduleId + static_cast(args[1].getNumber()), // methodId + dynamicFromValue(*runtime_, args[2])); // args + + if (!result.hasValue()) { + return Value::undefined(); + } + return valueFromDynamic(*runtime_, result.value()); +} + +} // namespace react +} // namespace facebook diff --git a/ReactCommon/jsiexecutor/JSINativeModules.cpp b/ReactCommon/jsiexecutor/JSINativeModules.cpp new file mode 100644 index 00000000000000..7a5e0673ceb7c9 --- /dev/null +++ b/ReactCommon/jsiexecutor/JSINativeModules.cpp @@ -0,0 +1,86 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#include "jsireact/JSINativeModules.h" + +#include + +#include + +#include + +using namespace facebook::jsi; + +namespace facebook { +namespace react { + +JSINativeModules::JSINativeModules( + std::shared_ptr moduleRegistry) + : m_moduleRegistry(std::move(moduleRegistry)) {} + +Value JSINativeModules::getModule(Runtime& rt, const PropNameID& name) { + if (!m_moduleRegistry) { + return nullptr; + } + + std::string moduleName = name.utf8(rt); + + const auto it = m_objects.find(moduleName); + if (it != m_objects.end()) { + return Value(rt, it->second); + } + + auto module = createModule(rt, moduleName); + if (!module.hasValue()) { + // Allow lookup to continue in the objects own properties, which allows for + // overrides of NativeModules + return nullptr; + } + + auto result = + m_objects.emplace(std::move(moduleName), std::move(*module)).first; + return Value(rt, result->second); +} + +void JSINativeModules::reset() { + m_genNativeModuleJS = nullptr; + m_objects.clear(); +} + +folly::Optional JSINativeModules::createModule( + Runtime& rt, + const std::string& name) { + bool hasLogger(ReactMarker::logTaggedMarker); + if (hasLogger) { + ReactMarker::logTaggedMarker( + ReactMarker::NATIVE_MODULE_SETUP_START, name.c_str()); + } + + if (!m_genNativeModuleJS) { + m_genNativeModuleJS = + rt.global().getPropertyAsFunction(rt, "__fbGenNativeModule"); + } + + auto result = m_moduleRegistry->getConfig(name); + if (!result.hasValue()) { + return nullptr; + } + + Value moduleInfo = m_genNativeModuleJS->call( + rt, + valueFromDynamic(rt, result->config), + static_cast(result->index)); + CHECK(!moduleInfo.isNull()) << "Module returned from genNativeModule is null"; + + folly::Optional module( + moduleInfo.asObject(rt).getPropertyAsObject(rt, "module")); + + if (hasLogger) { + ReactMarker::logTaggedMarker( + ReactMarker::NATIVE_MODULE_SETUP_STOP, name.c_str()); + } + + return module; +} + +} // namespace react +} // namespace facebook diff --git a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h new file mode 100644 index 00000000000000..51c1d86b889010 --- /dev/null +++ b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h @@ -0,0 +1,149 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#pragma once + +#include "JSINativeModules.h" + +#include +#include +#include +#include +#include +#include + +namespace facebook { +namespace react { + +// A JSIScopedTimeoutInvoker is a trampoline-type function for introducing +// timeouts. Call the TimeoutInvoker with a function to execute, the invokee. +// The TimeoutInvoker will immediately invoke it, synchronously on the same +// thread. If the invokee fails to return after some timeout (private to the +// TimeoutInvoker), a soft error may be reported. +// +// If a soft error is reported, the second parameter errorMessageProducer will +// be invoked to produce an error message, which will be included in the soft +// error report. Note that the errorMessageProducer will be invoked +// asynchronously on a different thread. +// +// The timeout behavior does NOT caues the invokee to aborted. If the invokee +// blocks forever, so will the ScopedTimeoutInvoker (but the soft error may +// still be reported). +// +// The invokee is passed by const ref because it is executed synchronously, but +// the errorMessageProducer is passed by value because it must be copied or +// moved for async execution. +// +// Example usage: +// +// int param = ...; +// timeoutInvoker( +// [&]{ someBigWork(param); }, +// [=] -> std::string { +// return "someBigWork, param " + std::to_string(param); +// }) +// +using JSIScopedTimeoutInvoker = std::function& invokee, + std::function errorMessageProducer)>; + +class BigStringBuffer : public jsi::Buffer { + public: + BigStringBuffer(std::unique_ptr script) + : script_(std::move(script)) {} + + size_t size() const override { + return script_->size(); + } + + const uint8_t* data() const override { + return reinterpret_cast(script_->c_str()); + } + + private: + std::unique_ptr script_; +}; + +class JSIExecutor : public JSExecutor { + public: + using Logger = + std::function; + + using RuntimeInstaller = std::function; + + JSIExecutor( + std::shared_ptr runtime, + std::shared_ptr delegate, + Logger logger, + const JSIScopedTimeoutInvoker& timeoutInvoker, + RuntimeInstaller runtimeInstaller); + void loadApplicationScript( + std::unique_ptr script, + std::string sourceURL) override; + void setBundleRegistry(std::unique_ptr) override; + void registerBundle(uint32_t bundleId, const std::string& bundlePath) + override; + void callFunction( + const std::string& moduleId, + const std::string& methodId, + const folly::dynamic& arguments) override; + void invokeCallback(const double callbackId, const folly::dynamic& arguments) + override; + void setGlobalVariable( + std::string propName, + std::unique_ptr jsonValue) override; + std::string getDescription() override; + void* getJavaScriptContext() override; + bool isInspectable() override; + + // An implementation of JSIScopedTimeoutInvoker that simply runs the + // invokee, with no timeout. + static void defaultTimeoutInvoker( + const std::function& invokee, + std::function errorMessageProducer) { + (void)errorMessageProducer; + invokee(); + } + + private: + class NativeModuleProxy; + + void flush(); + void bindBridge(); + void callNativeModules(const jsi::Value& queue, bool isEndOfBatch); + jsi::Value nativeCallSyncHook(const jsi::Value* args, size_t count); + jsi::Value nativeRequire(const jsi::Value* args, size_t count); + + std::shared_ptr runtime_; + std::shared_ptr delegate_; + JSINativeModules nativeModules_; + std::once_flag bindFlag_; + std::unique_ptr bundleRegistry_; + Logger logger_; + JSIScopedTimeoutInvoker scopedTimeoutInvoker_; + RuntimeInstaller runtimeInstaller_; + + folly::Optional callFunctionReturnFlushedQueue_; + folly::Optional invokeCallbackAndReturnFlushedQueue_; + folly::Optional flushedQueue_; + folly::Optional callFunctionReturnResultAndFlushedQueue_; +}; + +class JSIExecutorFactory : public JSExecutorFactory { + public: + explicit JSIExecutorFactory( + std::shared_ptr runtime, + JSIExecutor::Logger logger, + JSIExecutor::RuntimeInstaller); + + std::unique_ptr createJSExecutor( + std::shared_ptr delegate, + std::shared_ptr jsQueue) override; + + private: + std::shared_ptr runtime_; + JSIExecutor::Logger logger_; + JSIExecutor::RuntimeInstaller runtimeInstaller_; +}; + +} // namespace react +} // namespace facebook diff --git a/ReactCommon/jsiexecutor/jsireact/JSINativeModules.h b/ReactCommon/jsiexecutor/jsireact/JSINativeModules.h new file mode 100644 index 00000000000000..6b7ff731a09b8b --- /dev/null +++ b/ReactCommon/jsiexecutor/jsireact/JSINativeModules.h @@ -0,0 +1,35 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#pragma once + +#include +#include + +#include +#include +#include + +namespace facebook { +namespace react { + +/** + * Holds and creates JS representations of the modules in ModuleRegistry + */ +class JSINativeModules { + public: + explicit JSINativeModules(std::shared_ptr moduleRegistry); + jsi::Value getModule(jsi::Runtime& rt, const jsi::PropNameID& name); + void reset(); + + private: + folly::Optional m_genNativeModuleJS; + std::shared_ptr m_moduleRegistry; + std::unordered_map m_objects; + + folly::Optional createModule( + jsi::Runtime& rt, + const std::string& name); +}; + +} // namespace react +} // namespace facebook diff --git a/ReactCommon/jsinspector/Android.mk b/ReactCommon/jsinspector/Android.mk index d5fe4ef12dc08a..2e36c22745a7d1 100644 --- a/ReactCommon/jsinspector/Android.mk +++ b/ReactCommon/jsinspector/Android.mk @@ -4,8 +4,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := jsinspector -LOCAL_SRC_FILES := \ - InspectorInterfaces.cpp +LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) diff --git a/ReactCommon/privatedata/Android.mk b/ReactCommon/privatedata/Android.mk deleted file mode 100644 index 35ea5133c63a75..00000000000000 --- a/ReactCommon/privatedata/Android.mk +++ /dev/null @@ -1,18 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := privatedata - -LOCAL_SRC_FILES := \ - PrivateDataBase.cpp \ - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) - -LOCAL_CFLAGS := \ - -DLOG_TAG=\"ReactNative\" - -LOCAL_CFLAGS += -fexceptions -frtti - -include $(BUILD_SHARED_LIBRARY) diff --git a/ReactCommon/privatedata/BUCK b/ReactCommon/privatedata/BUCK deleted file mode 100644 index 57cd605f6b2d9c..00000000000000 --- a/ReactCommon/privatedata/BUCK +++ /dev/null @@ -1,24 +0,0 @@ -load("@fbsource//tools/build_defs:glob_defs.bzl", "subdir_glob") -load("//tools/build_defs/oss:rn_defs.bzl", "rn_xplat_cxx_library") - -rn_xplat_cxx_library( - name = "privatedata", - srcs = glob(["**/*.cpp"]), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "**/*.h"), - ], - prefix = "privatedata", - ), - compiler_flags = [ - "-Wall", - "-fexceptions", - "-frtti", - "-fvisibility=hidden", - "-std=c++1y", - ], - visibility = [ - "PUBLIC", - ], -) diff --git a/ReactCommon/privatedata/PrivateDataBase.cpp b/ReactCommon/privatedata/PrivateDataBase.cpp deleted file mode 100644 index f7024d35436f17..00000000000000 --- a/ReactCommon/privatedata/PrivateDataBase.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#include "PrivateDataBase.h" - -namespace facebook { -namespace react { - -PrivateDataBase::~PrivateDataBase() {} - -} } diff --git a/ReactCommon/privatedata/PrivateDataBase.h b/ReactCommon/privatedata/PrivateDataBase.h deleted file mode 100644 index 20d29228ff698c..00000000000000 --- a/ReactCommon/privatedata/PrivateDataBase.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Facebook, Inc. and its affiliates. - -// This source code is licensed under the MIT license found in the -// LICENSE file in the root directory of this source tree. - -#pragma once - -#include -#include -#include - -#ifndef RN_EXPORT -#define RN_EXPORT __attribute__((visibility("default"))) -#endif - -namespace facebook { -namespace react { - -// Base class for private data used to implement hybrid JS-native objects. A common root class, -// rtti and dynamic_cast allow us to do some runtime type checking that makes it possible -// for multiple hybrid object implementations to co-exist. -class RN_EXPORT PrivateDataBase { - public: - virtual ~PrivateDataBase(); - - // Casts given void* to PrivateDataBase and performs dynamic_cast to desired type. Returns null on - // failure. - template - static typename std::enable_if::value, T>::type* tryCast(void* ptr) { - return dynamic_cast(reinterpret_cast(ptr)); - } - - // Like tryCast, but aborts on failure. - template - static typename std::enable_if::value, T>::type* cast(void* ptr) { - auto result = tryCast(ptr); - if (!result) { - assert(false && "could not cast to desired type"); - abort(); - } - return result; - } -}; - -} } diff --git a/local-cli/templates/HelloWorld/ios/HelloWorld.xcodeproj/project.pbxproj b/local-cli/templates/HelloWorld/ios/HelloWorld.xcodeproj/project.pbxproj index 15cf73e72a098a..975ce5700159f2 100644 --- a/local-cli/templates/HelloWorld/ios/HelloWorld.xcodeproj/project.pbxproj +++ b/local-cli/templates/HelloWorld/ios/HelloWorld.xcodeproj/project.pbxproj @@ -38,6 +38,8 @@ 2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; }; + ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED297162215061F000B7C4FE /* JavaScriptCore.framework */; }; + ED2971652150620600B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2971642150620600B7C4FE /* JavaScriptCore.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -343,6 +345,8 @@ 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = ""; }; + ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; + ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -358,6 +362,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */, ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */, 11D1A2F320CAFA9E000508D9 /* libRCTAnimation.a in Frameworks */, 146834051AC3E58100842450 /* libReact.a in Frameworks */, @@ -377,6 +382,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + ED2971652150620600B7C4FE /* JavaScriptCore.framework in Frameworks */, 2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */, 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */, 2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */, @@ -518,6 +524,8 @@ 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { isa = PBXGroup; children = ( + ED297162215061F000B7C4FE /* JavaScriptCore.framework */, + ED2971642150620600B7C4FE /* JavaScriptCore.framework */, 2D16E6891FA4F8E400B85C8A /* libReact.a */, ); name = Frameworks; diff --git a/tools/build_defs/oss/rn_defs.bzl b/tools/build_defs/oss/rn_defs.bzl index 2f73d5f44660a5..df1f7bfbd2ea3f 100644 --- a/tools/build_defs/oss/rn_defs.bzl +++ b/tools/build_defs/oss/rn_defs.bzl @@ -22,8 +22,6 @@ GLOG_DEP = "//ReactAndroid/build/third-party-ndk/glog:glog" INSPECTOR_FLAGS = [] -APPLE_JSC_INTERNAL_DEPS = [] - APPLE_JSC_DEPS = [] ANDROID_JSC_INTERNAL_DEPS = [ @@ -83,11 +81,15 @@ def react_native_tests_target(path): def react_native_integration_tests_target(path): return "//ReactAndroid/src/androidTest/" + path -# Helper for referring to non-RN code from RN OSS code. +# Helpers for referring to non-RN code from RN OSS code. # Example: react_native_dep('java/com/facebook/systrace:systrace') def react_native_dep(path): return "//ReactAndroid/src/main/" + path +# Example: react_native_xplat_dep('java/com/facebook/systrace:systrace') +def react_native_xplat_dep(path): + return '//ReactCommon/' + path + # React property preprocessor def rn_android_library(name, deps = [], plugins = [], *args, **kwargs): if react_native_target(