Skip to content

Commit

Permalink
Interop: Create gating for the Bridge proxy
Browse files Browse the repository at this point in the history
Summary:
The TurboModule interop layer on iOS will ship with a Bridge proxy.

The Bridge proxy is an object (see D46084318) that will try to simulate the Bridge's APIs, whenever possible, by delegating to Bridgeless abstractions.

## Changes
**Fact:** All FBiOS modules work with/without the bridge.

So, let's break down the Interop layer test group (i.e: interop on) into two groups:
- interop on, bridge proxy off
- interop on, bridge proxy on

## Benefits
This will speed up the production test, by allowing us to:
1. Isolate Interop issues to the bridge proxy faster.
2. Stabilize the TurboModule interop layer faster.

NOTE: This flag is temporary, and should be removed long-term: The TurboModule interop layer should ship with the bridge proxy enabled by default.

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D46088752

fbshipit-source-id: 1e161d49382635a44194166645c1a5d56d37b4de
  • Loading branch information
RSNara authored and facebook-github-bot committed May 31, 2023
1 parent 197ed43 commit 462c648
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react-native/React/Base/RCTBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ RCT_EXTERN void RCTDisableTurboModuleManagerDelegateLocking(BOOL enabled);
RCT_EXTERN BOOL RCTTurboModuleInteropEnabled(void);
RCT_EXTERN void RCTEnableTurboModuleInterop(BOOL enabled);

// Turn on TurboModule interop's Bridge proxy
RCT_EXTERN BOOL RCTTurboModuleInteropBridgeProxyEnabled(void);
RCT_EXTERN void RCTEnableTurboModuleInteropBridgeProxy(BOOL enabled);

// Route all TurboModules through TurboModule interop
RCT_EXTERN BOOL RCTTurboModuleInteropForAllTurboModulesEnabled(void);
RCT_EXTERN void RCTEnableTurboModuleInteropForAllTurboModules(BOOL enabled);
Expand Down
11 changes: 11 additions & 0 deletions packages/react-native/React/Base/RCTBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ void RCTEnableTurboModuleInterop(BOOL enabled)
turboModuleInteropEnabled = enabled;
}

static BOOL turboModuleInteropBridgeProxyEnabled = NO;
BOOL RCTTurboModuleInteropBridgeProxyEnabled(void)
{
return turboModuleInteropBridgeProxyEnabled;
}

void RCTEnableTurboModuleInteropBridgeProxy(BOOL enabled)
{
turboModuleInteropBridgeProxyEnabled = enabled;
}

static BOOL useTurboModuleInteropForAllTurboModules = NO;
BOOL RCTTurboModuleInteropForAllTurboModulesEnabled(void)
{
Expand Down

0 comments on commit 462c648

Please sign in to comment.