Skip to content

Commit

Permalink
Breaking: Remove YGConfigGetInstanceCount
Browse files Browse the repository at this point in the history
Summary:
This was added in facebook/yoga#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
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Sep 10, 2023
1 parent ba8d7df commit 036dd3c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 9 deletions.
8 changes: 0 additions & 8 deletions packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion packages/react-native/ReactCommon/yoga/yoga/Yoga.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 036dd3c

Please sign in to comment.