From 036dd3cfec2f6cce4703f5acca70203eebf2d971 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Sun, 10 Sep 2023 03:29:12 -0700 Subject: [PATCH] Breaking: Remove YGConfigGetInstanceCount Summary: This was added in https://github.com/facebook/yoga/pull/497 specifically for tests related to memory leaks in the C# bindings to count how often YGConfigFree. This is the wrong layer for this check, we don't have officially supported C# bindings anymore, and this API is not safe when Yoga runs on multiple threads. This removes it. Differential Revision: D49131207 fbshipit-source-id: da60f5bafe667cbec8e5a2e495238b6732a702ef --- packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp | 8 -------- packages/react-native/ReactCommon/yoga/yoga/Yoga.h | 1 - 2 files changed, 9 deletions(-) diff --git a/packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp b/packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp index 9a91e032bcb83c..b9a5961d44db1f 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp +++ b/packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp @@ -172,8 +172,6 @@ YOGA_EXPORT void YGNodeMarkDirtyAndPropagateToDescendants( return resolveRef(node)->markDirtyAndPropagateDownwards(); } -int32_t gConfigInstanceCount = 0; - YOGA_EXPORT WIN_EXPORT YGNodeRef YGNodeNewWithConfig(const YGConfigRef config) { auto* node = new yoga::Node{resolveRef(config)}; yoga::assertFatal( @@ -261,23 +259,17 @@ YOGA_EXPORT void YGNodeReset(YGNodeRef node) { resolveRef(node)->reset(); } -YOGA_EXPORT int32_t YGConfigGetInstanceCount(void) { - return gConfigInstanceCount; -} - YOGA_EXPORT YGConfigRef YGConfigNew(void) { #ifdef ANDROID const YGConfigRef config = new yoga::Config(YGAndroidLog); #else const YGConfigRef config = new yoga::Config(YGDefaultLog); #endif - gConfigInstanceCount++; return config; } YOGA_EXPORT void YGConfigFree(const YGConfigRef config) { delete resolveRef(config); - gConfigInstanceCount--; } YOGA_EXPORT void YGNodeSetIsReferenceBaseline( diff --git a/packages/react-native/ReactCommon/yoga/yoga/Yoga.h b/packages/react-native/ReactCommon/yoga/yoga/Yoga.h index 41464e1ee5b461..c9efb85fd8a9c8 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/Yoga.h +++ b/packages/react-native/ReactCommon/yoga/yoga/Yoga.h @@ -330,7 +330,6 @@ void YGConfigSetUseLegacyStretchBehaviour( // YGConfig WIN_EXPORT YGConfigRef YGConfigNew(void); WIN_EXPORT void YGConfigFree(YGConfigRef config); -WIN_EXPORT int32_t YGConfigGetInstanceCount(void); WIN_EXPORT void YGConfigSetExperimentalFeatureEnabled( YGConfigRef config,