mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Create new inspector flag for enabling the C++ packager connection implementation (#42035)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/42035 In upcoming diffs we will begin integrating the new C++ `InspectorPackagerConnection` (D52134592) into React Native on Android and iOS. This diff adds a shared C++ flag that is the source of truth for whether the new implementation should be enabled. Changelog: [Internal] Reviewed By: huntie Differential Revision: D52335446 fbshipit-source-id: 7f16ffc1728c8de7d4fbf090268ffed6fbaa879f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1f89a1c96b
commit
210a7c2223
@@ -27,6 +27,15 @@ void InspectorFlags::initFromConfig(
|
||||
"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;
|
||||
}
|
||||
|
||||
bool InspectorFlags::getEnableModernCDPRegistry() const {
|
||||
@@ -37,4 +46,12 @@ bool InspectorFlags::getEnableModernCDPRegistry() const {
|
||||
return enableModernCDPRegistry_.value_or(false);
|
||||
}
|
||||
|
||||
bool InspectorFlags::getEnableCxxInspectorPackagerConnection() const {
|
||||
if (!enableCxxInspectorPackagerConnection_.has_value()) {
|
||||
LOG(WARNING)
|
||||
<< "InspectorFlags::getEnableCxxInspectorPackagerConnection was called before init";
|
||||
}
|
||||
return enableCxxInspectorPackagerConnection_.value_or(false);
|
||||
}
|
||||
|
||||
} // namespace facebook::react::jsinspector_modern
|
||||
|
||||
@@ -33,6 +33,12 @@ class InspectorFlags {
|
||||
*/
|
||||
bool getEnableModernCDPRegistry() const;
|
||||
|
||||
/**
|
||||
* Flag determining if the C++ implementation of InspectorPackagerConnection
|
||||
* should be used instead of the per-platform one.
|
||||
*/
|
||||
bool getEnableCxxInspectorPackagerConnection() const;
|
||||
|
||||
private:
|
||||
InspectorFlags() = default;
|
||||
InspectorFlags(const InspectorFlags&) = delete;
|
||||
@@ -40,6 +46,7 @@ class InspectorFlags {
|
||||
~InspectorFlags() = default;
|
||||
|
||||
std::optional<bool> enableModernCDPRegistry_;
|
||||
std::optional<bool> enableCxxInspectorPackagerConnection_;
|
||||
};
|
||||
|
||||
} // namespace facebook::react::jsinspector_modern
|
||||
|
||||
@@ -16,6 +16,9 @@ bool EmptyReactNativeConfig::getBool(const std::string& param) const {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user