Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bridgeless mode: Stop register JSTimers as callable JavaScript module
Summary: We do not need to register JSTimers as a callable JavaScript module in bridgeless mode. How we know bridgeless mode doesn't use JSTimers: [xbgs JSTimers](https://fburl.com/code/clbz47j5) ## Details: iOS JSTimers is only called into [by RCTCxxBridge](https://www.internalfb.com/code/fbsource/[88911d726fb4413765903c32a9077cd662ee7b6e]/xplat/js/react-native-github/React/CxxBridge/RCTCxxBridge.mm?lines=1471), and [RCTTiming.mm, which uses the RCTBridge](https://www.internalfb.com/code/fbsource/[88911d726fb4413765903c32a9077cd662ee7b6e]/xplat/js/react-native-github/React/CoreModules/RCTTiming.mm?lines=23%2C241%2C264). RCTBridge is unavailable in bridgeless mode. ## Details: Android JSTimers is only called into [by TimingModule, inside its BridgeTimerExecutor](https://www.internalfb.com/code/fbsource/[88911d726fb4413765903c32a9077cd662ee7b6e]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.java?lines=31%2C40%2C49). This BridgeTimerExecutor is [passed to TimingModule's JavaTimerManager](https://www.internalfb.com/code/fbsource/[88911d726fb4413765903c32a9077cd662ee7b6e]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.java?lines=61-66). The Bridgeless React instance on Android **does not** use this TimingModule, or this BridgeTimerExecutor. Instead, the Bridgeless React instance [creates its own JavaTimerManager](https://www.internalfb.com/code/fbsource/[88911d726fb4413765903c32a9077cd662ee7b6e]/fbandroid/java/com/facebook/venice/ReactInstance.java?lines=118-123), [in C++](https://www.internalfb.com/code/fbsource/[88911d726fb4413765903c32a9077cd662ee7b6e]/fbandroid/java/com/facebook/venice/ReactInstance.java?lines=117%2C121%2C382), that [implements the callTimers APIs in C++](https://www.internalfb.com/code/fbsource/[88911d726fb4413765903c32a9077cd662ee7b6e]/fbandroid/java/com/facebook/venice/jni/JJSTimerExecutor.cpp?lines=18-22). Therefore, in Bridgeless mode, the React instance calls into TimerManager to execute timers, whereas in Bridge mode, TimingModule calls into JSTimers to call timers. Hence, JSTimers should also not be used in bridgeless mode. Changelog: [Internal] Reviewed By: fkgozali Differential Revision: D37208873 fbshipit-source-id: ef6ebe0e8a9fcbcc1f8403ed40ff94ec00b2beac
- Loading branch information