From 4f0b002c84bdb82cb092d9f374f3327e5adea67e Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Fri, 22 Sep 2023 17:14:51 +0100 Subject: [PATCH] Disable Performance panel, enable legacy JS Profiler --- front_end/entrypoints/main/MainImpl.ts | 6 ------ front_end/entrypoints/rn_inspector/BUILD.gn | 2 +- .../entrypoints/rn_inspector/rn_inspector.ts | 17 +++++++++++++---- .../panels/js_profiler/js_profiler-meta.ts | 16 +--------------- front_end/panels/profiler/ProfilesPanel.ts | 3 +++ 5 files changed, 18 insertions(+), 26 deletions(-) diff --git a/front_end/entrypoints/main/MainImpl.ts b/front_end/entrypoints/main/MainImpl.ts index be988ce9fff..99f440486be 100644 --- a/front_end/entrypoints/main/MainImpl.ts +++ b/front_end/entrypoints/main/MainImpl.ts @@ -313,12 +313,6 @@ export class MainImpl { 'timelineAsConsoleProfileResultPanel', 'View console.profile() results in the Performance panel for Node.js', true); - // JS Profiler - Root.Runtime.experiments.register( - 'jsProfilerTemporarilyEnable', 'Enable JavaScript Profiler temporarily', /* unstable= */ false, - 'https://developer.chrome.com/blog/js-profiler-deprecation/', - 'https://bugs.chromium.org/p/chromium/issues/detail?id=1354548'); - // Debugging Root.Runtime.experiments.register( 'wasmDWARFDebugging', 'WebAssembly Debugging: Enable DWARF support', undefined, diff --git a/front_end/entrypoints/rn_inspector/BUILD.gn b/front_end/entrypoints/rn_inspector/BUILD.gn index 0e439d25f33..9572f54bd77 100644 --- a/front_end/entrypoints/rn_inspector/BUILD.gn +++ b/front_end/entrypoints/rn_inspector/BUILD.gn @@ -18,6 +18,7 @@ devtools_entrypoint("entrypoint") { "../../panels/elements:meta", "../../panels/emulation:meta", "../../panels/issues:meta", + "../../panels/js_profiler:meta", "../../panels/layer_viewer:meta", "../../panels/layers:meta", "../../panels/lighthouse:meta", @@ -29,7 +30,6 @@ devtools_entrypoint("entrypoint") { "../../panels/rn_welcome:meta", "../../panels/security:meta", "../../panels/sensors:meta", - "../../panels/timeline:meta", "../../panels/web_audio:meta", "../../panels/webauthn:meta", "../main:bundle", diff --git a/front_end/entrypoints/rn_inspector/rn_inspector.ts b/front_end/entrypoints/rn_inspector/rn_inspector.ts index 4ce563fb04a..4b7bdb1f8bc 100644 --- a/front_end/entrypoints/rn_inspector/rn_inspector.ts +++ b/front_end/entrypoints/rn_inspector/rn_inspector.ts @@ -10,21 +10,30 @@ import '../../panels/developer_resources/developer_resources-meta.js'; import '../inspector_main/inspector_main-meta.js'; import '../../panels/issues/issues-meta.js'; import '../../panels/mobile_throttling/mobile_throttling-meta.js'; -import '../../panels/timeline/timeline-meta.js'; +import '../../panels/js_profiler/js_profiler-meta.js'; import '../../panels/rn_welcome/rn_welcome-meta.js'; import * as Root from '../../core/root/root.js'; import * as Main from '../main/main.js'; +// Legacy JavaScript Profiler - we support this until Hermes can support the +// modern Performance panel. +Root.Runtime.experiments.register( + Root.Runtime.ExperimentName.JS_PROFILER_TEMP_ENABLE, + 'Enable JavaScript Profiler (legacy)', + /* unstable */ false, +); + Root.Runtime.experiments.register( Root.Runtime.ExperimentName.REACT_NATIVE_SPECIFIC_UI, 'Show React Native-specific UI', /* unstable */ false, ); -Root.Runtime.experiments.enableExperimentsByDefault( - [Root.Runtime.ExperimentName.REACT_NATIVE_SPECIFIC_UI], -); +Root.Runtime.experiments.enableExperimentsByDefault([ + Root.Runtime.ExperimentName.JS_PROFILER_TEMP_ENABLE, + Root.Runtime.ExperimentName.REACT_NATIVE_SPECIFIC_UI, +]); // @ts-ignore Exposed for legacy layout tests self.runtime = Root.Runtime.Runtime.instance({forceNew: true}); diff --git a/front_end/panels/js_profiler/js_profiler-meta.ts b/front_end/panels/js_profiler/js_profiler-meta.ts index 2c0f3e64ec3..2ba49786cf0 100644 --- a/front_end/panels/js_profiler/js_profiler-meta.ts +++ b/front_end/panels/js_profiler/js_profiler-meta.ts @@ -88,7 +88,7 @@ UI.ViewManager.registerViewExtension({ title: i18nLazyString(UIStrings.profiler), commandPrompt: i18nLazyString(UIStrings.showProfiler), order: 65, - persistence: UI.ViewManager.ViewPersistence.CLOSEABLE, + persistence: UI.ViewManager.ViewPersistence.PERMANENT, experiment: Root.Runtime.ExperimentName.JS_PROFILER_TEMP_ENABLE, async loadView() { const Profiler = await loadProfilerModule(); @@ -96,20 +96,6 @@ UI.ViewManager.registerViewExtension({ }, }); -UI.ViewManager.registerViewExtension({ - location: UI.ViewManager.ViewLocationValues.PANEL, - id: 'timeline', - title: i18nLazyString(UIStrings.performance), - commandPrompt: i18nLazyString(UIStrings.showPerformance), - order: 66, - hasToolbar: false, - isPreviewFeature: true, - async loadView() { - const Timeline = await loadTimelineModule(); - return Timeline.TimelinePanel.TimelinePanel.instance({forceNew: null, isNode: true}); - }, -}); - UI.ActionRegistration.registerActionExtension({ actionId: 'profiler.js-toggle-recording', category: UI.ActionRegistration.ActionCategory.JAVASCRIPT_PROFILER, diff --git a/front_end/panels/profiler/ProfilesPanel.ts b/front_end/panels/profiler/ProfilesPanel.ts index e865c98e21b..8feb5d79c88 100644 --- a/front_end/panels/profiler/ProfilesPanel.ts +++ b/front_end/panels/profiler/ProfilesPanel.ts @@ -704,6 +704,9 @@ export class JSProfilerPanel extends ProfilesPanel implements UI.ActionRegistrat const registry = instance; super('js_profiler', [registry.cpuProfileType], 'profiler.js-toggle-recording'); this.splitWidget().mainWidget()?.setMinimumSize(350, 0); + if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.REACT_NATIVE_SPECIFIC_UI)) { + return; + } if (Root.Runtime.experiments.isEnabled('jsProfilerTemporarilyEnable')) { this.#showDeprecationInfobar(); } else {