From a09e381dbf20ea1213b8ec1ac7f068559aba75dc Mon Sep 17 00:00:00 2001 From: Edmond Chui <1967998+EdmondChuiHW@users.noreply.github.com> Date: Wed, 20 Mar 2024 22:23:47 +0000 Subject: [PATCH] add launch ID support --- front_end/core/host/RNPerfMetrics.ts | 6 ++++++ front_end/entrypoints/rn_inspector/rn_inspector.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/front_end/core/host/RNPerfMetrics.ts b/front_end/core/host/RNPerfMetrics.ts index cc78ad02400a..117428464e3d 100644 --- a/front_end/core/host/RNPerfMetrics.ts +++ b/front_end/core/host/RNPerfMetrics.ts @@ -17,6 +17,7 @@ export function getInstance(): RNPerfMetrics { type UnsubscribeFn = () => void; class RNPerfMetrics { #listeners: Set = new Set(); + #launchId: string|null = null; addEventListener(listener: RNReliabilityEventListener): UnsubscribeFn { this.#listeners.add(listener); @@ -51,6 +52,11 @@ class RNPerfMetrics { console.error('Error occurred when calling event listeners', error); } } + + setLaunchId(launchId: string|null): void { + this.#launchId = launchId; + } + } export function registerPerfMetricsGlobalPostMessageHandler(): void { diff --git a/front_end/entrypoints/rn_inspector/rn_inspector.ts b/front_end/entrypoints/rn_inspector/rn_inspector.ts index 54d2a5968545..f285dd32cec8 100644 --- a/front_end/entrypoints/rn_inspector/rn_inspector.ts +++ b/front_end/entrypoints/rn_inspector/rn_inspector.ts @@ -22,6 +22,7 @@ import type * as InspectorBackend from '../../core/protocol_client/InspectorBack Host.RNPerfMetrics.registerPerfMetricsGlobalPostMessageHandler(); +Host.rnPerfMetrics.setLaunchId(Root.Runtime.Runtime.queryParam('launchId')); // Legacy JavaScript Profiler - we support this until Hermes can support the // modern Performance panel. Root.Runtime.experiments.register(