зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1261738: Try to avoid overlapping FX_TAB_SWITCH_TOTAL_MS stopwatches. r=mconley
MozReview-Commit-ID: JSSvsbL6q1n --HG-- extra : rebase_source : 91a1888d5bbf4878a37644e44fc076b9aa018282
This commit is contained in:
Родитель
dd079472df
Коммит
dff885cba8
|
@ -1018,6 +1018,11 @@
|
|||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Holds a unique ID for the tab change that's currently being timed.
|
||||
Used to make sure that multiple, rapid tab switches do not try to
|
||||
create overlapping timers. -->
|
||||
<field name="_tabSwitchID">null</field>
|
||||
|
||||
<method name="updateCurrentBrowser">
|
||||
<parameter name="aForceUpdate"/>
|
||||
<body>
|
||||
|
@ -1033,11 +1038,23 @@
|
|||
// Waiting until the next MozAfterPaint ensures that we capture
|
||||
// the time it takes to paint, upload the textures to the compositor,
|
||||
// and then composite.
|
||||
if (this._tabSwitchID) {
|
||||
TelemetryStopwatch.cancel("FX_TAB_SWITCH_TOTAL_MS");
|
||||
}
|
||||
|
||||
let tabSwitchID = Symbol();
|
||||
|
||||
TelemetryStopwatch.start("FX_TAB_SWITCH_TOTAL_MS");
|
||||
window.addEventListener("MozAfterPaint", function onMozAfterPaint() {
|
||||
TelemetryStopwatch.finish("FX_TAB_SWITCH_TOTAL_MS");
|
||||
this._tabSwitchID = tabSwitchID;
|
||||
|
||||
let onMozAfterPaint = () => {
|
||||
if (this._tabSwitchID === tabSwitchID) {
|
||||
TelemetryStopwatch.finish("FX_TAB_SWITCH_TOTAL_MS");
|
||||
this._tabSwitchID = null;
|
||||
}
|
||||
window.removeEventListener("MozAfterPaint", onMozAfterPaint);
|
||||
});
|
||||
}
|
||||
window.addEventListener("MozAfterPaint", onMozAfterPaint);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче