bug 1373728 - Count how many pinned tabs are restored in a session r?Dexter r?bsmedberg
Pinned tabs, when restored, load. This can have startup impact.
We should probably measure this.
To avoid impacting startup ourselves, do this when idle or after 60s from
session restore, whichever comes first.
MozReview-Commit-ID: EQzqqcz4IdL
--- a/browser/components/sessionstore/nsSessionStartup.js
+++ b/browser/components/sessionstore/nsSessionStartup.js
@@ -151,16 +151,26 @@ SessionStartup.prototype = {
if (this._initialState == null) {
// No valid session found.
this._sessionType = Ci.nsISessionStartup.NO_SESSION;
Services.obs.notifyObservers(null, "sessionstore-state-finalized");
gOnceInitializedDeferred.resolve();
return;
}
+ let initialState = this._initialState;
+ Services.tm.idleDispatchToMainThread(() => {
+ let pinnedTabCount = initialState.windows.reduce((winAcc, win) => {
+ return winAcc + win.tabs.reduce((tabAcc, tab) => {
+ return tabAcc + (tab.pinned ? 1 : 0);
+ }, 0);
+ }, 0);
+ Services.telemetry.scalarSet("browser.engagement.restored_pinned_tabs_count", pinnedTabCount);
+ }, 60000);
+
let shouldResumeSessionOnce = Services.prefs.getBoolPref("browser.sessionstore.resume_session_once");
let shouldResumeSession = shouldResumeSessionOnce ||
Services.prefs.getIntPref("browser.startup.page") == BROWSER_STARTUP_RESUME_SESSION;
// If this is a normal restore then throw away any previous session
if (!shouldResumeSessionOnce && this._initialState) {
delete this._initialState.lastSessionState;
}
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -137,16 +137,29 @@ browser.engagement:
expires: never
kind: uint
notification_emails:
- rweiss@mozilla.com
release_channel_collection: opt-out
record_in_processes:
- 'main'
+ restored_pinned_tabs_count:
+ bug_numbers:
+ - 1373728
+ description: >
+ The count of the number of pinned tabs that were restored.
+ expires: '62'
+ kind: uint
+ notification_emails:
+ - chutten@mozilla.com
+ release_channel_collection: opt-out
+ record_in_processes:
+ - 'main'
+
# The following section contains the browser engagement scalars.
browser.engagement.navigation:
urlbar:
bug_numbers:
- 1271313
description: >
The count URI loads triggered in a subsession from the urlbar (awesomebar),
broken down by the originating action.