Forward declare NativeModulePerfLogger in TurboModulePerfLogger.h (#58381)

Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58381

Under the C++ Stable API RFC, `react/nativemodule/core:core` is public while `reactperflogger:reactperflogger` is classified as "private". `TurboModulePerfLogger.h` is an exported header of the public target and includes `reactperflogger/NativeModulePerfLogger.h`, so it transitively exposes a private header to consumers.

`NativeModulePerfLogger` is only named as a `std::unique_ptr<NativeModulePerfLogger>&&` parameter in a declaration, so a forward declaration is sufficient and the include moves to the implementation file. `<cstdint>` is now included explicitly, since it was previously pulled in transitively.

This also makes the header consistent with the build config: `reactperflogger` is already a non-exported dep of `react/nativemodule/core:core`, so no BUCK change is needed.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D116901579

fbshipit-source-id: 320214f3f1aa9116b79e3ed1bdbf6290ab2e4f77
This commit is contained in:
Jakub Piasecki authored and meta-codesync[bot] committed 2026-09-11 00:35:39 -07:00
1 parent 3eb901e31a
commit 1a48d82d33
2 files changed
+7 -1

No files matched your search

@@ -7,6 +7,8 @@
#include "TurboModulePerfLogger.h"
#include <reactperflogger/NativeModulePerfLogger.h>
namespace facebook::react::TurboModulePerfLogger {
std::unique_ptr<NativeModulePerfLogger> g_perfLogger = nullptr;
@@ -7,9 +7,13 @@
#pragma once
#include <reactperflogger/NativeModulePerfLogger.h>
#include <cstdint>
#include <memory>
namespace facebook::react {
class NativeModulePerfLogger;
} // namespace facebook::react
namespace facebook::react::TurboModulePerfLogger {
void enableLogging(std::unique_ptr<NativeModulePerfLogger> &&logger);
void disableLogging();