Skip to content

Move TracingState interfaces to inspector package#54632

Closed
hoxyq wants to merge 6 commits intofacebook:mainfrom
hoxyq:export-D87638583
Closed

Move TracingState interfaces to inspector package#54632
hoxyq wants to merge 6 commits intofacebook:mainfrom
hoxyq:export-D87638583

Conversation

@hoxyq
Copy link
Contributor

@hoxyq hoxyq commented Nov 21, 2025

Summary:

Changelog: [Internal]

Tracing is a concept of Inspector. It should be part of the Inspector package, not general interfaces.

The Inspector stack is the only mechanism that controls the tracing state of a Host.

Differential Revision: D87638583

@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 Nov 21, 2025
@meta-codesync
Copy link

meta-codesync bot commented Nov 21, 2025

@hoxyq has exported this pull request. If you are a Meta employee, you can view the originating Diff in D87638583.

Copy link
Contributor

@cortinico cortinico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

Summary:
# Changelog: [Internal]

There is no implementation for this method and it is unused. This is actually part of `HostAgent`.

Differential Revision: D87220192
Summary:
# Changelog: [Internal]

Introduces a TracingDelegate that will receive tracing-related events on the Host side.

We can't give synchronous access to tracing state to Host directly, since there is no guarantee that this call will happen on the inspector thread.

Example:
- `HostTarget::tracingState()` call may happen on UI thread, or whatever thread the Host is using, which reads `traceRecoding_` value.
- At the same time, the `stopTracing()` call that will invalidate `traceRecording_` could happen on inspector thread.

This is a pre-requisite for a better threading model, since we are going to be doing much frequent write operations from the Host side to record frame timings or screenshots.

Differential Revision: D86205686
Summary:
# Changelog: [Internal]

An implemementation of HostTargetTracingDelegate on the android side.

Notes:
- `getTracingState_next()` function will replace `getTracingState()` in the diff on top.
- `TracingStateListener `is temporarily added to `devsupport/interfaces`, will be moved to `devsupport/inspector` in one of the diffs on top.

Differential Revision: D87123723
Summary:
# Changelog: [Internal]

Before this change, every `getTracingState()` call would go through jni to C++ to get the current state synchronously.

This has a risk of data races, since we can't guarantee from which thread the Host will call this method. At the same time, the Tracing could be started from inspector thread, if this was initiated with CDP request.

Instead, the state will be propagated asynchronously via `HostTargetTracingDelegate`, and then it will be encapsulated on the Host side. In android case, this will be part of the `ReactHostInspectorTarget`.

Also removing no longer used code in `jsinspector-modern`.

Differential Revision: D87123722
Summary:
# Changelog: [Internal]

This should not have been public in a first place. There are just no reasons for it, since Performance Monitor is still an internal concept of React Native Framework.

Differential Revision: D87638584
Summary:
Pull Request resolved: facebook#54632

# Changelog: [Internal]

Tracing is a concept of Inspector. It should be part of the Inspector package, not general interfaces.

The Inspector stack is the only mechanism that controls the tracing state of a Host.

Reviewed By: cortinico

Differential Revision: D87638583
@meta-codesync meta-codesync bot closed this in 10d0d99 Nov 25, 2025
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Nov 25, 2025
@meta-codesync
Copy link

meta-codesync bot commented Nov 25, 2025

This pull request has been merged in 10d0d99.

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. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants