mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1511095 - Remove SchedulePressure.jsm and the fallback loading throbber in the tabstrip. r=mconley
The APNG version is still used by the TabsList which can't support the SVG version of the throbber currently. Differential Revision: https://phabricator.services.mozilla.com/D13461 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
3cb272bce9
commit
98ab4d61f7
@ -212,9 +212,6 @@ pref("general.autoScroll", true);
|
||||
#endif
|
||||
|
||||
pref("browser.stopReloadAnimation.enabled", true);
|
||||
pref("browser.schedulePressure.enabled", true);
|
||||
pref("browser.schedulePressure.defaultCount", 3);
|
||||
pref("browser.schedulePressure.timeoutMs", 300);
|
||||
|
||||
// UI density of the browser chrome. This mostly affects toolbarbutton
|
||||
// and urlbar spacing. The possible values are 0=normal, 1=compact, 2=touch.
|
||||
|
@ -199,15 +199,13 @@ panelview[mainview] > .panel-header {
|
||||
}
|
||||
|
||||
.tab-label:not([fadein]),
|
||||
.tab-throbber:not([fadein]),
|
||||
.tab-throbber-fallback:not([fadein]) {
|
||||
.tab-throbber:not([fadein]) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
%ifdef NIGHTLY_BUILD
|
||||
@supports -moz-bool-pref("browser.tabs.hideThrobber") {
|
||||
.tab-throbber,
|
||||
.tab-throbber-fallback {
|
||||
.tab-throbber {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
Sanitizer: "resource:///modules/Sanitizer.jsm",
|
||||
SessionStartup: "resource:///modules/sessionstore/SessionStartup.jsm",
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.jsm",
|
||||
SchedulePressure: "resource:///modules/SchedulePressure.jsm",
|
||||
ShortcutUtils: "resource://gre/modules/ShortcutUtils.jsm",
|
||||
SimpleServiceDiscovery: "resource://gre/modules/SimpleServiceDiscovery.jsm",
|
||||
SiteDataManager: "resource:///modules/SiteDataManager.jsm",
|
||||
|
@ -15,7 +15,6 @@
|
||||
.tab-icon-image:not([src]):not([pinned]):not([crashed]):not([sharing]),
|
||||
.tab-icon-image[busy],
|
||||
.tab-throbber:not([busy]),
|
||||
.tab-throbber-fallback:not([busy]),
|
||||
.tab-icon-sound:not([soundplaying]):not([muted]):not([activemedia-blocked]),
|
||||
.tab-icon-sound[pinned],
|
||||
.tab-sharing-icon-overlay,
|
||||
|
@ -62,8 +62,6 @@ window._gBrowser = {
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "animationsEnabled",
|
||||
"toolkit.cosmeticAnimations.enabled");
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "schedulePressureDefaultCount",
|
||||
"browser.schedulePressure.defaultCount");
|
||||
|
||||
this._setupEventListeners();
|
||||
},
|
||||
@ -4991,32 +4989,6 @@ class TabProgressListener {
|
||||
this.mTab.setAttribute("busy", "true");
|
||||
gBrowser._tabAttrModified(this.mTab, ["busy"]);
|
||||
this.mTab._notselectedsinceload = !this.mTab.selected;
|
||||
SchedulePressure.startMonitoring(window, {
|
||||
highPressureFn() {
|
||||
// Only switch back to the SVG loading indicator after getting
|
||||
// three consecutive low pressure callbacks. Used to prevent
|
||||
// switching quickly between the SVG and APNG loading indicators.
|
||||
gBrowser.tabContainer._schedulePressureCount = gBrowser.schedulePressureDefaultCount;
|
||||
gBrowser.tabContainer.setAttribute("schedulepressure", "true");
|
||||
},
|
||||
lowPressureFn() {
|
||||
if (!gBrowser.tabContainer._schedulePressureCount ||
|
||||
--gBrowser.tabContainer._schedulePressureCount <= 0) {
|
||||
gBrowser.tabContainer.removeAttribute("schedulepressure");
|
||||
}
|
||||
|
||||
// If tabs are closed while they are loading we need to
|
||||
// stop monitoring schedule pressure. We don't stop monitoring
|
||||
// during high pressure times because we want to eventually
|
||||
// return to the SVG tab loading animations.
|
||||
let continueMonitoring = true;
|
||||
if (!document.querySelector(".tabbrowser-tab[busy]")) {
|
||||
SchedulePressure.stopMonitoring(window);
|
||||
continueMonitoring = false;
|
||||
}
|
||||
return { continueMonitoring };
|
||||
},
|
||||
});
|
||||
gBrowser.syncThrobberAnimations(this.mTab);
|
||||
}
|
||||
|
||||
@ -5031,10 +5003,6 @@ class TabProgressListener {
|
||||
if (this.mTab.hasAttribute("busy")) {
|
||||
this.mTab.removeAttribute("busy");
|
||||
modifiedAttrs.push("busy");
|
||||
if (!document.querySelector(".tabbrowser-tab[busy]")) {
|
||||
SchedulePressure.stopMonitoring(window);
|
||||
gBrowser.tabContainer.removeAttribute("schedulepressure");
|
||||
}
|
||||
|
||||
// Only animate the "burst" indicating the page has loaded if
|
||||
// the top-level page is the one that finished loading.
|
||||
|
@ -1909,10 +1909,6 @@
|
||||
anonid="tab-throbber"
|
||||
class="tab-throbber"
|
||||
layer="true"/>
|
||||
<xul:image xbl:inherits="fadein,pinned,busy,progress,selected=visuallyselected"
|
||||
class="tab-throbber-fallback"
|
||||
role="presentation"
|
||||
layer="true"/>
|
||||
<xul:hbox xbl:inherits="fadein,pinned,busy,progress,selected=visuallyselected,pendingicon"
|
||||
anonid="tab-icon-pending"
|
||||
class="tab-icon-pending"/>
|
||||
|
@ -1,124 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SchedulePressure"];
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "SCHEDULE_PRESSURE_ENABLED",
|
||||
"browser.schedulePressure.enabled", true);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "TIMEOUT_AMOUNT",
|
||||
"browser.schedulePressure.timeoutMs", 300);
|
||||
|
||||
/**
|
||||
* The SchedulePressure object provides the ability to alter
|
||||
* the behavior of a program based on the idle activity of the
|
||||
* host machine.
|
||||
*/
|
||||
var SchedulePressure = {
|
||||
_idleCallbackWeakMap: new WeakMap(),
|
||||
_setTimeoutWeakMap: new WeakMap(),
|
||||
_telemetryCallbackWeakMap: new WeakMap(),
|
||||
|
||||
_createTimeoutFn(window, callbackFn) {
|
||||
return () => {
|
||||
if (window.closed) {
|
||||
TelemetryStopwatch.cancel("FX_SCHEDULE_PRESSURE_IDLE_SAMPLE_MS", window);
|
||||
this._telemetryCallbackWeakMap.delete(window);
|
||||
return;
|
||||
}
|
||||
let nextCallbackId = window.requestIdleCallback(callbackFn, {timeout: TIMEOUT_AMOUNT});
|
||||
this._idleCallbackWeakMap.set(window, nextCallbackId);
|
||||
|
||||
// Don't create another timeout-less idle callback if the first
|
||||
// one hasn't completed yet.
|
||||
if (!this._telemetryCallbackWeakMap.has(window) &&
|
||||
TelemetryStopwatch.start("FX_SCHEDULE_PRESSURE_IDLE_SAMPLE_MS", window)) {
|
||||
let telemetryCallbackId = window.requestIdleCallback(() => {
|
||||
TelemetryStopwatch.finish("FX_SCHEDULE_PRESSURE_IDLE_SAMPLE_MS", window);
|
||||
this._telemetryCallbackWeakMap.delete(window);
|
||||
});
|
||||
this._telemetryCallbackWeakMap.set(window, telemetryCallbackId);
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Starts an interval timeout that periodically waits for
|
||||
* an idle callback. If the idle callback fails to get called
|
||||
* within the timeout specified by TIMEOUT_AMOUNT, the
|
||||
* highPressureFn callback will get called. Otherwise the
|
||||
* lowPressureFn callback will get called.
|
||||
*
|
||||
* @param window
|
||||
* The DOM window of the requestee.
|
||||
* @param options
|
||||
* highPressureFn
|
||||
* A function that will be called when the idle callback
|
||||
* fails to be called within the time specified by TIMEOUT_AMOUNT.
|
||||
* Returning an object with property of `continueMonitoring` set
|
||||
* to `false` will prevent further monitoring.
|
||||
* lowPressureFn
|
||||
* A function that will be called when the idle callback
|
||||
* gets called within the time specified by TIMEOUT_AMOUNT.
|
||||
* Returning an object with property of `continueMonitoring` set
|
||||
* to `false` will prevent further monitoring.
|
||||
*/
|
||||
startMonitoring(window, {highPressureFn, lowPressureFn}) {
|
||||
if (!SCHEDULE_PRESSURE_ENABLED ||
|
||||
this._setTimeoutWeakMap.has(window) ||
|
||||
this._idleCallbackWeakMap.has(window)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let callbackFn = idleDeadline => {
|
||||
if (window.closed) {
|
||||
return;
|
||||
}
|
||||
|
||||
let result;
|
||||
if (idleDeadline.didTimeout) {
|
||||
try {
|
||||
result = highPressureFn();
|
||||
} catch (ex) {}
|
||||
} else {
|
||||
try {
|
||||
result = lowPressureFn();
|
||||
} catch (ex) {}
|
||||
}
|
||||
|
||||
if (result && !result.continueMonitoring) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._setTimeoutWeakMap.set(window,
|
||||
window.setTimeout(this._createTimeoutFn(window, callbackFn), TIMEOUT_AMOUNT));
|
||||
};
|
||||
|
||||
this._setTimeoutWeakMap.set(window,
|
||||
window.setTimeout(this._createTimeoutFn(window, callbackFn), TIMEOUT_AMOUNT));
|
||||
},
|
||||
|
||||
/**
|
||||
* Stops the interval timeout that periodically waits for
|
||||
* an idle callback.
|
||||
*
|
||||
* @param window
|
||||
* The DOM window of the requestee.
|
||||
*/
|
||||
stopMonitoring(window) {
|
||||
function removeFromMapAndCancelTimeout(map, cancelFn) {
|
||||
if (map.has(window)) {
|
||||
cancelFn(map.get(window));
|
||||
map.delete(window);
|
||||
}
|
||||
}
|
||||
|
||||
TelemetryStopwatch.cancel("FX_SCHEDULE_PRESSURE_IDLE_SAMPLE_MS", window);
|
||||
removeFromMapAndCancelTimeout(this._setTimeoutWeakMap, window.clearTimeout);
|
||||
removeFromMapAndCancelTimeout(this._idleCallbackWeakMap, window.cancelIdleCallback);
|
||||
removeFromMapAndCancelTimeout(this._telemetryCallbackWeakMap, window.cancelIdleCallback);
|
||||
},
|
||||
};
|
@ -272,16 +272,16 @@ class TabsPanel extends TabsListBase {
|
||||
let image = this.doc.getAnonymousElementByAttribute(
|
||||
button, "class", "toolbarbutton-icon") ||
|
||||
this.doc.getAnonymousElementByAttribute(
|
||||
button, "class", "toolbarbutton-icon tab-throbber-fallback");
|
||||
button, "class", "toolbarbutton-icon tab-throbber-tabslist");
|
||||
|
||||
if (image) {
|
||||
let busy = tab.getAttribute("busy");
|
||||
let progress = tab.getAttribute("progress");
|
||||
setAttributes(image, {busy, progress});
|
||||
if (busy) {
|
||||
image.classList.add("tab-throbber-fallback");
|
||||
image.classList.add("tab-throbber-tabslist");
|
||||
} else {
|
||||
image.classList.remove("tab-throbber-fallback");
|
||||
image.classList.remove("tab-throbber-tabslist");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +149,6 @@ EXTRA_JS_MODULES += [
|
||||
'ReaderParent.jsm',
|
||||
'RemotePrompt.jsm',
|
||||
'Sanitizer.jsm',
|
||||
'SchedulePressure.jsm',
|
||||
'SelectionChangedMenulist.jsm',
|
||||
'SiteDataManager.jsm',
|
||||
'SitePermissions.jsm',
|
||||
|
@ -149,7 +149,7 @@
|
||||
}
|
||||
|
||||
.tab-throbber,
|
||||
.tab-throbber-fallback,
|
||||
.tab-throbber-tabslist,
|
||||
.tab-icon-pending,
|
||||
.tab-icon-image,
|
||||
.tab-sharing-icon-overlay,
|
||||
@ -159,7 +159,7 @@
|
||||
}
|
||||
|
||||
.tab-throbber,
|
||||
.tab-throbber-fallback,
|
||||
.tab-throbber-tabslist,
|
||||
.tab-icon-pending,
|
||||
.tab-icon-image,
|
||||
.tab-sharing-icon-overlay {
|
||||
@ -168,7 +168,7 @@
|
||||
}
|
||||
|
||||
.tab-throbber:not([pinned]),
|
||||
.tab-throbber-fallback:not([pinned]),
|
||||
.tab-throbber-tabslist:not([pinned]),
|
||||
.tab-sharing-icon-overlay:not([pinned]),
|
||||
.tab-icon-pending:not([pinned]),
|
||||
.tab-icon-image:not([pinned]) {
|
||||
@ -241,11 +241,6 @@
|
||||
fill: #84c1ff;
|
||||
}
|
||||
|
||||
#tabbrowser-tabs[schedulepressure] .tab-throbber,
|
||||
#tabbrowser-tabs:not([schedulepressure]) .tab-throbber-fallback {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tab-icon-image {
|
||||
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.svg");
|
||||
-moz-context-properties: fill;
|
||||
@ -339,28 +334,28 @@
|
||||
list-style-image: url("chrome://browser/skin/tabbrowser/tab-audio-blocked-small.svg");
|
||||
}
|
||||
|
||||
.tab-throbber-fallback[busy] {
|
||||
.tab-throbber-tabslist[busy] {
|
||||
list-style-image: url("chrome://browser/skin/tabbrowser/tab-connecting.png");
|
||||
}
|
||||
|
||||
.tab-throbber-fallback[progress] {
|
||||
.tab-throbber-tabslist[progress] {
|
||||
list-style-image: url("chrome://browser/skin/tabbrowser/tab-loading.png");
|
||||
}
|
||||
|
||||
#TabsToolbar[brighttext] .tab-throbber-fallback[progress]:not([selected=true]) {
|
||||
#TabsToolbar[brighttext] .tab-throbber-tabslist[progress]:not([selected=true]) {
|
||||
list-style-image: url("chrome://browser/skin/tabbrowser/tab-loading-inverted.png");
|
||||
}
|
||||
|
||||
@media (min-resolution: 1.1dppx) {
|
||||
.tab-throbber-fallback[busy] {
|
||||
.tab-throbber-tabslist[busy] {
|
||||
list-style-image: url("chrome://browser/skin/tabbrowser/tab-connecting@2x.png");
|
||||
}
|
||||
|
||||
.tab-throbber-fallback[progress] {
|
||||
.tab-throbber-tabslist[progress] {
|
||||
list-style-image: url("chrome://browser/skin/tabbrowser/tab-loading@2x.png");
|
||||
}
|
||||
|
||||
#TabsToolbar[brighttext] .tab-throbber-fallback[progress]:not([selected=true]) {
|
||||
#TabsToolbar[brighttext] .tab-throbber-tabslist[progress]:not([selected=true]) {
|
||||
list-style-image: url("chrome://browser/skin/tabbrowser/tab-loading-inverted@2x.png");
|
||||
}
|
||||
}
|
||||
@ -770,7 +765,7 @@
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.all-tabs-item > .all-tabs-button > .tab-throbber-fallback {
|
||||
.tab-throbber-tabslist {
|
||||
display: block;
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user