Skip to content

Commit 0defa02

Browse files
j-piaseckifacebook-github-bot
authored andcommitted
Forward-declare private-target types in RuntimeScheduler.h (#58271)
Summary: `RuntimeScheduler.h` included `PerformanceEntryReporter.h` and `ShadowTreeRevisionConsistencyManager.h` solely to name two pointer parameters. Both belong to targets classified private under the three-tier C++ stable API visibility model, and `RuntimeScheduler.h` is reachable from for-frameworks headers, so a consumer opting into `RN_STRICT_API` got a hard error out of `PrivateGuard.h` from a header they never named — one that neither `RN_ALLOW_FRAMEWORKS` nor an umbrella include can suppress. Replace both with forward declarations, and drop the now-redundant `ShadowTreeRevisionConsistencyManager.h` include from the two scheduler forks, which take the declarations from `RuntimeScheduler.h`. Two translation units were relying on the transitive include and now include the header directly: `RuntimeScheduler_Modern.cpp` (calls `reportLongTask`) and `ReactInstance.cpp` (calls `PerformanceEntryReporter::getInstance`). No build wiring changes — both targets already depend on `react/performance/timeline` and `react/renderer/consistency` for their own sources. Changelog: [General][Changed] - `RuntimeScheduler.h` no longer transitively includes `PerformanceEntryReporter.h` or `ShadowTreeRevisionConsistencyManager.h`; include them directly where the complete types are needed Differential Revision: D117838094
1 parent 9418970 commit 0defa02

5 files changed

Lines changed: 10 additions & 4 deletions

File tree

packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,23 @@
1111

1212
#include <ReactCommon/RuntimeExecutor.h>
1313
#include <jsi/hermes-interfaces.h>
14-
#include <react/performance/timeline/PerformanceEntryReporter.h>
15-
#include <react/renderer/consistency/ShadowTreeRevisionConsistencyManager.h>
1614
#include <react/renderer/runtimescheduler/SchedulerPriorityUtils.h>
1715
#include <react/renderer/runtimescheduler/Task.h>
1816
#include <react/timing/primitives.h>
17+
#include <cstdint>
1918
#include "RuntimeSchedulerEventTimingDelegate.h"
2019
#include "RuntimeSchedulerIntersectionObserverDelegate.h"
2120
#include "RuntimeSchedulerResizeObserverDelegate.h"
2221

2322
namespace facebook::react {
2423

24+
// Both live in private targets (react/performance/timeline,
25+
// react/renderer/consistency). This header is reachable from for-frameworks
26+
// headers, so they must stay forward-declared here — including them would
27+
// make every consumer of a for-frameworks header pull in a private one.
28+
class PerformanceEntryReporter;
29+
class ShadowTreeRevisionConsistencyManager;
30+
2531
using RuntimeSchedulerRenderingUpdate = std::function<void()>;
2632
using SurfaceId = int32_t;
2733

packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Legacy.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#ifndef RCT_REMOVE_LEGACY_ARCH
1313

1414
#include <ReactCommon/RuntimeExecutor.h>
15-
#include <react/renderer/consistency/ShadowTreeRevisionConsistencyManager.h>
1615
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
1716
#include <react/renderer/runtimescheduler/Task.h>
1817
#include <atomic>

packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Modern.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <ReactCommon/RuntimeExecutorSyncUIThreadUtils.h>
1111
#include <cxxreact/TraceSection.h>
1212
#include <jsinspector-modern/tracing/EventLoopReporter.h>
13+
#include <react/performance/timeline/PerformanceEntryReporter.h>
1314
#include <react/renderer/consistency/ScopedShadowTreeRevisionLock.h>
1415
#include <react/timing/primitives.h>
1516
#include <react/utils/OnScopeExit.h>

packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Modern.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <react/cxxstableapi/FrameworksGuard.h>
1111

1212
#include <ReactCommon/RuntimeExecutor.h>
13-
#include <react/renderer/consistency/ShadowTreeRevisionConsistencyManager.h>
1413
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
1514
#include <react/renderer/runtimescheduler/Task.h>
1615
#include <atomic>

packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <jsi/instrumentation.h>
1919
#include <jsinspector-modern/HostTarget.h>
2020
#include <react/featureflags/ReactNativeFeatureFlags.h>
21+
#include <react/performance/timeline/PerformanceEntryReporter.h>
2122
#include <react/renderer/runtimescheduler/RuntimeSchedulerBinding.h>
2223
#include <react/runtime/JSRuntimeBindings.h>
2324
#include <react/timing/primitives.h>

0 commit comments

Comments
 (0)