Files
react-native-devtools-frontend/front_end/entrypoints/node_app/node_app.ts
T
Nancy Li 1c65919664 [Timeline] Add Performance panel to node_app & js_app
- Add Performance panel to node_app & js_app, and put behind experiments

How to test (this CL needs to be tested with the parent CL):
 1) run `deno run --inspect-brk --allow-read --allow-net https://deno.land/std@v0.50.0/http/file_server.ts`
 2) Open devtools and then click the green icon at top-right corner. Or go to chrome://inspect and click "inpect" or " Open dedicated DevTools for Node".
 3) Click the three-dot menu at the top-right corner, and choose the "More tools" > "Performance"
 4) Record in "Performance" tab

Bug: 1362840
Change-Id: Idac53a90016bbdd7ff1dfd093c715caf659b2c4a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3892770
Reviewed-by: Andres Olivares <andoli@chromium.org>
Commit-Queue: Nancy Li <nancyly@chromium.org>
2022-09-19 09:40:20 +00:00

81 lines
2.9 KiB
TypeScript

// Copyright 2018 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 '../shell/shell.js';
import '../../panels/mobile_throttling/mobile_throttling-meta.js';
import '../../panels/js_profiler/js_profiler-meta.js';
import type * as Sources from '../../panels/sources/sources.js';
import * as i18n from '../../core/i18n/i18n.js';
import * as UI from '../../ui/legacy/legacy.js';
import * as Common from '../../core/common/common.js';
import * as Root from '../../core/root/root.js';
import * as Main from '../main/main.js';
import {NodeMainImpl} from './NodeMain.js'; // eslint-disable-line rulesdir/es_modules_import
import {NodeConnectionsPanel} from './NodeConnectionsPanel.js'; // eslint-disable-line rulesdir/es_modules_import
const UIStrings = {
/**
*@description Text that refers to the network connection
*/
connection: 'Connection',
/**
*@description A tag of Node.js Connection Panel that can be searched in the command menu
*/
node: 'node',
/**
*@description Command for showing the Connection tool
*/
showConnection: 'Show Connection',
/**
*@description Title of the 'Node' tool in the Network Navigator View, which is part of the Sources tool
*/
networkTitle: 'Node',
/**
*@description Command for showing the 'Node' tool in the Network Navigator View, which is part of the Sources tool
*/
showNode: 'Node',
};
const str_ = i18n.i18n.registerUIStrings('entrypoints/node_app/node_app.ts', UIStrings);
const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
let loadedSourcesModule: (typeof Sources|undefined);
async function loadSourcesModule(): Promise<typeof Sources> {
if (!loadedSourcesModule) {
loadedSourcesModule = await import('../../panels/sources/sources.js');
}
return loadedSourcesModule;
}
UI.ViewManager.registerViewExtension({
location: UI.ViewManager.ViewLocationValues.PANEL,
id: 'node-connection',
title: i18nLazyString(UIStrings.connection),
commandPrompt: i18nLazyString(UIStrings.showConnection),
order: 0,
async loadView() {
return NodeConnectionsPanel.instance();
},
tags: [i18nLazyString(UIStrings.node)],
});
UI.ViewManager.registerViewExtension({
location: UI.ViewManager.ViewLocationValues.NAVIGATOR_VIEW,
id: 'navigator-network',
title: i18nLazyString(UIStrings.networkTitle),
commandPrompt: i18nLazyString(UIStrings.showNode),
order: 2,
persistence: UI.ViewManager.ViewPersistence.PERMANENT,
async loadView() {
const Sources = await loadSourcesModule();
return Sources.SourcesNavigator.NetworkNavigatorView.instance();
},
});
// @ts-ignore Exposed for legacy layout tests
self.runtime = Root.Runtime.Runtime.instance({forceNew: true});
Common.Runnable.registerEarlyInitializationRunnable(NodeMainImpl.instance);
new Main.MainImpl.MainImpl();