Skip to content

Remove remaining private includes from scheduler headers - #58137

Open
j-piasecki wants to merge 3 commits into
react:mainfrom
j-piasecki:export-D116909093
Open

Remove remaining private includes from scheduler headers#58137
j-piasecki wants to merge 3 commits into
react:mainfrom
j-piasecki:export-D116909093

Conversation

@j-piasecki

Copy link
Copy Markdown
Contributor

Summary:
Under the C++ Stable API RFC, react/renderer/scheduler:scheduler is a "for frameworks" module, but its exported headers still reached two private modules:

  • Scheduler.h included react/performance/timeline/PerformanceEntryReporter.h and react/renderer/observers/events/EventPerformanceLogger.h. Both are only used as std::shared_ptr data members, so forward declarations are sufficient and the includes move to Scheduler.cpp.
  • SchedulerToolbox.h included react/renderer/leakchecker/LeakChecker.h but never named anything from it. leakchecker is not even a dependency of the scheduler target, so the include is dead and is simply removed.

react/renderer/observers/events:events had no other header-level consumer in ReactCommon, so it is now cleanly private. react/performance/timeline:timeline is still reached from RuntimeScheduler.h and NativePerformance.h, which are handled separately.

After this, no scheduler header includes a private module directly.

Changelog: [Internal]

Differential Revision: D116909093

Summary:
Classifies `react/renderer/scheduler:scheduler` as a "for frameworks" target under the three-tier C++ stable API visibility model. Consumers that opt into `RN_STRICT_API` now get a warning if they include its headers directly, which they can acknowledge with `RN_ALLOW_FRAMEWORKS`; without that flag the guards are inert, so no existing build changes behaviour.

Changelog: [Internal]

Differential Revision: D116909091
Summary:
Under the C++ Stable API RFC, `react/renderer/scheduler:scheduler` is a "for frameworks" module while `react/performance/cdpmetrics:cdpmetrics` and `react/renderer/viewtransition:viewtransition` are private. `Scheduler.h` is an exported header of the scheduler target and included all three private headers, so it transitively exposed them to consumers. `ViewTransitionModule.h` already carries the private-tier guard, so this was an active violation and not just a latent one.

`Scheduler.h` only needs these types for data members. `viewTransitionModule_` was already a `std::shared_ptr`, so a forward declaration is sufficient. The two CDP reporters were held as `std::optional`, which requires a complete type, so they become `std::unique_ptr`. They are constructed conditionally behind feature flags and only ever handed to `PerformanceEntryReporter` as raw pointers, so ownership and lifetime are unchanged. `~Scheduler()` is already out of line, so the incomplete types are fine.

`<optional>` and `<shared_mutex>` are now included explicitly, since they were previously pulled in transitively through the cdpmetrics headers.

`Scheduler.h` is the only header in ReactCommon that reached either module, so both are now cleanly private. No build config change is needed: `cdpmetrics` and `viewtransition` are already non-exported deps of the scheduler target.

Changelog: [Internal]

Differential Revision: D116909092
Summary:
Under the C++ Stable API RFC, `react/renderer/scheduler:scheduler` is a "for frameworks" module, but its exported headers still reached two private modules:

- `Scheduler.h` included `react/performance/timeline/PerformanceEntryReporter.h` and `react/renderer/observers/events/EventPerformanceLogger.h`. Both are only used as `std::shared_ptr` data members, so forward declarations are sufficient and the includes move to `Scheduler.cpp`.
- `SchedulerToolbox.h` included `react/renderer/leakchecker/LeakChecker.h` but never named anything from it. `leakchecker` is not even a dependency of the scheduler target, so the include is dead and is simply removed.

`react/renderer/observers/events:events` had no other header-level consumer in ReactCommon, so it is now cleanly private. `react/performance/timeline:timeline` is still reached from `RuntimeScheduler.h` and `NativePerformance.h`, which are handled separately.

After this, no scheduler header includes a private module directly.

Changelog: [Internal]

Differential Revision: D116909093
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 25, 2026
@facebook-github-tools facebook-github-tools Bot added p: Software Mansion Partner: Software Mansion Partner p: Facebook Partner: Facebook labels Aug 25, 2026
@meta-codesync

meta-codesync Bot commented Aug 25, 2026

Copy link
Copy Markdown

@j-piasecki has exported this pull request. If you are a Meta employee, you can view the originating Diff in D116909093.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook p: Software Mansion Partner: Software Mansion Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant