Skip to content

Commit

Permalink
#444, #334: retune session store; remove telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
classilla committed Dec 16, 2017
1 parent 433aae5 commit 96e1bd0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
10 changes: 5 additions & 5 deletions browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ pref("browser.sessionstore.resume_from_crash", true);
pref("browser.sessionstore.resume_session_once", false);

// minimal interval between two save operations in milliseconds
pref("browser.sessionstore.interval", 25000);
pref("browser.sessionstore.interval", 30000);
// on which sites to save text data, POSTDATA and cookies
// 0 = everywhere, 1 = unencrypted sites, 2 = nowhere
pref("browser.sessionstore.privacy_level", 0);
Expand All @@ -1026,9 +1026,9 @@ pref("browser.sessionstore.max_windows_undo", 2);
// (this pref has no effect if more than 6 hours have passed since the last crash)
pref("browser.sessionstore.max_resumed_crashes", 1);
// number of back button session history entries to restore (-1 = all of them)
pref("browser.sessionstore.max_serialize_back", 10);
pref("browser.sessionstore.max_serialize_back", 5);
// number of forward button session history entries to restore (-1 = all of them)
pref("browser.sessionstore.max_serialize_forward", -1);
pref("browser.sessionstore.max_serialize_forward", 5);
// restore_on_demand overrides MAX_CONCURRENT_TAB_RESTORES (sessionstore constant)
// and restore_hidden_tabs. When true, tabs will not be restored until they are
// focused (also applies to tabs that aren't visible). When false, the values
Expand All @@ -1051,8 +1051,8 @@ pref("browser.sessionstore.debug", false);
// browser tabs that were not caused by a flush from the parent.
// This is a testing flag and should not be used by end-users.
pref("browser.sessionstore.debug.no_auto_updates", false);
// Forget closed windows/tabs after two weeks
pref("browser.sessionstore.cleanup.forget_closed_after", 1209600000);
// Forget closed windows/tabs after 24 hours
pref("browser.sessionstore.cleanup.forget_closed_after", 86400000);

// allow META refresh by default
pref("accessibility.blockautorefresh", false);
Expand Down
30 changes: 17 additions & 13 deletions browser/components/sessionstore/SessionStore.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ var SessionStoreInternal = {
throw new Error("SessionStore.init() must only be called once!");
}

TelemetryTimestamps.add("sessionRestoreInitialized");
//TelemetryTimestamps.add("sessionRestoreInitialized");
OBSERVING.forEach(function(aTopic) {
Services.obs.addObserver(this, aTopic, true);
}, this);
Expand All @@ -519,7 +519,7 @@ var SessionStoreInternal = {
* Initialize the session using the state provided by SessionStartup
*/
initSession: function () {
TelemetryStopwatch.start("FX_SESSION_RESTORE_STARTUP_INIT_SESSION_MS");
//TelemetryStopwatch.start("FX_SESSION_RESTORE_STARTUP_INIT_SESSION_MS");
let state;
let ss = gSessionStartup;

Expand Down Expand Up @@ -593,7 +593,7 @@ var SessionStoreInternal = {
this._prefBranch.getBoolPref("sessionstore.resume_session_once"))
this._prefBranch.setBoolPref("sessionstore.resume_session_once", false);

TelemetryStopwatch.finish("FX_SESSION_RESTORE_STARTUP_INIT_SESSION_MS");
//TelemetryStopwatch.finish("FX_SESSION_RESTORE_STARTUP_INIT_SESSION_MS");
return state;
},

Expand Down Expand Up @@ -743,7 +743,7 @@ var SessionStoreInternal = {

// Record telemetry measurements done in the child and update the tab's
// cached state. Mark the window as dirty and trigger a delayed write.
this.recordTelemetry(aMessage.data.telemetry);
//this.recordTelemetry(aMessage.data.telemetry);
TabState.update(browser, aMessage.data);
this.saveStateDelayed(win);

Expand Down Expand Up @@ -874,9 +874,11 @@ var SessionStoreInternal = {
* value to be recorded for that ID,
*/
recordTelemetry: function (telemetry) {
/*
for (let histogramId in telemetry){
Telemetry.getHistogramById(histogramId).add(telemetry[histogramId]);
}
*/
},

/* ........ Window Event Handlers .............. */
Expand Down Expand Up @@ -1025,7 +1027,7 @@ var SessionStoreInternal = {
// Nothing to restore now, notify observers things are complete.
Services.obs.notifyObservers(null, NOTIFY_WINDOWS_RESTORED, "");
} else {
TelemetryTimestamps.add("sessionRestoreRestoring");
//TelemetryTimestamps.add("sessionRestoreRestoring");
this._restoreCount = aInitialState.windows ? aInitialState.windows.length : 0;

// global data must be restored before restoreWindow is called so that
Expand Down Expand Up @@ -1188,9 +1190,9 @@ var SessionStoreInternal = {
if (initialState) {
Services.obs.notifyObservers(null, NOTIFY_RESTORING_ON_STARTUP, "");
}
TelemetryStopwatch.start("FX_SESSION_RESTORE_STARTUP_ONLOAD_INITIAL_WINDOW_MS");
//TelemetryStopwatch.start("FX_SESSION_RESTORE_STARTUP_ONLOAD_INITIAL_WINDOW_MS");
this.initializeWindow(aWindow, initialState);
TelemetryStopwatch.finish("FX_SESSION_RESTORE_STARTUP_ONLOAD_INITIAL_WINDOW_MS");
//TelemetryStopwatch.finish("FX_SESSION_RESTORE_STARTUP_ONLOAD_INITIAL_WINDOW_MS");

// Let everyone know we're done.
this._deferredInitialized.resolve();
Expand Down Expand Up @@ -2675,7 +2677,7 @@ var SessionStoreInternal = {

var activeWindow = this._getMostRecentBrowserWindow();

TelemetryStopwatch.start("FX_SESSION_RESTORE_COLLECT_ALL_WINDOWS_DATA_MS");
//TelemetryStopwatch.start("FX_SESSION_RESTORE_COLLECT_ALL_WINDOWS_DATA_MS");
if (RunState.isRunning) {
// update the data for all windows with activities since the last save operation
this._forEachBrowserWindow(function(aWindow) {
Expand All @@ -2690,7 +2692,7 @@ var SessionStoreInternal = {
});
DirtyWindows.clear();
}
TelemetryStopwatch.finish("FX_SESSION_RESTORE_COLLECT_ALL_WINDOWS_DATA_MS");
//TelemetryStopwatch.finish("FX_SESSION_RESTORE_COLLECT_ALL_WINDOWS_DATA_MS");

// An array that at the end will hold all current window data.
var total = [];
Expand All @@ -2710,9 +2712,9 @@ var SessionStoreInternal = {
nonPopupCount++;
}

TelemetryStopwatch.start("FX_SESSION_RESTORE_COLLECT_COOKIES_MS");
//TelemetryStopwatch.start("FX_SESSION_RESTORE_COLLECT_COOKIES_MS");
SessionCookies.update(total);
TelemetryStopwatch.finish("FX_SESSION_RESTORE_COLLECT_COOKIES_MS");
//TelemetryStopwatch.finish("FX_SESSION_RESTORE_COLLECT_COOKIES_MS");

// collect the data for all windows yet to be restored
for (ix in this._statesToRestore) {
Expand Down Expand Up @@ -2877,7 +2879,7 @@ var SessionStoreInternal = {
if (aWindow && (!aWindow.__SSi || !this._windows[aWindow.__SSi]))
this.onLoad(aWindow);

TelemetryStopwatch.start("FX_SESSION_RESTORE_RESTORE_WINDOW_MS");
//TelemetryStopwatch.start("FX_SESSION_RESTORE_RESTORE_WINDOW_MS");

// We're not returning from this before we end up calling restoreTabs
// for this window, so make sure we send the SSWindowStateBusy event.
Expand Down Expand Up @@ -3031,7 +3033,7 @@ var SessionStoreInternal = {
// set smoothScroll back to the original value
tabstrip.smoothScroll = smoothScroll;

TelemetryStopwatch.finish("FX_SESSION_RESTORE_RESTORE_WINDOW_MS");
//TelemetryStopwatch.finish("FX_SESSION_RESTORE_RESTORE_WINDOW_MS");

this._setWindowStateReady(aWindow);

Expand Down Expand Up @@ -4146,13 +4148,15 @@ var SessionStoreInternal = {
* Handle an error report from a content process.
*/
reportInternalError(data) {
/*
// For the moment, we only report errors through Telemetry.
if (data.telemetry) {
for (let key of Object.keys(data.telemetry)) {
let histogram = Telemetry.getHistogramById(key);
histogram.add(data.telemetry[key]);
}
}
*/
}
};

Expand Down
2 changes: 2 additions & 0 deletions xpcom/base/CycleCollectedJSRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,9 @@ IncrementalFinalizeRunnable::Run()
return NS_OK;
}

#if(0)
TimeStamp start = TimeStamp::Now();
#endif
ReleaseNow(true);

if (mDeferredFinalizeFunctions.Length()) {
Expand Down

0 comments on commit 96e1bd0

Please sign in to comment.