Skip to content

Commit

Permalink
move
Browse files Browse the repository at this point in the history
  • Loading branch information
EdmondChuiHW committed Mar 12, 2024
1 parent 5a7bb69 commit 16b80a5
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 63 deletions.
4 changes: 1 addition & 3 deletions config/gni/devtools_grd_files.gni
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ grd_files_debug_sources = [
"front_end/core/host/InspectorFrontendHost.js",
"front_end/core/host/InspectorFrontendHostAPI.js",
"front_end/core/host/Platform.js",
"front_end/core/host/RNPerfMetrics.js",
"front_end/core/host/ResourceLoader.js",
"front_end/core/host/UserMetrics.js",
"front_end/core/i18n/DevToolsLocale.js",
Expand Down Expand Up @@ -829,9 +830,6 @@ grd_files_debug_sources = [
"front_end/entrypoints/node_app/NodeConnectionsPanel.js",
"front_end/entrypoints/node_app/NodeMain.js",
"front_end/entrypoints/node_app/nodeConnectionsPanel.css.js",
"front_end/entrypoints/rn_inspector/rn_perf_metrics/Impl.js",
"front_end/entrypoints/rn_inspector/rn_perf_metrics/Utils.js",
"front_end/entrypoints/rn_inspector/rn_perf_metrics/rn_perf_metrics.js",
"front_end/entrypoints/wasmparser_worker/WasmParserWorker.js",
"front_end/entrypoints/worker_app/WorkerMain.js",
"front_end/generated/ARIAProperties.js",
Expand Down
1 change: 1 addition & 0 deletions front_end/core/host/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ devtools_module("host") {
"InspectorFrontendHost.ts",
"InspectorFrontendHostAPI.ts",
"Platform.ts",
"RNPerfMetrics.ts",
"ResourceLoader.ts",
"UserMetrics.ts",
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Copyright 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Copyright (c) Meta Platforms, Inc. and affiliates.
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {type ReactNativeChromeDevToolsEvent} from './RNPerfMetricsEvent.js';

export type RNReliabilityEventListener = (event: ReactNativeChromeDevToolsEvent) => void;

type UnsunscribeFn = () => void;
Expand Down Expand Up @@ -60,3 +62,15 @@ class RNPerfMetricsImpl implements RNPerfMetrics {
}
}
}

export function registerGlobalPerfMetricsListener(): void {
if (globalThis.enableReactNativePerfMetrics !== true) {
return;
}

getInstance().addEventListener(event => {
window.postMessage({event, tag: 'react-native-chrome-devtools-perf-metrics'}, window.location.origin);
});
}

export type ReactNativeChromeDevToolsEvent = {};
3 changes: 3 additions & 0 deletions front_end/core/host/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ import * as InspectorFrontendHost from './InspectorFrontendHost.js';
import * as InspectorFrontendHostAPI from './InspectorFrontendHostAPI.js';
import * as Platform from './Platform.js';
import * as ResourceLoader from './ResourceLoader.js';
import * as RNPerfMetrics from './RNPerfMetrics.js';
import * as UserMetrics from './UserMetrics.js';

export {
InspectorFrontendHost,
InspectorFrontendHostAPI,
Platform,
ResourceLoader,
RNPerfMetrics,
UserMetrics,
};

export const userMetrics = new UserMetrics.UserMetrics();
export const rnPerfMetrics = RNPerfMetrics.getInstance();
1 change: 0 additions & 1 deletion front_end/entrypoints/rn_inspector/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ devtools_entrypoint("entrypoint") {
"../../panels/webauthn:meta",
"../main:bundle",
"../shell",
"rn_perf_metrics:rn_perf_metrics",
]

visibility = [ "../../:*" ]
Expand Down
5 changes: 2 additions & 3 deletions front_end/entrypoints/rn_inspector/rn_inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ import '../../panels/network/network-meta.js';
import '../../panels/js_profiler/js_profiler-meta.js';
import '../../panels/rn_welcome/rn_welcome-meta.js';

import * as Host from '../../core/host/host.js';
import * as Root from '../../core/root/root.js';
import * as Main from '../main/main.js';

import * as RNPerfMetrics from './rn_perf_metrics/rn_perf_metrics.js';

RNPerfMetrics.Utils.registerGlobalPerfMetricsListener();
Host.RNPerfMetrics.registerGlobalPerfMetricsListener();

// Legacy JavaScript Profiler - we support this until Hermes can support the
// modern Performance panel.
Expand Down
20 changes: 0 additions & 20 deletions front_end/entrypoints/rn_inspector/rn_perf_metrics/BUILD.gn

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions front_end/entrypoints/rn_inspector/rn_perf_metrics/Utils.ts

This file was deleted.

This file was deleted.

0 comments on commit 16b80a5

Please sign in to comment.