Add internal experiments API

Summary: Adds internal API that we can use to conduct experiments.

Reviewed By: SidharthGuglani

Differential Revision: D16340463

fbshipit-source-id: 07a8bb7dbc4a02c5c95f1ad29b18845ab43752cf
This commit is contained in:
David Aurelio
2019-07-19 10:33:47 -07:00
committed by Facebook Github Bot
parent c99fc9c4da
commit a53c14dc75
4 changed files with 141 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) Facebook, Inc. and its 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 <bitset>
namespace facebook {
namespace yoga {
namespace internal {
namespace detail {
extern std::bitset<sizeof(int)> enabledExperiments;
} // namespace detail
inline bool isEnabled(Experiment experiment) {
return detail::enabledExperiments.test(static_cast<size_t>(experiment));
}
inline void disableAllExperiments() {
detail::enabledExperiments = 0;
}
} // namespace internal
} // namespace yoga
} // namespace facebook