Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename jsinspector-modern feature flag to fuseboxEnabled #44661

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Rename jsinspector-modern feature flag to to fuseboxEnabled (#44661)
Summary:
Pull Request resolved: #44661

Changelog: [Internal]

Differential Revision: D57730920
  • Loading branch information
huntie authored and facebook-github-bot committed May 24, 2024
commit 39998e5388b9a518965bf7129c3e8bd76edafd2f
4 changes: 2 additions & 2 deletions packages/react-native/React/Base/RCTBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ - (void)didReceiveReloadCommand
{
#if RCT_ENABLE_INSPECTOR
auto &inspectorFlags = facebook::react::jsinspector_modern::InspectorFlags::getInstance();
if (!inspectorFlags.getEnableModernCDPRegistry()) {
if (!inspectorFlags.getFuseboxEnabled()) {
// Disable debugger to resume the JsVM & avoid thread locks while reloading
[RCTInspectorDevServerHelper disableDebugger];
}
Expand Down Expand Up @@ -440,7 +440,7 @@ - (void)setUp
[_performanceLogger markStartForTag:RCTPLTTI];

auto &inspectorFlags = facebook::react::jsinspector_modern::InspectorFlags::getInstance();
if (inspectorFlags.getEnableModernCDPRegistry() && !_inspectorPageId.has_value()) {
if (inspectorFlags.getFuseboxEnabled() && !_inspectorPageId.has_value()) {
_inspectorTarget =
facebook::react::jsinspector_modern::HostTarget::create(*_inspectorHostDelegate, [](auto callback) {
RCTExecuteOnMainQueue(^{
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/React/Base/RCTBundleURLProvider.mm
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
[[NSURLQueryItem alloc] initWithName:@"runModule" value:runModule ? @"true" : @"false"],
];
auto &inspectorFlags = facebook::react::jsinspector_modern::InspectorFlags::getInstance();
if (inspectorFlags.getEnableModernCDPRegistry()) {
if (inspectorFlags.getFuseboxEnabled()) {
queryItems = [queryItems arrayByAddingObject:[[NSURLQueryItem alloc] initWithName:@"excludeSource" value:@"true"]];
queryItems = [queryItems arrayByAddingObject:[[NSURLQueryItem alloc] initWithName:@"sourcePaths"
value:@"url-server"]];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,10 @@

auto &inspectorFlags = facebook::react::jsinspector_modern::InspectorFlags::getInstance();

NSString *rawDeviceId =
[NSString stringWithFormat:@"apple-%@-%@-%s",
identifierForVendor,
bundleId,
inspectorFlags.getEnableModernCDPRegistry() ? "fusebox" : "legacy"];
NSString *rawDeviceId = [NSString stringWithFormat:@"apple-%@-%@-%s",
identifierForVendor,
bundleId,
inspectorFlags.getFuseboxEnabled() ? "fusebox" : "legacy"];

return getSHA256(rawDeviceId);
}
Expand Down Expand Up @@ -163,7 +162,7 @@ + (void)openDebugger:(NSURL *)bundleURL withErrorMessage:(NSString *)errorMessag
+ (void)disableDebugger
{
auto &inspectorFlags = facebook::react::jsinspector_modern::InspectorFlags::getInstance();
if (!inspectorFlags.getEnableModernCDPRegistry()) {
if (!inspectorFlags.getFuseboxEnabled()) {
sendEventToAllConnections(kDebuggerMsgDisable);
}
}
Expand All @@ -182,7 +181,7 @@ + (void)disableDebugger
NSString *key = [inspectorURL absoluteString];
id<RCTInspectorPackagerConnectionProtocol> connection = socketConnections[key];
if (!connection || !connection.isConnected) {
if (facebook::react::jsinspector_modern::InspectorFlags::getInstance().getEnableModernCDPRegistry()) {
if (facebook::react::jsinspector_modern::InspectorFlags::getInstance().getFuseboxEnabled()) {
connection = [[RCTCxxInspectorPackagerConnection alloc] initWithURL:inspectorURL];
} else {
// TODO(T190163403): Remove legacy RCTInspectorPackagerConnection
Expand Down
3 changes: 1 addition & 2 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -2182,7 +2182,7 @@ public abstract interface class com/facebook/react/devsupport/HMRClient : com/fa

public final class com/facebook/react/devsupport/InspectorFlags {
public static final field INSTANCE Lcom/facebook/react/devsupport/InspectorFlags;
public static final fun getEnableModernCDPRegistry ()Z
public static final fun getFuseboxEnabled ()Z
}

public class com/facebook/react/devsupport/InspectorPackagerConnection : com/facebook/react/devsupport/IInspectorPackagerConnection {
Expand Down Expand Up @@ -8048,4 +8048,3 @@ public final class com/facebook/react/views/view/ViewGroupClickEvent : com/faceb
public fun canCoalesce ()Z
public fun getEventName ()Ljava/lang/String;
}

Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,7 @@ private void processPackage(
}

private @Nullable ReactInstanceManagerInspectorTarget getOrCreateInspectorTarget() {
if (mInspectorTarget == null && InspectorFlags.getEnableModernCDPRegistry()) {
if (mInspectorTarget == null && InspectorFlags.getFuseboxEnabled()) {

mInspectorTarget =
new ReactInstanceManagerInspectorTarget(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void openInspectorConnection() {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
if (InspectorFlags.getEnableModernCDPRegistry()) {
if (InspectorFlags.getFuseboxEnabled()) {
mInspectorPackagerConnection =
new CxxInspectorPackagerConnection(getInspectorDeviceUrl(), mPackageName);
} else {
Expand Down Expand Up @@ -310,7 +310,7 @@ private String getInspectorDeviceId() {
"android-%s-%s-%s",
packageName,
androidId,
InspectorFlags.getEnableModernCDPRegistry() ? "fusebox" : "legacy");
InspectorFlags.getFuseboxEnabled() ? "fusebox" : "legacy");

return getSHA256(rawDeviceId);
}
Expand Down Expand Up @@ -394,9 +394,7 @@ private String createBundleURL(
mPackageName,
modulesOnly ? "true" : "false",
runModule ? "true" : "false")
+ (InspectorFlags.getEnableModernCDPRegistry()
? "&excludeSource=true&sourcePaths=url-server"
: "");
+ (InspectorFlags.getFuseboxEnabled() ? "&excludeSource=true&sourcePaths=url-server" : "");
}

private String createBundleURL(String mainModuleID, BundleType type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ public void onPackagerDisconnected() {

@Override
public void onPackagerReloadCommand() {
if (!InspectorFlags.getEnableModernCDPRegistry()) {
if (!InspectorFlags.getFuseboxEnabled()) {
// Disable debugger to resume the JsVM & avoid thread locks while reloading
mDevServerHelper.disableDebugger();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ public object InspectorFlags {
DevSupportSoLoader.staticInit()
}

@DoNotStrip @JvmStatic public external fun getEnableModernCDPRegistry(): Boolean
@DoNotStrip @JvmStatic public external fun getFuseboxEnabled(): Boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<53200319e16c1f14028d9cb8a2c87078>>
* @generated SignedSource<<66b25d6d12959ea3378e8b8dbbae037e>>
*/

/**
Expand Down Expand Up @@ -107,10 +107,10 @@ public object ReactNativeFeatureFlags {
public fun forceBatchingMountItemsOnAndroid(): Boolean = accessor.forceBatchingMountItemsOnAndroid()

/**
* Flag determining if the modern CDP backend should be enabled. This flag is global and should not be changed across React Host lifetimes.
* Flag determining if the React Native DevTools (Fusebox) CDP backend should be enabled. This flag is global and should not be changed across React Host lifetimes.
*/
@JvmStatic
public fun inspectorEnableModernCDPRegistry(): Boolean = accessor.inspectorEnableModernCDPRegistry()
public fun fuseboxEnabled(): Boolean = accessor.fuseboxEnabled()

/**
* Only enqueue Choreographer calls if there is an ongoing animation, instead of enqueueing every frame.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<54a79c6e6f4946c4c36692fbc19b927a>>
* @generated SignedSource<<86c1725630e3dadfb97ca9bccd618dd7>>
*/

/**
Expand Down Expand Up @@ -33,7 +33,7 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
private var enableUIConsistencyCache: Boolean? = null
private var fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeakCache: Boolean? = null
private var forceBatchingMountItemsOnAndroidCache: Boolean? = null
private var inspectorEnableModernCDPRegistryCache: Boolean? = null
private var fuseboxEnabledCache: Boolean? = null
private var lazyAnimationCallbacksCache: Boolean? = null
private var preventDoubleTextMeasureCache: Boolean? = null
private var setAndroidLayoutDirectionCache: Boolean? = null
Expand Down Expand Up @@ -158,11 +158,11 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}

override fun inspectorEnableModernCDPRegistry(): Boolean {
var cached = inspectorEnableModernCDPRegistryCache
override fun fuseboxEnabled(): Boolean {
var cached = fuseboxEnabledCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.inspectorEnableModernCDPRegistry()
inspectorEnableModernCDPRegistryCache = cached
cached = ReactNativeFeatureFlagsCxxInterop.fuseboxEnabled()
fuseboxEnabledCache = cached
}
return cached
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<4eee31ea22fc4116e9070f714dc59daf>>
* @generated SignedSource<<f251cc21200e36fa883205666c4f38d9>>
*/

/**
Expand Down Expand Up @@ -54,7 +54,7 @@ public object ReactNativeFeatureFlagsCxxInterop {

@DoNotStrip @JvmStatic public external fun forceBatchingMountItemsOnAndroid(): Boolean

@DoNotStrip @JvmStatic public external fun inspectorEnableModernCDPRegistry(): Boolean
@DoNotStrip @JvmStatic public external fun fuseboxEnabled(): Boolean

@DoNotStrip @JvmStatic public external fun lazyAnimationCallbacks(): Boolean

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<f29998f04860c4af0eb027b2e660c4b4>>
* @generated SignedSource<<a85930c3a00dfa8e1008403ecd828357>>
*/

/**
Expand Down Expand Up @@ -49,7 +49,7 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun forceBatchingMountItemsOnAndroid(): Boolean = false

override fun inspectorEnableModernCDPRegistry(): Boolean = false
override fun fuseboxEnabled(): Boolean = false

override fun lazyAnimationCallbacks(): Boolean = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<a2706af43bfe0803eab9a70d24cd79c9>>
* @generated SignedSource<<28e42dd2ab3adbf71e828037a8314f3a>>
*/

/**
Expand Down Expand Up @@ -37,7 +37,7 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
private var enableUIConsistencyCache: Boolean? = null
private var fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeakCache: Boolean? = null
private var forceBatchingMountItemsOnAndroidCache: Boolean? = null
private var inspectorEnableModernCDPRegistryCache: Boolean? = null
private var fuseboxEnabledCache: Boolean? = null
private var lazyAnimationCallbacksCache: Boolean? = null
private var preventDoubleTextMeasureCache: Boolean? = null
private var setAndroidLayoutDirectionCache: Boolean? = null
Expand Down Expand Up @@ -175,12 +175,12 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}

override fun inspectorEnableModernCDPRegistry(): Boolean {
var cached = inspectorEnableModernCDPRegistryCache
override fun fuseboxEnabled(): Boolean {
var cached = fuseboxEnabledCache
if (cached == null) {
cached = currentProvider.inspectorEnableModernCDPRegistry()
accessedFeatureFlags.add("inspectorEnableModernCDPRegistry")
inspectorEnableModernCDPRegistryCache = cached
cached = currentProvider.fuseboxEnabled()
accessedFeatureFlags.add("fuseboxEnabled")
fuseboxEnabledCache = cached
}
return cached
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<fff46073d92efbec147cd2f1dad110cb>>
* @generated SignedSource<<500cd1ff0d3ddbaff62d99f6d9e79e5b>>
*/

/**
Expand Down Expand Up @@ -49,7 +49,7 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun forceBatchingMountItemsOnAndroid(): Boolean

@DoNotStrip public fun inspectorEnableModernCDPRegistry(): Boolean
@DoNotStrip public fun fuseboxEnabled(): Boolean

@DoNotStrip public fun lazyAnimationCallbacks(): Boolean

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ public void setJsEngineResolutionAlgorithm(
}

private @Nullable ReactHostInspectorTarget getOrCreateReactHostInspectorTarget() {
if (mReactHostInspectorTarget == null && InspectorFlags.getEnableModernCDPRegistry()) {
if (mReactHostInspectorTarget == null && InspectorFlags.getFuseboxEnabled()) {
mReactHostInspectorTarget = new ReactHostInspectorTarget(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@

namespace facebook::react::jsinspector_modern {

bool JInspectorFlags::getEnableModernCDPRegistry(jni::alias_ref<jclass>) {
bool JInspectorFlags::getFuseboxEnabled(jni::alias_ref<jclass> /*unused*/) {
auto& inspectorFlags = InspectorFlags::getInstance();
return inspectorFlags.getEnableModernCDPRegistry();
return inspectorFlags.getFuseboxEnabled();
}

void JInspectorFlags::registerNatives() {
javaClassLocal()->registerNatives({
makeNativeMethod(
"getEnableModernCDPRegistry",
JInspectorFlags::getEnableModernCDPRegistry),
makeNativeMethod("getFuseboxEnabled", JInspectorFlags::getFuseboxEnabled),
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class JInspectorFlags : public jni::JavaClass<JInspectorFlags> {
static constexpr auto kJavaDescriptor =
"Lcom/facebook/react/devsupport/InspectorFlags;";

static bool getEnableModernCDPRegistry(jni::alias_ref<jclass>);
static bool getFuseboxEnabled(jni::alias_ref<jclass>);

static void registerNatives();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<f2a88e318efcf92bf7cd2b07e3ed5faf>>
* @generated SignedSource<<37494761b0096640cde5094a2f3ba6ee>>
*/

/**
Expand Down Expand Up @@ -117,9 +117,9 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}

bool inspectorEnableModernCDPRegistry() override {
bool fuseboxEnabled() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("inspectorEnableModernCDPRegistry");
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("fuseboxEnabled");
return method(javaProvider_);
}

Expand Down Expand Up @@ -228,9 +228,9 @@ bool JReactNativeFeatureFlagsCxxInterop::forceBatchingMountItemsOnAndroid(
return ReactNativeFeatureFlags::forceBatchingMountItemsOnAndroid();
}

bool JReactNativeFeatureFlagsCxxInterop::inspectorEnableModernCDPRegistry(
bool JReactNativeFeatureFlagsCxxInterop::fuseboxEnabled(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::inspectorEnableModernCDPRegistry();
return ReactNativeFeatureFlags::fuseboxEnabled();
}

bool JReactNativeFeatureFlagsCxxInterop::lazyAnimationCallbacks(
Expand Down Expand Up @@ -320,8 +320,8 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
"forceBatchingMountItemsOnAndroid",
JReactNativeFeatureFlagsCxxInterop::forceBatchingMountItemsOnAndroid),
makeNativeMethod(
"inspectorEnableModernCDPRegistry",
JReactNativeFeatureFlagsCxxInterop::inspectorEnableModernCDPRegistry),
"fuseboxEnabled",
JReactNativeFeatureFlagsCxxInterop::fuseboxEnabled),
makeNativeMethod(
"lazyAnimationCallbacks",
JReactNativeFeatureFlagsCxxInterop::lazyAnimationCallbacks),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<48f683554e70183664d5a1bf6a7ab328>>
* @generated SignedSource<<ddf6ea7126754a1f10e06eb9ac4fb276>>
*/

/**
Expand Down Expand Up @@ -69,7 +69,7 @@ class JReactNativeFeatureFlagsCxxInterop
static bool forceBatchingMountItemsOnAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool inspectorEnableModernCDPRegistry(
static bool fuseboxEnabled(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool lazyAnimationCallbacks(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ReactInstanceManagerInspectorTarget::ReactInstanceManagerInspectorTarget(
: delegate_(make_global(delegate)) {
auto& inspectorFlags = InspectorFlags::getInstance();

if (inspectorFlags.getEnableModernCDPRegistry()) {
if (inspectorFlags.getFuseboxEnabled()) {
inspectorTarget_ = HostTarget::create(
*this,
[javaExecutor =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ JReactHostInspectorTarget::JReactHostInspectorTarget(
: javaReactHostImpl_(make_global(reactHostImpl)),
javaExecutor_(make_global(executor)) {
auto& inspectorFlags = InspectorFlags::getInstance();
if (inspectorFlags.getEnableModernCDPRegistry()) {
if (inspectorFlags.getFuseboxEnabled()) {
inspectorTarget_ = HostTarget::create(
*this,
[javaExecutor =
Expand Down
Loading
Loading