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
This commit is contained in:
Ruslan Lesiutin authored and Facebook GitHub Bot committed 2025-05-01 00:22:44 -07:00
1 parent 0b6ed6c7d5
commit 0f5eeb6970
1 file changed
+1 -1
@@ -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<std::string>{frame.getUrl()}
: std::nullopt,