Skip to content

Commit be04b3c

Browse files
cipolleschifacebook-github-bot
authored andcommitted
Disable expensive checks in OSS
Summary: Internally, we have some computationally expensive checks in Debug mode when running Fabric. However, these are not very useful in OSS and they were the cause of some issues which generated noise. With this change, we are enabling those checks only in the Meta specific builds and making sure that the OSS won't incur in that cost. ## Changelog [Internal] - Disable expensive Fabric checks when running Fabric in OSS Reviewed By: cortinico, sammy-SC Differential Revision: D52543696
1 parent da05345 commit be04b3c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ void YogaLayoutableShadowNode::ensureConsistency() const {
979979
}
980980

981981
void YogaLayoutableShadowNode::ensureYogaChildrenLookFine() const {
982-
#ifdef REACT_NATIVE_DEBUG
982+
#if defined(REACT_NATIVE_DEBUG) && defined(WITH_FBSYSTRACE)
983983
// Checking that the shapes of Yoga node children object look fine.
984984
// This is the only heuristic that might produce false-positive results
985985
// (really broken dangled nodes might look fine). This is useful as an early
@@ -997,7 +997,7 @@ void YogaLayoutableShadowNode::ensureYogaChildrenLookFine() const {
997997
}
998998

999999
void YogaLayoutableShadowNode::ensureYogaChildrenAlignment() const {
1000-
#ifdef REACT_NATIVE_DEBUG
1000+
#if defined(REACT_NATIVE_DEBUG) && defined(WITH_FBSYSTRACE)
10011001
// If the node is not a leaf node, checking that:
10021002
// - All children are `YogaLayoutableShadowNode` subclasses.
10031003
// - All Yoga children are owned/connected to corresponding children of

packages/react-native/ReactCommon/react/renderer/debug/flags.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,15 @@
2626
// Enables some Shadow Tree introspection features (maintains a StubViewTree,
2727
// and logs prev/next tree and mutations if there are any discrepancies). If you
2828
// define this, also define `RN_DEBUG_STRING_CONVERTIBLE`.
29-
#ifdef REACT_NATIVE_DEBUG
29+
#if (defined(REACT_NATIVE_DEBUG) && defined(WITH_FBSYSTRACE))
3030
#define RN_SHADOW_TREE_INTROSPECTION 1
3131
#endif
3232

3333
// This enables certain object-to-string debug conversions to be compiled.
3434
// Enable if `RN_SHADOW_TREE_INTROSPECTION` is enabled.
3535
#ifdef RN_SHADOW_TREE_INTROSPECTION
3636
#define RN_DEBUG_STRING_CONVERTIBLE 1
37-
#endif
38-
39-
#ifndef RN_DEBUG_STRING_CONVERTIBLE
37+
#else
4038
#define RN_DEBUG_STRING_CONVERTIBLE 0
4139
#endif
4240

packages/react-native/ReactCommon/react/renderer/debug/tests/DebugStringConvertibleTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
#if RN_DEBUG_STRING_CONVERTIBLE
89
#include <memory>
910

1011
#include <gtest/gtest.h>
@@ -82,3 +83,4 @@ TEST(DebugStringConvertibleTest, handleNodeWithComplexProps) {
8283
item->getDebugDescription().c_str(),
8384
"<View=hello x=1(height=100 width=200)/>");
8485
}
86+
#endif

0 commit comments

Comments
 (0)