Skip to content

Commit cb3e575

Browse files
javacheFacebook Github Bot
authored andcommitted
Allow bridge delegate to specify whether to use custom JSC wrapper
Reviewed By: mhorowitz Differential Revision: D4197657 fbshipit-source-id: 09e050f802b41c9a7016456c25381018b2123553
1 parent 55a615b commit cb3e575

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

React/Base/RCTBridgeDelegate.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@
8282
*/
8383
- (BOOL)shouldBridgeInitializeNativeModulesSynchronously:(RCTBridge *)bridge;
8484

85+
/**
86+
* Configure whether the JSCExecutor created should use the system JSC API or
87+
* alternative hooks provided. When returning YES from this method, you must have
88+
* previously called facebook::react::setCustomJSCWrapper.
89+
*
90+
* @experimental
91+
*/
92+
- (BOOL)shouldBridgeUseCustomJSC:(RCTBridge *)bridge;
93+
8594
/**
8695
* The bridge will automatically attempt to load the JS source code from the
8796
* location specified by the `sourceURLForBridge:` method, however, if you want

ReactCommon/cxxreact/JSCExecutor.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,15 @@ void JSCExecutor::setContextName(const std::string& name) {
216216
void JSCExecutor::initOnJSVMThread() throw(JSException) {
217217
SystraceSection s("JSCExecutor.initOnJSVMThread");
218218

219+
#if defined(__APPLE__)
220+
const bool useCustomJSC = m_jscConfig.getDefault("UseCustomJSC", false).getBool();
221+
if (useCustomJSC) {
222+
JSC_configureJSCForIOS(true);
223+
}
224+
#else
219225
const bool useCustomJSC = false;
226+
#endif
227+
220228
#if defined(WITH_FB_JSC_TUNING) && defined(__ANDROID__)
221229
configureJSCForAndroid(m_jscConfig);
222230
#endif

0 commit comments

Comments
 (0)