From 6fb80fe5fb0cf967734f4c92c73c8342079216f9 Mon Sep 17 00:00:00 2001 From: Edmond Chui <1967998+EdmondChuiHW@users.noreply.github.com> Date: Tue, 12 Mar 2024 00:52:51 +0000 Subject: [PATCH] flag --- front_end/core/host/RNPerfMetrics.ts | 5 +++-- front_end/entrypoints/rn_inspector/rn_inspector.ts | 2 +- front_end/global_typings/react_native.d.ts | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/front_end/core/host/RNPerfMetrics.ts b/front_end/core/host/RNPerfMetrics.ts index acf63b4e040..539dd14e0f5 100644 --- a/front_end/core/host/RNPerfMetrics.ts +++ b/front_end/core/host/RNPerfMetrics.ts @@ -63,8 +63,9 @@ class RNPerfMetricsImpl implements RNPerfMetrics { } } -export function registerGlobalPerfMetricsListener(): void { - if (globalThis.enableReactNativePerfMetrics !== true) { +export function registerPerfMetricsGlobalPostMessageHandler(): void { + if (globalThis.enableReactNativePerfMetrics !== true || + globalThis.enableReactNativePerfMetricsGlobalPostMessage !== true) { return; } diff --git a/front_end/entrypoints/rn_inspector/rn_inspector.ts b/front_end/entrypoints/rn_inspector/rn_inspector.ts index 184ae0fb594..8a2b40cf60c 100644 --- a/front_end/entrypoints/rn_inspector/rn_inspector.ts +++ b/front_end/entrypoints/rn_inspector/rn_inspector.ts @@ -18,7 +18,7 @@ import * as Host from '../../core/host/host.js'; import * as Root from '../../core/root/root.js'; import * as Main from '../main/main.js'; -Host.RNPerfMetrics.registerGlobalPerfMetricsListener(); +Host.RNPerfMetrics.registerPerfMetricsGlobalPostMessageHandler(); // Legacy JavaScript Profiler - we support this until Hermes can support the // modern Performance panel. diff --git a/front_end/global_typings/react_native.d.ts b/front_end/global_typings/react_native.d.ts index 4a8f0bd1623..6734f5be5f9 100644 --- a/front_end/global_typings/react_native.d.ts +++ b/front_end/global_typings/react_native.d.ts @@ -8,5 +8,6 @@ export {}; declare global { namespace globalThis { var enableReactNativePerfMetrics: boolean|undefined; + var enableReactNativePerfMetricsGlobalPostMessage: boolean|undefined; } }