**breaking:** remove YGNodeGetInstanceCount
Summary: @public `YGNodeGetInstanceCount` was only ever meant for tests, and caused data races in multi-threaded environments. It was completely replaced with event-based counting for tests. Here we remove public API around the counter, and the counter itself. Reviewed By: SidharthGuglani Differential Revision: D15174857 fbshipit-source-id: 228e85da565bac9e8485121e956a2e41910b11c8
This commit is contained in:
committed by
Facebook Github Bot
parent
9e20dfeea1
commit
e96a09e5ff
@@ -206,14 +206,12 @@ void YGNodeMarkDirtyAndPropogateToDescendants(const YGNodeRef node) {
|
||||
return node->markDirtyAndPropogateDownwards();
|
||||
}
|
||||
|
||||
int32_t gNodeInstanceCount = 0;
|
||||
int32_t gConfigInstanceCount = 0;
|
||||
|
||||
WIN_EXPORT YGNodeRef YGNodeNewWithConfig(const YGConfigRef config) {
|
||||
const YGNodeRef node = new YGNode();
|
||||
YGAssertWithConfig(
|
||||
config, node != nullptr, "Could not allocate memory for node");
|
||||
gNodeInstanceCount++;
|
||||
#ifdef YG_ENABLE_EVENTS
|
||||
Event::publish<Event::NodeAllocation>(node, {config});
|
||||
#endif
|
||||
@@ -241,7 +239,6 @@ YGNodeRef YGNodeClone(YGNodeRef oldNode) {
|
||||
oldNode->getConfig(),
|
||||
node != nullptr,
|
||||
"Could not allocate memory for node");
|
||||
gNodeInstanceCount++;
|
||||
#ifdef YG_ENABLE_EVENTS
|
||||
Event::publish<Event::NodeAllocation>(node, {node->getConfig()});
|
||||
#endif
|
||||
@@ -295,7 +292,6 @@ void YGNodeFree(const YGNodeRef node) {
|
||||
Event::publish<Event::NodeDeallocation>(node, {node->getConfig()});
|
||||
#endif
|
||||
delete node;
|
||||
gNodeInstanceCount--;
|
||||
}
|
||||
|
||||
static void YGConfigFreeRecursive(const YGNodeRef root) {
|
||||
@@ -337,10 +333,6 @@ void YGNodeReset(YGNodeRef node) {
|
||||
node->reset();
|
||||
}
|
||||
|
||||
int32_t YGNodeGetInstanceCount(void) {
|
||||
return gNodeInstanceCount;
|
||||
}
|
||||
|
||||
int32_t YGConfigGetInstanceCount(void) {
|
||||
return gConfigInstanceCount;
|
||||
}
|
||||
|
Reference in New Issue
Block a user