Bug 1385453 - Make it possible to disable tab warming. r=billm

MozReview-Commit-ID: LTxerOEQyQq

--HG--
extra : rebase_source : 7e858f026945ee55472e2877d520582faf2e1393
This commit is contained in:
Mike Conley 2017-08-23 16:40:37 -04:00
Родитель bad1d3e781
Коммит abb784e833
2 изменённых файлов: 28 добавлений и 19 удалений

Просмотреть файл

@ -1553,8 +1553,9 @@ pref("browser.tabs.remote.autostart.2", true);
// For speculatively warming up tabs to improve perceived
// performance while using the async tab switcher.
pref("browser.tabs.remote.maxWarmingTabs", 3);
pref("browser.tabs.remote.warmingUnloadDelayMs", 2000);
pref("browser.tabs.remote.warmup.enabled", true);
pref("browser.tabs.remote.warmup.maxTabs", 3);
pref("browser.tabs.remote.warmup.unloadDelayMs", 2000);
// For the about:tabcrashed page
pref("browser.tabs.crashReporting.sendReport", true);

Просмотреть файл

@ -4189,10 +4189,12 @@
init() {
this.log("START");
XPCOMUtils.defineLazyPreferenceGetter(this, "WARMING_ENABLED",
"browser.tabs.remote.warmup.enabled", false);
XPCOMUtils.defineLazyPreferenceGetter(this, "MAX_WARMING_TABS",
"browser.tabs.remote.maxWarmingTabs", 3);
"browser.tabs.remote.warmup.maxTabs", 3);
XPCOMUtils.defineLazyPreferenceGetter(this, "WARMING_UNLOAD_DELAY" /* ms */,
"browser.tabs.remote.warmingUnloadDelayMs", 2000);
"browser.tabs.remote.warmup.unloadDelayMs", 2000);
// If we minimized the window before the switcher was activated,
// we might have set the preserveLayers flag for the current
@ -4743,6 +4745,10 @@
},
canWarmTab(tab) {
if (!this.WARMING_ENABLED) {
return false;
}
// If the tab is not yet inserted, closing, not remote,
// crashed, already visible, or already requested, warming
// up the tab makes no sense.
@ -4788,25 +4794,27 @@
return;
}
let warmingState = "disqualified";
if (this.WARMING_ENABLED) {
let warmingState = "disqualified";
if (this.warmingTabs.has(tab)) {
let tabState = this.getTabState(tab);
if (tabState == this.STATE_LOADING) {
warmingState = "stillLoading";
} else if (tabState == this.STATE_LOADED) {
warmingState = "loaded";
if (this.warmingTabs.has(tab)) {
let tabState = this.getTabState(tab);
if (tabState == this.STATE_LOADING) {
warmingState = "stillLoading";
} else if (tabState == this.STATE_LOADED) {
warmingState = "loaded";
}
} else if (this.canWarmTab(tab)) {
warmingState = "notWarmed";
}
} else if (this.canWarmTab(tab)) {
warmingState = "notWarmed";
Services.telemetry
.getHistogramById("FX_TAB_SWITCH_REQUEST_TAB_WARMING_STATE")
.add(warmingState);
this.unwarmTab(tab);
}
Services.telemetry
.getHistogramById("FX_TAB_SWITCH_REQUEST_TAB_WARMING_STATE")
.add(warmingState);
this.unwarmTab(tab);
this._requestingTab = true;
this.logState("requestTab " + this.tinfo(tab));
this.startTabSwitch();