From 1049eddff177ecf0d6952a941f56d2c7711cfd9b Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Wed, 5 Nov 2025 03:12:20 -0800 Subject: [PATCH 1/2] Change visibility of tracing methods for RuntimeTarget (#54281) Summary: # Changelog: [Internal] This is not used, nor required. The controller is the canonical way of using targets. Reviewed By: huntie Differential Revision: D85440639 --- .../jsinspector-modern/RuntimeTarget.h | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.h b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.h index 236cf83e7de381..a2598d026f83fe 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeTarget.h @@ -207,19 +207,6 @@ class JSINSPECTOR_EXPORT RuntimeTarget : public EnableExecutorFromThis createTracingAgent(tracing::TraceRecordingState &state); - /** - * Start sampling profiler for a particular JavaScript runtime. - */ - void enableSamplingProfiler(); - /** - * Stop sampling profiler for a particular JavaScript runtime. - */ - void disableSamplingProfiler(); - /** - * Return recorded sampling profile for the previous sampling session. - */ - tracing::RuntimeSamplingProfile collectSamplingProfile(); - private: using Domain = RuntimeTargetController::Domain; @@ -275,6 +262,18 @@ class JSINSPECTOR_EXPORT RuntimeTarget : public EnableExecutorFromThis tracingAgent_; + /** + * Start sampling profiler for a particular JavaScript runtime. + */ + void enableSamplingProfiler(); + /** + * Stop sampling profiler for a particular JavaScript runtime. + */ + void disableSamplingProfiler(); + /** + * Return recorded sampling profile for the previous sampling session. + */ + tracing::RuntimeSamplingProfile collectSamplingProfile(); /** * Adds a function with the given name on the runtime's global object, that From cc46a34d141a04cacd0b52480fc10f3ebbb7dd9f Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Wed, 5 Nov 2025 03:12:20 -0800 Subject: [PATCH 2/2] Expose a public getter on a TracingAgent for background mode (#54282) Summary: # Changelog: [Internal] It is already in a tracing session state, we are going to use it in RuntimeTarget. Reviewed By: huntie Differential Revision: D85440638 --- .../ReactCommon/jsinspector-modern/RuntimeAgent.h | 2 +- .../jsinspector-modern/tracing/TargetTracingAgent.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.h b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.h index 7e0b62b442e7ff..74d5c935a5716b 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/RuntimeAgent.h @@ -99,7 +99,7 @@ class RuntimeAgent final { * Lifetime of this agent is bound to the lifetime of the Tracing session - * HostTargetTraceRecording and to the lifetime of the RuntimeTarget. */ -class RuntimeTracingAgent : tracing::TargetTracingAgent { +class RuntimeTracingAgent : public tracing::TargetTracingAgent { public: explicit RuntimeTracingAgent(tracing::TraceRecordingState &state, RuntimeTargetController &targetController); diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tracing/TargetTracingAgent.h b/packages/react-native/ReactCommon/jsinspector-modern/tracing/TargetTracingAgent.h index f92ffe7b263156..a1a1260c649437 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tracing/TargetTracingAgent.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/tracing/TargetTracingAgent.h @@ -27,6 +27,11 @@ class TargetTracingAgent { (void)state_; } + bool isRunningInBackgroundMode() + { + return state_.mode == tracing::Mode::Background; + } + protected: TraceRecordingState &state_; };