зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1903792 - [devtools] Open the profiler on the stack chart by default when recording a JS trace. r=devtools-reviewers,profiler-reviewers,nchevobbe,julienw
Differential Revision: https://phabricator.services.mozilla.com/D214460
This commit is contained in:
Родитель
e083c8e00f
Коммит
8574b91f4e
|
@ -702,7 +702,7 @@ Toolbox.prototype = {
|
|||
if (!profile) {
|
||||
return;
|
||||
}
|
||||
const browser = await openProfilerTab();
|
||||
const browser = await openProfilerTab({ defaultPanel: "stack-chart" });
|
||||
|
||||
const profileCaptureResult = {
|
||||
type: "SUCCESS",
|
||||
|
|
|
@ -438,6 +438,15 @@ export interface ScaleFunctions {
|
|||
*/
|
||||
export type ProfilerViewMode = "full" | "active-tab" | "origins";
|
||||
|
||||
/**
|
||||
* Panel string identifier in the profiler frontend.
|
||||
*
|
||||
* To be synchronized with:
|
||||
* https://github.com/firefox-devtools/profiler/blob/b7fe97217b5d3ae770e2b7025738a075eba9ec34/src/app-logic/tabs-handling.js#L12
|
||||
*/
|
||||
export type ProfilerPanel = "calltree" | "flame-graph" | "stack-chart" |
|
||||
"marker-chart" | "marker-table" | "network-chart" | "js-tracer";
|
||||
|
||||
export interface PresetDefinition {
|
||||
entries: number;
|
||||
interval: number;
|
||||
|
|
|
@ -144,7 +144,7 @@ async function gInit(perfFront, traits, pageContext, openAboutProfiling) {
|
|||
objdirs,
|
||||
perfFront
|
||||
);
|
||||
const browser = await openProfilerTab(profilerViewMode);
|
||||
const browser = await openProfilerTab({ profilerViewMode });
|
||||
|
||||
/**
|
||||
* @type {ProfileCaptureResult}
|
||||
|
|
|
@ -417,7 +417,7 @@ export async function captureProfile(pageContext) {
|
|||
);
|
||||
|
||||
const { openProfilerTab } = lazy.BrowserModule();
|
||||
const browser = await openProfilerTab(profilerViewMode);
|
||||
const browser = await openProfilerTab({ profilerViewMode });
|
||||
registerProfileCaptureForBrowser(
|
||||
browser,
|
||||
profileCaptureResult,
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
* @typedef {import("../@types/perf").RestartBrowserWithEnvironmentVariable} RestartBrowserWithEnvironmentVariable
|
||||
* @typedef {import("../@types/perf").GetActiveBrowserID} GetActiveBrowserID
|
||||
* @typedef {import("../@types/perf").MinimallyTypedGeckoProfile} MinimallyTypedGeckoProfile
|
||||
* * @typedef {import("../@types/perf").ProfilerViewMode} ProfilerViewMode
|
||||
* @typedef {import("../@types/perf").ProfilerViewMode} ProfilerViewMode
|
||||
* @typedef {import("../@types/perf").ProfilerPanel} ProfilerPanel
|
||||
*/
|
||||
|
||||
/** @type {PerformancePref["UIBaseUrl"]} */
|
||||
|
@ -43,12 +44,17 @@ const UI_BASE_URL_PATH_DEFAULT = "/from-browser";
|
|||
* Once a profile is received from the actor, it needs to be opened up in
|
||||
* profiler.firefox.com to be analyzed. This function opens up profiler.firefox.com
|
||||
* into a new browser tab.
|
||||
* @param {ProfilerViewMode | undefined} profilerViewMode - View mode for the Firefox Profiler
|
||||
*
|
||||
* @typedef {Object} OpenProfilerOptions
|
||||
* @property {ProfilerViewMode | undefined} [profilerViewMode] - View mode for the Firefox Profiler
|
||||
* front-end timeline. While opening the url, we should append a query string
|
||||
* if a view other than "full" needs to be displayed.
|
||||
* @property {ProfilerPanel} [defaultPanel] Allows to change the default opened panel.
|
||||
*
|
||||
* @param {OpenProfilerOptions} options
|
||||
* @returns {Promise<MockedExports.Browser>} The browser for the opened tab.
|
||||
*/
|
||||
async function openProfilerTab(profilerViewMode) {
|
||||
async function openProfilerTab({ profilerViewMode, defaultPanel }) {
|
||||
// Allow the user to point to something other than profiler.firefox.com.
|
||||
const baseUrl = Services.prefs.getStringPref(
|
||||
UI_BASE_URL_PREF,
|
||||
|
@ -59,6 +65,7 @@ async function openProfilerTab(profilerViewMode) {
|
|||
UI_BASE_URL_PATH_PREF,
|
||||
UI_BASE_URL_PATH_DEFAULT
|
||||
);
|
||||
const additionalPath = defaultPanel ? `/${defaultPanel}/` : "";
|
||||
// This controls whether we enable the active tab view when capturing in web
|
||||
// developer preset.
|
||||
const enableActiveTab = Services.prefs.getBoolPref(
|
||||
|
@ -82,7 +89,7 @@ async function openProfilerTab(profilerViewMode) {
|
|||
viewModeQueryString = `?view=${profilerViewMode}`;
|
||||
}
|
||||
|
||||
const urlToLoad = `${baseUrl}${baseUrlPath}${viewModeQueryString}`;
|
||||
const urlToLoad = `${baseUrl}${baseUrlPath}${additionalPath}${viewModeQueryString}`;
|
||||
|
||||
// Find the most recently used window, as the DevTools client could be in a variety
|
||||
// of hosts.
|
||||
|
|
Загрузка…
Ссылка в новой задаче