From 255d6481011c221cdfaf8beb4d4ee7a353c4222f Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Wed, 28 Dec 2022 01:29:36 -0800 Subject: [PATCH] Remove yoga/internal/experiments (#1195) Summary: X-link: https://github.com/facebook/yoga/pull/1195 These files are remnants of experimentation functions from D16687367 (https://github.com/facebook/react-native/commit/c9b757f5135d31c48237a6148393568a26ab65fc). They do not seem to be included anywhere anymore, and we already have a YGExperimentalFeature setter in config we can use in the more common case. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D42241980 fbshipit-source-id: 482984b9a619dba8042e9166aee02a5e75e761ee --- .../yoga/yoga/internal/experiments-inl.h | 32 ---------------- .../yoga/yoga/internal/experiments.cpp | 38 ------------------- ReactCommon/yoga/yoga/internal/experiments.h | 26 ------------- 3 files changed, 96 deletions(-) delete mode 100644 ReactCommon/yoga/yoga/internal/experiments-inl.h delete mode 100644 ReactCommon/yoga/yoga/internal/experiments.cpp delete mode 100644 ReactCommon/yoga/yoga/internal/experiments.h diff --git a/ReactCommon/yoga/yoga/internal/experiments-inl.h b/ReactCommon/yoga/yoga/internal/experiments-inl.h deleted file mode 100644 index 44235590161..00000000000 --- a/ReactCommon/yoga/yoga/internal/experiments-inl.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include "experiments.h" - -#include - -namespace facebook { -namespace yoga { -namespace internal { - -namespace detail { -extern std::bitset enabledExperiments; -} // namespace detail - -inline bool isEnabled(Experiment experiment) { - return detail::enabledExperiments.test(static_cast(experiment)); -} - -inline void disableAllExperiments() { - detail::enabledExperiments = 0; -} - -} // namespace internal -} // namespace yoga -} // namespace facebook diff --git a/ReactCommon/yoga/yoga/internal/experiments.cpp b/ReactCommon/yoga/yoga/internal/experiments.cpp deleted file mode 100644 index 016ea208709..00000000000 --- a/ReactCommon/yoga/yoga/internal/experiments.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -#include "experiments.h" -#include "experiments-inl.h" - -namespace facebook { -namespace yoga { -namespace internal { - -namespace detail { - -std::bitset enabledExperiments = 0; - -} // namespace detail - -void enable(Experiment experiment) { - detail::enabledExperiments.set(static_cast(experiment)); -} - -void disable(Experiment experiment) { - detail::enabledExperiments.reset(static_cast(experiment)); -} - -bool toggle(Experiment experiment) { - auto bit = static_cast(experiment); - auto previousState = detail::enabledExperiments.test(bit); - detail::enabledExperiments.flip(bit); - return previousState; -} - -} // namespace internal -} // namespace yoga -} // namespace facebook diff --git a/ReactCommon/yoga/yoga/internal/experiments.h b/ReactCommon/yoga/yoga/internal/experiments.h deleted file mode 100644 index 2298e247224..00000000000 --- a/ReactCommon/yoga/yoga/internal/experiments.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include - -namespace facebook { -namespace yoga { -namespace internal { - -enum struct Experiment : size_t { - kDoubleMeasureCallbacks, -}; - -void enable(Experiment); -void disable(Experiment); -bool toggle(Experiment); - -} // namespace internal -} // namespace yoga -} // namespace facebook