/* * 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 #include "LayoutContext.h" namespace facebook::yoga::vanillajni { namespace { std::stack& getContexts() { static thread_local std::stack contexts; return contexts; } } // namespace LayoutContext::Provider::Provider(PtrJNodeMapVanilla* data) { getContexts().push(data); } LayoutContext::Provider::~Provider() { getContexts().pop(); } /*static*/ PtrJNodeMapVanilla* LayoutContext::getNodeMap() { return getContexts().empty() ? nullptr : getContexts().top(); } } // namespace facebook::yoga::vanillajni