From 0f5eeb6970a4696fb7baefbacd242c7422aac45c Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Thu, 1 May 2025 00:22:44 -0700 Subject: [PATCH] Use correct scriptId (#51030) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51030 # Changelog: [Internal] I've been using the wrong thing this whole time, because it is referenced in `ChromeTraceSerializer.cpp`: https://www.internalfb.com/code/fbsource/[b422eeb3bb6334ef95e8cf01b18e32ba8ab72bbe]/xplat/hermes-snapshot/lib/VM/Profiler/ChromeTraceSerializer.cpp?lines=439 Turns out, there is a real `scriptId`, defined by the Runtime and which is unique for every script. This also aligns with other parts of the CDP stack in Hermes. Since this scriptId is always available, there is no need to make it optional. Reviewed By: dannysu Differential Revision: D73185984 fbshipit-source-id: 1bb057584cf3f18bd7b440fef44de9e880ceb961 --- .../chrome/HermesRuntimeSamplingProfileSerializer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeSamplingProfileSerializer.cpp b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeSamplingProfileSerializer.cpp index f30924441fc..dea271f42a3 100644 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeSamplingProfileSerializer.cpp +++ b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeSamplingProfileSerializer.cpp @@ -72,7 +72,7 @@ RuntimeSamplingProfile::SampleCallStackFrame convertJSFunctionHermesFrame( const fhsp::ProfileSampleCallStackJSFunctionFrame& frame) { return RuntimeSamplingProfile::SampleCallStackFrame{ RuntimeSamplingProfile::SampleCallStackFrame::Kind::JSFunction, - frame.hasScriptId() ? frame.getScriptId() : FALLBACK_SCRIPT_ID, + frame.getScriptId(), frame.getFunctionName(), frame.hasUrl() ? std::optional{frame.getUrl()} : std::nullopt,