Files
react-native/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h
T
Alex Hunt b5117520fc Enforce sorting of feature flag definitions (#43329)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43329

Improve maintainability of this file, in particular reducing the probability of a merge conflict for new entries.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D54539469

fbshipit-source-id: dc2fca42b4490d87c532b21043b0855d8d1a894d
2024-03-05 17:27:23 -08:00

69 lines
2.2 KiB
C++

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<2fa6a12c1d9b10483d8e2e23125d231e>>
*/
/**
* IMPORTANT: Do NOT modify this file directly.
*
* To change the definition of the flags, edit
* packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js.
*
* To regenerate this code, run the following script from the repo root:
* yarn featureflags-update
*/
#pragma once
#include <react/featureflags/ReactNativeFeatureFlagsProvider.h>
#include <array>
#include <atomic>
#include <memory>
#include <optional>
namespace facebook::react {
class ReactNativeFeatureFlagsAccessor {
public:
ReactNativeFeatureFlagsAccessor();
bool commonTestFlag();
bool batchRenderingUpdatesInEventLoop();
bool enableBackgroundExecutor();
bool enableCustomDrawOrderFabric();
bool enableFixForClippedSubviewsCrash();
bool enableMicrotasks();
bool enableSpannableBuildingUnification();
bool inspectorEnableCxxInspectorPackagerConnection();
bool inspectorEnableModernCDPRegistry();
bool useModernRuntimeScheduler();
void override(std::unique_ptr<ReactNativeFeatureFlagsProvider> provider);
private:
void markFlagAsAccessed(int position, const char* flagName);
void ensureFlagsNotAccessed();
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
bool wasOverridden_;
std::array<std::atomic<const char*>, 10> accessedFeatureFlags_;
std::atomic<std::optional<bool>> commonTestFlag_;
std::atomic<std::optional<bool>> batchRenderingUpdatesInEventLoop_;
std::atomic<std::optional<bool>> enableBackgroundExecutor_;
std::atomic<std::optional<bool>> enableCustomDrawOrderFabric_;
std::atomic<std::optional<bool>> enableFixForClippedSubviewsCrash_;
std::atomic<std::optional<bool>> enableMicrotasks_;
std::atomic<std::optional<bool>> enableSpannableBuildingUnification_;
std::atomic<std::optional<bool>> inspectorEnableCxxInspectorPackagerConnection_;
std::atomic<std::optional<bool>> inspectorEnableModernCDPRegistry_;
std::atomic<std::optional<bool>> useModernRuntimeScheduler_;
};
} // namespace facebook::react