mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1511102 - update the about:performance table immediately when switching back to the tab, r=felipe.
This commit is contained in:
parent
8e9ba7560d
commit
dd49ba8708
@ -1206,13 +1206,18 @@ var Control = {
|
||||
tbody.addEventListener("mousemove", () => {
|
||||
this._updateLastMouseEvent();
|
||||
});
|
||||
|
||||
window.addEventListener("visibilitychange", event => {
|
||||
if (!document.hidden) {
|
||||
this._updateDisplay(true);
|
||||
}
|
||||
});
|
||||
},
|
||||
_lastMouseEvent: 0,
|
||||
_updateLastMouseEvent() {
|
||||
this._lastMouseEvent = Date.now();
|
||||
},
|
||||
async update() {
|
||||
let mode = this._displayMode;
|
||||
if (this._autoRefreshInterval || !State._buffer[0]) {
|
||||
// Update the state only if we are not on pause.
|
||||
await State.update();
|
||||
@ -1220,7 +1225,17 @@ var Control = {
|
||||
return;
|
||||
}
|
||||
await wait(0);
|
||||
|
||||
await this._updateDisplay();
|
||||
|
||||
// Inform watchers
|
||||
Services.obs.notifyObservers(null, UPDATE_COMPLETE_TOPIC, this._displayMode);
|
||||
},
|
||||
// The force parameter can force a full update even when the mouse has been
|
||||
// moved recently.
|
||||
async _updateDisplay(force = false) {
|
||||
if (!performanceCountersEnabled()) {
|
||||
let mode = this._displayMode;
|
||||
let state = await (mode == MODE_GLOBAL ?
|
||||
State.promiseDeltaSinceStartOfTime() :
|
||||
State.promiseDeltaSinceStartOfBuffer());
|
||||
@ -1241,7 +1256,7 @@ var Control = {
|
||||
// button for the wrong item.
|
||||
// Memory use is unlikely to change dramatically within a few seconds, so
|
||||
// it's probably fine to not update the Memory column in this case.
|
||||
if (Date.now() - this._lastMouseEvent < TIME_BEFORE_SORTING_AGAIN) {
|
||||
if (!force && Date.now() - this._lastMouseEvent < TIME_BEFORE_SORTING_AGAIN) {
|
||||
let energyImpactPerId = new Map();
|
||||
for (let {id, dispatchesSincePrevious,
|
||||
durationSincePrevious} of State.getCounters()) {
|
||||
@ -1326,9 +1341,6 @@ var Control = {
|
||||
|
||||
await View.commit();
|
||||
}
|
||||
|
||||
// Inform watchers
|
||||
Services.obs.notifyObservers(null, UPDATE_COMPLETE_TOPIC, mode);
|
||||
},
|
||||
_showChildren(row) {
|
||||
let children = row._children;
|
||||
|
Loading…
Reference in New Issue
Block a user