mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 1495389 - remove instances of toolbox.performance; r=ochameau
Depends on D11295 Differential Revision: https://phabricator.services.mozilla.com/D11296 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
1ed63498ad
commit
0df3804e54
@ -382,14 +382,6 @@ Toolbox.prototype = {
|
||||
return this._highlighter;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the toolbox's performance front. Note that it may not always have been
|
||||
* initialized first. Use `initPerformance()` if needed.
|
||||
*/
|
||||
get performance() {
|
||||
return this._performance;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the toolbox's inspector front. Note that it may not always have been
|
||||
* initialized first. Use `initInspector()` if needed.
|
||||
@ -3047,10 +3039,37 @@ Toolbox.prototype = {
|
||||
return promise.resolve();
|
||||
}
|
||||
|
||||
this._performance = await this.target.getFront("performance");
|
||||
this._performance.on("console-profile-start", this._onPerformanceFrontEvent);
|
||||
const performanceFront = await this.target.getFront("performance");
|
||||
performanceFront.once(
|
||||
"console-profile-start",
|
||||
() => this._onPerformanceFrontEvent(performanceFront)
|
||||
);
|
||||
|
||||
return this._performance;
|
||||
return performanceFront;
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when a "console-profile-start" event comes from the PerformanceFront. If
|
||||
* the performance tool is already loaded when the first event comes in, immediately
|
||||
* unbind this handler, as this is only used to load the tool for the first time when
|
||||
* `console.profile()` recordings are started before the tool loads.
|
||||
*/
|
||||
async _onPerformanceFrontEvent(performanceFront) {
|
||||
if (this.getPanel("performance")) {
|
||||
// the performance panel is already recording all performance, we no longer
|
||||
// need the queue, if it was started
|
||||
performanceFront.flushQueuedRecordings();
|
||||
return;
|
||||
}
|
||||
|
||||
// Before any console recordings, we'll get a `console-profile-start` event
|
||||
// warning us that a recording will come later (via `recording-started`), so
|
||||
// start to boot up the tool and populate the tool with any other recordings
|
||||
// observed during that time.
|
||||
const panel = await this.loadTool("performance");
|
||||
const recordings = performanceFront.flushQueuedRecordings();
|
||||
panel.panelWin.PerformanceController.populateWithRecordings(recordings);
|
||||
await panel.open();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -3070,32 +3089,6 @@ Toolbox.prototype = {
|
||||
this._preferenceFront = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when any event comes from the PerformanceFront. If the performance tool is
|
||||
* already loaded when the first event comes in, immediately unbind this handler, as
|
||||
* this is only used to queue up observed recordings before the performance tool can
|
||||
* handle them, which will only occur when `console.profile()` recordings are started
|
||||
* before the tool loads.
|
||||
*/
|
||||
async _onPerformanceFrontEvent(recording) {
|
||||
this.performance.off("console-profile-start", this._onPerformanceFrontEvent);
|
||||
if (this.getPanel("performance")) {
|
||||
// the performance panel is already recording all performance, we no longer
|
||||
// need the queue, if it was started
|
||||
this.performance.flushQueuedRecordings();
|
||||
return;
|
||||
}
|
||||
|
||||
// Before any console recordings, we'll get a `console-profile-start` event
|
||||
// warning us that a recording will come later (via `recording-started`), so
|
||||
// start to boot up the tool and populate the tool with any other recordings
|
||||
// observed during that time.
|
||||
const panel = await this.loadTool("performance");
|
||||
const recordings = this.performance.flushQueuedRecordings();
|
||||
panel.panelWin.PerformanceController.populateWithRecordings(recordings);
|
||||
await panel.open();
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns gViewSourceUtils for viewing source.
|
||||
*/
|
||||
|
@ -24,7 +24,8 @@ add_task(async function() {
|
||||
Services.prefs.setIntPref(MEMORY_MAX_LOG_LEN_PREF, 777777);
|
||||
|
||||
await startRecording(panel);
|
||||
const { probability, maxLogLength } = await toolbox.performance.getConfiguration();
|
||||
const performanceFront = await toolbox.target.getFront("performance");
|
||||
const { probability, maxLogLength } = await performanceFront.getConfiguration();
|
||||
await stopRecording(panel);
|
||||
|
||||
is(probability, 0.213,
|
||||
|
@ -22,7 +22,8 @@ add_task(async function() {
|
||||
Services.prefs.setIntPref(PROFILER_SAMPLE_RATE_PREF, 2000);
|
||||
|
||||
await startRecording(panel);
|
||||
const { entries, interval } = await toolbox.performance.getConfiguration();
|
||||
const performanceFront = await toolbox.target.getFront("performance");
|
||||
const { entries, interval } = await performanceFront.getConfiguration();
|
||||
await stopRecording(panel);
|
||||
|
||||
is(entries, 1000, "profiler entries option is set on profiler");
|
||||
|
@ -29,7 +29,8 @@ exports.initPanelInTab = async function({ tool, tab }) {
|
||||
// to be opened. This is necessary because of the WebConsole's
|
||||
// `profile` and `profileEnd` methods.
|
||||
const toolbox = await gDevTools.showToolbox(target, tool);
|
||||
await toolbox.initPerformance();
|
||||
// ensure that the performance front is ready
|
||||
await target.getFront("performance");
|
||||
|
||||
const panel = toolbox.getCurrentPanel();
|
||||
return { target, toolbox, panel };
|
||||
@ -73,7 +74,8 @@ exports.initConsoleInTab = async function({ tab }) {
|
||||
});
|
||||
|
||||
const consoleMethod = async function(method, label, event) {
|
||||
const recordingEventReceived = once(toolbox.performance, event);
|
||||
const performanceFront = await toolbox.target.getFront("performance");
|
||||
const recordingEventReceived = once(performanceFront, event);
|
||||
if (label === undefined) {
|
||||
await panel.hud.jsterm.execute(`console.${method}()`);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user