Skip to content

Commit ff3ea5e

Browse files
j-piaseckimeta-codesync[bot]
authored andcommitted
Forward declare LeakChecker in UIManager.h (#58091)
Summary: Pull Request resolved: #58091 Under the C++ Stable API RFC, `react/renderer/uimanager:uimanager` is a public target while `react/renderer/leakchecker:leakchecker` is private. `UIManager.h` is an exported header of the uimanager target and is re-exported from the module umbrella `React/UIManager.h`, so it transitively exposed the private module through the blessed public entry point. The private guard is suppressed only by `RN_BUILDING`, not by `RN_UMBRELLA_CONTEXT`, so a consumer including `<React/UIManager.h>` under `RN_STRICT_API` would get a hard error from a header they never named and cannot acknowledge. `UIManager.h` only needs the type for the `std::unique_ptr<LeakChecker> leakChecker_` data member. `~UIManager()` is already out of line, so a forward declaration is sufficient and the include moves to `UIManager.cpp`, which already constructs the object. No build config change is needed: `leakchecker` is already a non-exported dep of the uimanager target in both BUCK and CMake. `UIManager.h` is the only public or for-frameworks header in ReactCommon that still reached `leakchecker`, so the module is now cleanly private. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D117188750 fbshipit-source-id: c607a8c3a9d8208bbffa66ecf13dcf44102cbce4
1 parent 1b83899 commit ff3ea5e

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <react/renderer/core/DynamicPropsUtilities.h>
1515
#include <react/renderer/core/PropsParserContext.h>
1616
#include <react/renderer/core/ShadowNodeFragment.h>
17+
#include <react/renderer/leakchecker/LeakChecker.h>
1718
#include <react/renderer/uimanager/AppRegistryBinding.h>
1819
#include <react/renderer/uimanager/UIManagerBinding.h>
1920
#include <react/renderer/uimanager/UIManagerCommitHook.h>

packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <react/renderer/core/RawValue.h>
2222
#include <react/renderer/core/ShadowNode.h>
2323
#include <react/renderer/core/StateData.h>
24-
#include <react/renderer/leakchecker/LeakChecker.h>
2524
#include <react/renderer/mounting/ShadowTree.h>
2625
#include <react/renderer/mounting/ShadowTreeDelegate.h>
2726
#include <react/renderer/mounting/ShadowTreeRegistry.h>
@@ -37,6 +36,7 @@
3736

3837
namespace facebook::react {
3938

39+
class LeakChecker;
4040
class UIManagerBinding;
4141
class UIManagerCommitHook;
4242
class UIManagerMountHook;

0 commit comments

Comments
 (0)