mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Update InspectorFlags to source from ReactNativeFeatureFlags (#42665)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/42665 - Replace the internals of `InspectorFlags` to use the new `ReactNativeFeatureFlags` setup. - Remove call sites to `InspectorFlags::initFromConfig`. After this diff, all `InspectorFlags` are configured from `ReactNativeFeatureFlags.json`. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D53049790 fbshipit-source-id: 90c2b128a9c316546c3f8f8f88e2c08a9f55ae72
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ce3ce1194b
commit
280f37336d
+13
-1
@@ -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<<de038facca377ff545878c7eba4141df>>
|
||||
* @generated SignedSource<<c526fb1c44f00f5b032684396246e4d4>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -76,6 +76,18 @@ public object ReactNativeFeatureFlags {
|
||||
@JvmStatic
|
||||
public fun enableFixForClippedSubviewsCrash(): Boolean = accessor.enableFixForClippedSubviewsCrash()
|
||||
|
||||
/**
|
||||
* Flag determining if the C++ implementation of InspectorPackagerConnection should be used instead of the per-platform one. This flag is global and should not be changed across React Host lifetimes.
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun inspectorEnableCxxInspectorPackagerConnection(): Boolean = accessor.inspectorEnableCxxInspectorPackagerConnection()
|
||||
|
||||
/**
|
||||
* Flag determining if the modern 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()
|
||||
|
||||
/**
|
||||
* Overrides the feature flags with the ones provided by the given provider
|
||||
* (generally one that extends `ReactNativeFeatureFlagsDefaults`).
|
||||
|
||||
+21
-1
@@ -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<<8d6196766629d3361922502553fd1d2b>>
|
||||
* @generated SignedSource<<11824621ee7ca5dbdf2f09bdf1a1f983>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -28,6 +28,8 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
|
||||
private var enableSpannableBuildingUnificationCache: Boolean? = null
|
||||
private var enableCustomDrawOrderFabricCache: Boolean? = null
|
||||
private var enableFixForClippedSubviewsCrashCache: Boolean? = null
|
||||
private var inspectorEnableCxxInspectorPackagerConnectionCache: Boolean? = null
|
||||
private var inspectorEnableModernCDPRegistryCache: Boolean? = null
|
||||
|
||||
override fun commonTestFlag(): Boolean {
|
||||
var cached = commonTestFlagCache
|
||||
@@ -101,6 +103,24 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun inspectorEnableCxxInspectorPackagerConnection(): Boolean {
|
||||
var cached = inspectorEnableCxxInspectorPackagerConnectionCache
|
||||
if (cached == null) {
|
||||
cached = ReactNativeFeatureFlagsCxxInterop.inspectorEnableCxxInspectorPackagerConnection()
|
||||
inspectorEnableCxxInspectorPackagerConnectionCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun inspectorEnableModernCDPRegistry(): Boolean {
|
||||
var cached = inspectorEnableModernCDPRegistryCache
|
||||
if (cached == null) {
|
||||
cached = ReactNativeFeatureFlagsCxxInterop.inspectorEnableModernCDPRegistry()
|
||||
inspectorEnableModernCDPRegistryCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun override(provider: ReactNativeFeatureFlagsProvider): Unit =
|
||||
ReactNativeFeatureFlagsCxxInterop.override(provider as Any)
|
||||
|
||||
|
||||
+5
-1
@@ -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<<42f8526cf5c3ca10ac068c3bc30433ca>>
|
||||
* @generated SignedSource<<dfbe9bcab657e4c66dd104788639448d>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -44,6 +44,10 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableFixForClippedSubviewsCrash(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun inspectorEnableCxxInspectorPackagerConnection(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun inspectorEnableModernCDPRegistry(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun override(provider: Any)
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun dangerouslyReset()
|
||||
|
||||
+5
-1
@@ -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<<28e35777aa2f03b7bd07472ce80aade2>>
|
||||
* @generated SignedSource<<cc8e437bf2f486949f256a19d3d73a1e>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -38,4 +38,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
||||
override fun enableCustomDrawOrderFabric(): Boolean = false
|
||||
|
||||
override fun enableFixForClippedSubviewsCrash(): Boolean = false
|
||||
|
||||
override fun inspectorEnableCxxInspectorPackagerConnection(): Boolean = false
|
||||
|
||||
override fun inspectorEnableModernCDPRegistry(): Boolean = false
|
||||
}
|
||||
|
||||
+23
-1
@@ -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<<c93726acf1130457c9350eb08e703b8d>>
|
||||
* @generated SignedSource<<63356ad414e641eae11ca07b1a876fd3>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -32,6 +32,8 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
|
||||
private var enableSpannableBuildingUnificationCache: Boolean? = null
|
||||
private var enableCustomDrawOrderFabricCache: Boolean? = null
|
||||
private var enableFixForClippedSubviewsCrashCache: Boolean? = null
|
||||
private var inspectorEnableCxxInspectorPackagerConnectionCache: Boolean? = null
|
||||
private var inspectorEnableModernCDPRegistryCache: Boolean? = null
|
||||
|
||||
override fun commonTestFlag(): Boolean {
|
||||
var cached = commonTestFlagCache
|
||||
@@ -113,6 +115,26 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun inspectorEnableCxxInspectorPackagerConnection(): Boolean {
|
||||
var cached = inspectorEnableCxxInspectorPackagerConnectionCache
|
||||
if (cached == null) {
|
||||
cached = currentProvider.inspectorEnableCxxInspectorPackagerConnection()
|
||||
accessedFeatureFlags.add("inspectorEnableCxxInspectorPackagerConnection")
|
||||
inspectorEnableCxxInspectorPackagerConnectionCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun inspectorEnableModernCDPRegistry(): Boolean {
|
||||
var cached = inspectorEnableModernCDPRegistryCache
|
||||
if (cached == null) {
|
||||
cached = currentProvider.inspectorEnableModernCDPRegistry()
|
||||
accessedFeatureFlags.add("inspectorEnableModernCDPRegistry")
|
||||
inspectorEnableModernCDPRegistryCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun override(provider: ReactNativeFeatureFlagsProvider) {
|
||||
if (accessedFeatureFlags.isNotEmpty()) {
|
||||
val accessedFeatureFlagsStr = accessedFeatureFlags.joinToString(separator = ", ") { it }
|
||||
|
||||
+5
-1
@@ -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<<f0af7f056044feda3e7618f72f61f7d0>>
|
||||
* @generated SignedSource<<c5388e841a06044520f6c89fcca27286>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -38,4 +38,8 @@ public interface ReactNativeFeatureFlagsProvider {
|
||||
@DoNotStrip public fun enableCustomDrawOrderFabric(): Boolean
|
||||
|
||||
@DoNotStrip public fun enableFixForClippedSubviewsCrash(): Boolean
|
||||
|
||||
@DoNotStrip public fun inspectorEnableCxxInspectorPackagerConnection(): Boolean
|
||||
|
||||
@DoNotStrip public fun inspectorEnableModernCDPRegistry(): Boolean
|
||||
}
|
||||
|
||||
+29
-1
@@ -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<<e388f7ac501dba65bee597ccf8305453>>
|
||||
* @generated SignedSource<<f40d52242f2c758ed616f1e5d8c3a082>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -87,6 +87,18 @@ class ReactNativeFeatureFlagsProviderHolder
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool inspectorEnableCxxInspectorPackagerConnection() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("inspectorEnableCxxInspectorPackagerConnection");
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool inspectorEnableModernCDPRegistry() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("inspectorEnableModernCDPRegistry");
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
private:
|
||||
jni::global_ref<jobject> javaProvider_;
|
||||
};
|
||||
@@ -131,6 +143,16 @@ bool JReactNativeFeatureFlagsCxxInterop::enableFixForClippedSubviewsCrash(
|
||||
return ReactNativeFeatureFlags::enableFixForClippedSubviewsCrash();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::inspectorEnableCxxInspectorPackagerConnection(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::inspectorEnableCxxInspectorPackagerConnection();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::inspectorEnableModernCDPRegistry(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::inspectorEnableModernCDPRegistry();
|
||||
}
|
||||
|
||||
void JReactNativeFeatureFlagsCxxInterop::override(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/,
|
||||
jni::alias_ref<jobject> provider) {
|
||||
@@ -172,6 +194,12 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
|
||||
makeNativeMethod(
|
||||
"enableFixForClippedSubviewsCrash",
|
||||
JReactNativeFeatureFlagsCxxInterop::enableFixForClippedSubviewsCrash),
|
||||
makeNativeMethod(
|
||||
"inspectorEnableCxxInspectorPackagerConnection",
|
||||
JReactNativeFeatureFlagsCxxInterop::inspectorEnableCxxInspectorPackagerConnection),
|
||||
makeNativeMethod(
|
||||
"inspectorEnableModernCDPRegistry",
|
||||
JReactNativeFeatureFlagsCxxInterop::inspectorEnableModernCDPRegistry),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -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<<a06796ea8a786672459bcdbcc25e9b69>>
|
||||
* @generated SignedSource<<a860f8ca5806886a2e7b0b9a508482a1>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -54,6 +54,12 @@ class JReactNativeFeatureFlagsCxxInterop
|
||||
static bool enableFixForClippedSubviewsCrash(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool inspectorEnableCxxInspectorPackagerConnection(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool inspectorEnableModernCDPRegistry(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static void override(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>,
|
||||
jni::alias_ref<jobject> provider);
|
||||
|
||||
@@ -21,4 +21,5 @@ target_include_directories(jsinspector PUBLIC ${REACT_COMMON_DIR})
|
||||
target_link_libraries(jsinspector
|
||||
folly_runtime
|
||||
glog
|
||||
react_featureflags
|
||||
)
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <glog/logging.h>
|
||||
#include <cassert>
|
||||
|
||||
#include "InspectorFlags.h"
|
||||
|
||||
#include <glog/logging.h>
|
||||
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
||||
|
||||
namespace facebook::react::jsinspector_modern {
|
||||
|
||||
InspectorFlags& InspectorFlags::getInstance() {
|
||||
@@ -17,44 +17,42 @@ InspectorFlags& InspectorFlags::getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
void InspectorFlags::initFromConfig(
|
||||
const ReactNativeConfig& reactNativeConfig) {
|
||||
bool enableModernCDPRegistry =
|
||||
reactNativeConfig.getBool("react_native_devx:enable_modern_cdp_registry");
|
||||
if (enableModernCDPRegistry_.has_value()) {
|
||||
assert(
|
||||
*enableModernCDPRegistry_ == enableModernCDPRegistry &&
|
||||
"Flag value was changed after init");
|
||||
}
|
||||
enableModernCDPRegistry_ = enableModernCDPRegistry;
|
||||
bool enableCxxInspectorPackagerConnection = reactNativeConfig.getBool(
|
||||
"react_native_devx:enable_cxx_inspector_packager_connection");
|
||||
if (enableCxxInspectorPackagerConnection_.has_value()) {
|
||||
assert(
|
||||
*enableCxxInspectorPackagerConnection_ ==
|
||||
enableCxxInspectorPackagerConnection &&
|
||||
"Flag value was changed after init");
|
||||
}
|
||||
enableCxxInspectorPackagerConnection_ = enableCxxInspectorPackagerConnection;
|
||||
}
|
||||
InspectorFlags::InspectorFlags()
|
||||
: enableModernCDPRegistry_(
|
||||
ReactNativeFeatureFlags::inspectorEnableModernCDPRegistry()),
|
||||
enableCxxInspectorPackagerConnection_(
|
||||
ReactNativeFeatureFlags::
|
||||
inspectorEnableCxxInspectorPackagerConnection()) {}
|
||||
|
||||
bool InspectorFlags::getEnableModernCDPRegistry() const {
|
||||
if (!enableModernCDPRegistry_.has_value()) {
|
||||
LOG(WARNING)
|
||||
<< "InspectorFlags::getEnableModernCDPRegistry was called before init";
|
||||
}
|
||||
return enableModernCDPRegistry_.value_or(false);
|
||||
assertFlagsMatchUpstream();
|
||||
return enableModernCDPRegistry_;
|
||||
}
|
||||
|
||||
bool InspectorFlags::getEnableCxxInspectorPackagerConnection() const {
|
||||
if (!enableCxxInspectorPackagerConnection_.has_value()) {
|
||||
LOG(WARNING)
|
||||
<< "InspectorFlags::getEnableCxxInspectorPackagerConnection was called before init";
|
||||
}
|
||||
return enableCxxInspectorPackagerConnection_.value_or(false) ||
|
||||
assertFlagsMatchUpstream();
|
||||
return enableCxxInspectorPackagerConnection_ ||
|
||||
// If we are using the modern CDP registry, then we must also use the C++
|
||||
// InspectorPackagerConnection implementation.
|
||||
getEnableModernCDPRegistry();
|
||||
enableModernCDPRegistry_;
|
||||
}
|
||||
|
||||
void InspectorFlags::assertFlagsMatchUpstream() const {
|
||||
if (inconsistentFlagsStateLogged_) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (enableModernCDPRegistry_ !=
|
||||
ReactNativeFeatureFlags::inspectorEnableModernCDPRegistry() ||
|
||||
enableCxxInspectorPackagerConnection_ !=
|
||||
ReactNativeFeatureFlags::
|
||||
inspectorEnableCxxInspectorPackagerConnection()) {
|
||||
LOG(ERROR)
|
||||
<< "[InspectorFlags] Error: One or more ReactNativeFeatureFlags values "
|
||||
<< "have changed during the global app lifetime. This may lead to "
|
||||
<< "inconsistent inspector behaviour. Please quit and restart the app.";
|
||||
inconsistentFlagsStateLogged_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace facebook::react::jsinspector_modern
|
||||
|
||||
@@ -9,25 +9,16 @@
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <react/config/ReactNativeConfig.h>
|
||||
|
||||
namespace facebook::react::jsinspector_modern {
|
||||
|
||||
/**
|
||||
* A container for all inspector related feature flags (Meyers singleton
|
||||
* pattern). Flags must be set before they are accessed and are static for the
|
||||
* lifetime of the app.
|
||||
* pattern). Enforces that flag values are static for the lifetime of the app.
|
||||
*/
|
||||
class InspectorFlags {
|
||||
public:
|
||||
static InspectorFlags& getInstance();
|
||||
|
||||
/**
|
||||
* Initialize flags from a `ReactNativeConfig` instance. Validates that flag
|
||||
* values are not changed across multiple calls.
|
||||
*/
|
||||
void initFromConfig(const ReactNativeConfig& reactNativeConfig);
|
||||
|
||||
/**
|
||||
* Flag determining if the modern CDP backend should be enabled.
|
||||
*/
|
||||
@@ -40,13 +31,16 @@ class InspectorFlags {
|
||||
bool getEnableCxxInspectorPackagerConnection() const;
|
||||
|
||||
private:
|
||||
InspectorFlags() = default;
|
||||
InspectorFlags();
|
||||
InspectorFlags(const InspectorFlags&) = delete;
|
||||
InspectorFlags& operator=(const InspectorFlags&) = delete;
|
||||
~InspectorFlags() = default;
|
||||
|
||||
std::optional<bool> enableModernCDPRegistry_;
|
||||
std::optional<bool> enableCxxInspectorPackagerConnection_;
|
||||
const bool enableModernCDPRegistry_;
|
||||
const bool enableCxxInspectorPackagerConnection_;
|
||||
|
||||
mutable bool inconsistentFlagsStateLogged_;
|
||||
void assertFlagsMatchUpstream() const;
|
||||
};
|
||||
|
||||
} // namespace facebook::react::jsinspector_modern
|
||||
|
||||
@@ -49,6 +49,6 @@ Pod::Spec.new do |s|
|
||||
|
||||
s.dependency "glog"
|
||||
s.dependency "RCT-Folly", folly_version
|
||||
s.dependency "React-nativeconfig"
|
||||
s.dependency "React-featureflags"
|
||||
s.dependency "DoubleConversion"
|
||||
end
|
||||
|
||||
@@ -16,12 +16,6 @@ bool EmptyReactNativeConfig::getBool(const std::string& param) const {
|
||||
if (param == "react_fabric:enabled_automatic_interop_android") {
|
||||
return true;
|
||||
}
|
||||
if (param == "react_native_devx:enable_modern_cdp_registry") {
|
||||
return false;
|
||||
}
|
||||
if (param == "react_native_devx:enable_cxx_inspector_packager_connection") {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<<28d4d1d52be9cb5dccd5a3802df64fc3>>
|
||||
* @generated SignedSource<<82f226df2b3824d03b755a042b20bec5>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -53,6 +53,14 @@ bool ReactNativeFeatureFlags::enableFixForClippedSubviewsCrash() {
|
||||
return getAccessor().enableFixForClippedSubviewsCrash();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlags::inspectorEnableCxxInspectorPackagerConnection() {
|
||||
return getAccessor().inspectorEnableCxxInspectorPackagerConnection();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlags::inspectorEnableModernCDPRegistry() {
|
||||
return getAccessor().inspectorEnableModernCDPRegistry();
|
||||
}
|
||||
|
||||
void ReactNativeFeatureFlags::override(
|
||||
std::unique_ptr<ReactNativeFeatureFlagsProvider> provider) {
|
||||
getAccessor().override(std::move(provider));
|
||||
|
||||
@@ -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<<979ad8a28efe3ca5d775596dc8b298d8>>
|
||||
* @generated SignedSource<<3bfae310dfd28040f4b80d1a1df8b7b3>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -73,6 +73,16 @@ class ReactNativeFeatureFlags {
|
||||
*/
|
||||
static bool enableFixForClippedSubviewsCrash();
|
||||
|
||||
/**
|
||||
* Flag determining if the C++ implementation of InspectorPackagerConnection should be used instead of the per-platform one. This flag is global and should not be changed across React Host lifetimes.
|
||||
*/
|
||||
static bool inspectorEnableCxxInspectorPackagerConnection();
|
||||
|
||||
/**
|
||||
* Flag determining if the modern CDP backend should be enabled. This flag is global and should not be changed across React Host lifetimes.
|
||||
*/
|
||||
static bool inspectorEnableModernCDPRegistry();
|
||||
|
||||
/**
|
||||
* Overrides the feature flags with the ones provided by the given provider
|
||||
* (generally one that extends `ReactNativeFeatureFlagsDefaults`).
|
||||
|
||||
+37
-1
@@ -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<<efdef45f0de4ebc9002f6315f3bfbe64>>
|
||||
* @generated SignedSource<<2154292f89306f25289583537833a065>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -173,6 +173,42 @@ bool ReactNativeFeatureFlagsAccessor::enableFixForClippedSubviewsCrash() {
|
||||
return flagValue.value();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlagsAccessor::inspectorEnableCxxInspectorPackagerConnection() {
|
||||
auto flagValue = inspectorEnableCxxInspectorPackagerConnection_.load();
|
||||
|
||||
if (!flagValue.has_value()) {
|
||||
// This block is not exclusive but it is not necessary.
|
||||
// If multiple threads try to initialize the feature flag, we would only
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(8, "inspectorEnableCxxInspectorPackagerConnection");
|
||||
|
||||
flagValue = currentProvider_->inspectorEnableCxxInspectorPackagerConnection();
|
||||
inspectorEnableCxxInspectorPackagerConnection_ = flagValue;
|
||||
}
|
||||
|
||||
return flagValue.value();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlagsAccessor::inspectorEnableModernCDPRegistry() {
|
||||
auto flagValue = inspectorEnableModernCDPRegistry_.load();
|
||||
|
||||
if (!flagValue.has_value()) {
|
||||
// This block is not exclusive but it is not necessary.
|
||||
// If multiple threads try to initialize the feature flag, we would only
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(9, "inspectorEnableModernCDPRegistry");
|
||||
|
||||
flagValue = currentProvider_->inspectorEnableModernCDPRegistry();
|
||||
inspectorEnableModernCDPRegistry_ = flagValue;
|
||||
}
|
||||
|
||||
return flagValue.value();
|
||||
}
|
||||
|
||||
void ReactNativeFeatureFlagsAccessor::override(
|
||||
std::unique_ptr<ReactNativeFeatureFlagsProvider> provider) {
|
||||
if (wasOverridden_) {
|
||||
|
||||
+6
-2
@@ -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<<bc8468ec0183add47aba700f87448b38>>
|
||||
* @generated SignedSource<<95487968b66d40e1ec53936b06084931>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -39,6 +39,8 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
bool enableSpannableBuildingUnification();
|
||||
bool enableCustomDrawOrderFabric();
|
||||
bool enableFixForClippedSubviewsCrash();
|
||||
bool inspectorEnableCxxInspectorPackagerConnection();
|
||||
bool inspectorEnableModernCDPRegistry();
|
||||
|
||||
void override(std::unique_ptr<ReactNativeFeatureFlagsProvider> provider);
|
||||
|
||||
@@ -49,7 +51,7 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
|
||||
bool wasOverridden_;
|
||||
|
||||
std::array<std::atomic<const char*>, 8> accessedFeatureFlags_;
|
||||
std::array<std::atomic<const char*>, 10> accessedFeatureFlags_;
|
||||
|
||||
std::atomic<std::optional<bool>> commonTestFlag_;
|
||||
std::atomic<std::optional<bool>> enableBackgroundExecutor_;
|
||||
@@ -59,6 +61,8 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
std::atomic<std::optional<bool>> enableSpannableBuildingUnification_;
|
||||
std::atomic<std::optional<bool>> enableCustomDrawOrderFabric_;
|
||||
std::atomic<std::optional<bool>> enableFixForClippedSubviewsCrash_;
|
||||
std::atomic<std::optional<bool>> inspectorEnableCxxInspectorPackagerConnection_;
|
||||
std::atomic<std::optional<bool>> inspectorEnableModernCDPRegistry_;
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
+9
-1
@@ -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<<df0a32177ddcb12307641f723c68d686>>
|
||||
* @generated SignedSource<<4832483bb3648380f2bb9312311f579c>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -58,6 +58,14 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
|
||||
bool enableFixForClippedSubviewsCrash() override {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool inspectorEnableCxxInspectorPackagerConnection() override {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool inspectorEnableModernCDPRegistry() override {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
+3
-1
@@ -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<<ebcc78df95f83e1ab803c2615f1c8cfe>>
|
||||
* @generated SignedSource<<f707d15cf978d7342cdf5aab18444219>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -33,6 +33,8 @@ class ReactNativeFeatureFlagsProvider {
|
||||
virtual bool enableSpannableBuildingUnification() = 0;
|
||||
virtual bool enableCustomDrawOrderFabric() = 0;
|
||||
virtual bool enableFixForClippedSubviewsCrash() = 0;
|
||||
virtual bool inspectorEnableCxxInspectorPackagerConnection() = 0;
|
||||
virtual bool inspectorEnableModernCDPRegistry() = 0;
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
+11
-1
@@ -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<<97f5135efc2e76f0a055a3d55000925c>>
|
||||
* @generated SignedSource<<2466af777a1d69da2c3810e5a2d53a70>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -75,4 +75,14 @@ bool NativeReactNativeFeatureFlags::enableFixForClippedSubviewsCrash(
|
||||
return ReactNativeFeatureFlags::enableFixForClippedSubviewsCrash();
|
||||
}
|
||||
|
||||
bool NativeReactNativeFeatureFlags::inspectorEnableCxxInspectorPackagerConnection(
|
||||
jsi::Runtime& /*runtime*/) {
|
||||
return ReactNativeFeatureFlags::inspectorEnableCxxInspectorPackagerConnection();
|
||||
}
|
||||
|
||||
bool NativeReactNativeFeatureFlags::inspectorEnableModernCDPRegistry(
|
||||
jsi::Runtime& /*runtime*/) {
|
||||
return ReactNativeFeatureFlags::inspectorEnableModernCDPRegistry();
|
||||
}
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
+5
-1
@@ -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<<47a7bf435a971206c55592e877619435>>
|
||||
* @generated SignedSource<<30481dc57cc7f389d1ed87d097caedda>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -45,6 +45,10 @@ class NativeReactNativeFeatureFlags
|
||||
bool enableCustomDrawOrderFabric(jsi::Runtime& runtime);
|
||||
|
||||
bool enableFixForClippedSubviewsCrash(jsi::Runtime& runtime);
|
||||
|
||||
bool inspectorEnableCxxInspectorPackagerConnection(jsi::Runtime& runtime);
|
||||
|
||||
bool inspectorEnableModernCDPRegistry(jsi::Runtime& runtime);
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
@@ -53,6 +53,16 @@ const definitions: FeatureFlagDefinitions = {
|
||||
'Attempt at fixing a crash related to subview clipping on Android. This is a kill switch for the fix',
|
||||
defaultValue: false,
|
||||
},
|
||||
inspectorEnableCxxInspectorPackagerConnection: {
|
||||
description:
|
||||
'Flag determining if the C++ implementation of InspectorPackagerConnection should be used instead of the per-platform one. This flag is global and should not be changed across React Host lifetimes.',
|
||||
defaultValue: false,
|
||||
},
|
||||
inspectorEnableModernCDPRegistry: {
|
||||
description:
|
||||
'Flag determining if the modern CDP backend should be enabled. This flag is global and should not be changed across React Host lifetimes.',
|
||||
defaultValue: false,
|
||||
},
|
||||
},
|
||||
|
||||
jsOnly: {
|
||||
|
||||
+3
-1
@@ -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<<a0f497548a69374d354e92d146ef9766>>
|
||||
* @generated SignedSource<<8509d5ee87efb5aa8da7efcd2085d0a2>>
|
||||
* @flow strict-local
|
||||
*/
|
||||
|
||||
@@ -31,6 +31,8 @@ export interface Spec extends TurboModule {
|
||||
+enableSpannableBuildingUnification?: () => boolean;
|
||||
+enableCustomDrawOrderFabric?: () => boolean;
|
||||
+enableFixForClippedSubviewsCrash?: () => boolean;
|
||||
+inspectorEnableCxxInspectorPackagerConnection?: () => boolean;
|
||||
+inspectorEnableModernCDPRegistry?: () => boolean;
|
||||
}
|
||||
|
||||
const NativeReactNativeFeatureFlags: ?Spec = TurboModuleRegistry.get<Spec>(
|
||||
|
||||
@@ -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<<3a6103a7180e8db957a6c37b91d4b150>>
|
||||
* @generated SignedSource<<7c83d5613c3be517efe48378e6356e79>>
|
||||
* @flow strict-local
|
||||
*/
|
||||
|
||||
@@ -48,6 +48,8 @@ export type ReactNativeFeatureFlags = {
|
||||
enableSpannableBuildingUnification: Getter<boolean>,
|
||||
enableCustomDrawOrderFabric: Getter<boolean>,
|
||||
enableFixForClippedSubviewsCrash: Getter<boolean>,
|
||||
inspectorEnableCxxInspectorPackagerConnection: Getter<boolean>,
|
||||
inspectorEnableModernCDPRegistry: Getter<boolean>,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,6 +124,14 @@ export const enableCustomDrawOrderFabric: Getter<boolean> = createNativeFlagGett
|
||||
* Attempt at fixing a crash related to subview clipping on Android. This is a kill switch for the fix
|
||||
*/
|
||||
export const enableFixForClippedSubviewsCrash: Getter<boolean> = createNativeFlagGetter('enableFixForClippedSubviewsCrash', false);
|
||||
/**
|
||||
* Flag determining if the C++ implementation of InspectorPackagerConnection should be used instead of the per-platform one. This flag is global and should not be changed across React Host lifetimes.
|
||||
*/
|
||||
export const inspectorEnableCxxInspectorPackagerConnection: Getter<boolean> = createNativeFlagGetter('inspectorEnableCxxInspectorPackagerConnection', false);
|
||||
/**
|
||||
* Flag determining if the modern CDP backend should be enabled. This flag is global and should not be changed across React Host lifetimes.
|
||||
*/
|
||||
export const inspectorEnableModernCDPRegistry: Getter<boolean> = createNativeFlagGetter('inspectorEnableModernCDPRegistry', false);
|
||||
|
||||
/**
|
||||
* Overrides the feature flags with the provided methods.
|
||||
|
||||
@@ -989,7 +989,7 @@ PODS:
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- RCT-Folly (= 2024.01.01.00)
|
||||
- React-nativeconfig
|
||||
- React-featureflags
|
||||
- React-jsitracing (1000.0.0):
|
||||
- React-jsi
|
||||
- React-logger (1000.0.0):
|
||||
@@ -1030,7 +1030,6 @@ PODS:
|
||||
- React-Fabric
|
||||
- React-graphics
|
||||
- React-hermes
|
||||
- React-jsinspector
|
||||
- React-nativeconfig
|
||||
- React-NativeModulesApple
|
||||
- React-RCTFabric
|
||||
|
||||
Reference in New Issue
Block a user