Backed out changeset ec64ea9b1249 (bug 1360916) for failing browser_sessionStorage_size.js. r=backout

This commit is contained in:
Sebastian Hengst 2017-05-03 00:25:07 +02:00
Родитель 4183907e15
Коммит d462b93aeb
4 изменённых файлов: 56 добавлений и 29 удалений

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

@ -858,8 +858,9 @@ var SessionStoreInternal = {
return; return;
} }
// Update the tab's cached state. // Record telemetry measurements done in the child and update the tab's
// Mark the window as dirty and trigger a delayed write. // cached state. Mark the window as dirty and trigger a delayed write.
this.recordTelemetry(aMessage.data.telemetry);
TabState.update(browser, aMessage.data); TabState.update(browser, aMessage.data);
this.saveStateDelayed(win); this.saveStateDelayed(win);
@ -972,6 +973,7 @@ var SessionStoreInternal = {
this._crashedBrowsers.delete(browser.permanentKey); this._crashedBrowsers.delete(browser.permanentKey);
break; break;
case "SessionStore:error": case "SessionStore:error":
this.reportInternalError(data);
TabStateFlusher.resolveAll(browser, false, "Received error from the content process"); TabStateFlusher.resolveAll(browser, false, "Received error from the content process");
break; break;
default: default:
@ -979,6 +981,18 @@ var SessionStoreInternal = {
} }
}, },
/**
* Record telemetry measurements stored in an object.
* @param telemetry
* {histogramID: value, ...} An object mapping histogramIDs to the
* value to be recorded for that ID,
*/
recordTelemetry(telemetry) {
for (let histogramId in telemetry) {
Telemetry.getHistogramById(histogramId).add(telemetry[histogramId]);
}
},
/* ........ Window Event Handlers .............. */ /* ........ Window Event Handlers .............. */
/** /**
@ -4720,6 +4734,19 @@ var SessionStoreInternal = {
this._browserEpochs.delete(browser.permanentKey); this._browserEpochs.delete(browser.permanentKey);
}, },
/**
* 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]);
}
}
},
/** /**
* Countdown for a given duration, skipping beats if the computer is too busy, * Countdown for a given duration, skipping beats if the computer is too busy,
* sleeping or otherwise unavailable. * sleeping or otherwise unavailable.

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

@ -15,9 +15,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://gre/modules/Timer.jsm", this); Cu.import("resource://gre/modules/Timer.jsm", this);
Cu.import("resource://gre/modules/Services.jsm", this); Cu.import("resource://gre/modules/Services.jsm", this);
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
"resource://gre/modules/TelemetryStopwatch.jsm");
function debug(msg) { function debug(msg) {
Services.console.logStringMessage("SessionStoreContent: " + msg); Services.console.logStringMessage("SessionStoreContent: " + msg);
} }
@ -660,8 +657,8 @@ var SessionStorageListener = {
} }
let size = this.estimateStorageSize(collected); let size = this.estimateStorageSize(collected);
Services.telemetry.getHistogramById("FX_SESSION_RESTORE_DOM_STORAGE_SIZE_ESTIMATE_CHARS").add(size);
MessageQueue.push("telemetry", () => ({ FX_SESSION_RESTORE_DOM_STORAGE_SIZE_ESTIMATE_CHARS: size }));
if (size > Preferences.get("browser.sessionstore.dom_storage_limit", DOM_STORAGE_MAX_CHARS)) { if (size > Preferences.get("browser.sessionstore.dom_storage_limit", DOM_STORAGE_MAX_CHARS)) {
// Rather than keeping the old storage, which wouldn't match the rest // Rather than keeping the old storage, which wouldn't match the rest
// of the state of the page, empty the storage. DOM storage will be // of the state of the page, empty the storage. DOM storage will be
@ -829,39 +826,42 @@ var MessageQueue = {
} }
let flushID = (options && options.flushID) || 0; let flushID = (options && options.flushID) || 0;
let histID = "FX_SESSION_RESTORE_CONTENT_COLLECT_DATA_MS";
let durationMs = Date.now();
let data = {}; let data = {};
let telemetry = {};
for (let [key, func] of this._data) { for (let [key, func] of this._data) {
if (key != "isPrivate") {
TelemetryStopwatch.startKeyed(histID, key);
}
let value = func(); let value = func();
if (key == "telemetry") {
if (key != "isPrivate") { for (let histogramId of Object.keys(value)) {
TelemetryStopwatch.finishKeyed(histID, key); telemetry[histogramId] = value[histogramId];
} }
} else if (value || (key != "storagechange" && key != "historychange")) {
if (value || (key != "storagechange" && key != "historychange")) {
data[key] = value; data[key] = value;
} }
} }
this._data.clear(); this._data.clear();
durationMs = Date.now() - durationMs;
telemetry.FX_SESSION_RESTORE_CONTENT_COLLECT_DATA_LONGEST_OP_MS = durationMs;
try { try {
// Send all data to the parent process. // Send all data to the parent process.
sendAsyncMessage("SessionStore:update", { sendAsyncMessage("SessionStore:update", {
data, flushID, data, telemetry, flushID,
isFinal: options.isFinal || false, isFinal: options.isFinal || false,
epoch: gCurrentEpoch epoch: gCurrentEpoch
}); });
} catch (ex) { } catch (ex) {
if (ex && ex.result == Cr.NS_ERROR_OUT_OF_MEMORY) { if (ex && ex.result == Cr.NS_ERROR_OUT_OF_MEMORY) {
Services.telemetry.getHistogramById("FX_SESSION_RESTORE_SEND_UPDATE_CAUSED_OOM").add(1); sendAsyncMessage("SessionStore:error", {
sendAsyncMessage("SessionStore:error"); telemetry: {
} FX_SESSION_RESTORE_SEND_UPDATE_CAUSED_OOM: 1
}
});
}
} }
}, },
}; };

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

@ -5648,15 +5648,13 @@
"n_buckets": 10, "n_buckets": 10,
"description": "Session restore: Time to collect all window and tab data (ms)" "description": "Session restore: Time to collect all window and tab data (ms)"
}, },
"FX_SESSION_RESTORE_CONTENT_COLLECT_DATA_MS": { "FX_SESSION_RESTORE_CONTENT_COLLECT_DATA_LONGEST_OP_MS": {
"alert_emails": ["session-restore-telemetry-alerts@mozilla.com", "mdeboer@mozilla.com"], "alert_emails": ["session-restore-telemetry-alerts@mozilla.com"],
"expires_in_version": "60", "expires_in_version": "default",
"kind": "exponential", "kind": "exponential",
"keyed": true,
"high": 30000, "high": 30000,
"n_buckets": 20, "n_buckets": 10,
"bug_numbers": [1360916], "description": "Session restore: Duration of the longest uninterruptible operation while collecting data in the content process (ms)"
"description": "Session restore: Duration of data collection in the content process (ms). Possible keys currently are: historychange, scroll, formdata, pageStyle, disallow, storage, storagechange."
}, },
"FX_SESSION_RESTORE_PRIVACY_LEVEL": { "FX_SESSION_RESTORE_PRIVACY_LEVEL": {
"alert_emails": ["session-restore-telemetry-alerts@mozilla.com"], "alert_emails": ["session-restore-telemetry-alerts@mozilla.com"],

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

@ -941,6 +941,7 @@
"FX_SESSION_RESTORE_AUTO_RESTORE_DURATION_UNTIL_EAGER_TABS_RESTORED_MS", "FX_SESSION_RESTORE_AUTO_RESTORE_DURATION_UNTIL_EAGER_TABS_RESTORED_MS",
"FX_SESSION_RESTORE_COLLECT_ALL_WINDOWS_DATA_MS", "FX_SESSION_RESTORE_COLLECT_ALL_WINDOWS_DATA_MS",
"FX_SESSION_RESTORE_COLLECT_DATA_MS", "FX_SESSION_RESTORE_COLLECT_DATA_MS",
"FX_SESSION_RESTORE_CONTENT_COLLECT_DATA_LONGEST_OP_MS",
"FX_SESSION_RESTORE_CORRUPT_FILE", "FX_SESSION_RESTORE_CORRUPT_FILE",
"FX_SESSION_RESTORE_DOM_STORAGE_SIZE_ESTIMATE_CHARS", "FX_SESSION_RESTORE_DOM_STORAGE_SIZE_ESTIMATE_CHARS",
"FX_SESSION_RESTORE_FILE_SIZE_BYTES", "FX_SESSION_RESTORE_FILE_SIZE_BYTES",
@ -1749,6 +1750,7 @@
"MOZ_SQLITE_OTHER_READ_B", "MOZ_SQLITE_OTHER_READ_B",
"CHECK_JAVA_ENABLED", "CHECK_JAVA_ENABLED",
"TRANSLATION_OPPORTUNITIES", "TRANSLATION_OPPORTUNITIES",
"FX_SESSION_RESTORE_CONTENT_COLLECT_DATA_LONGEST_OP_MS",
"NEWTAB_PAGE_BLOCKED_SITES_COUNT", "NEWTAB_PAGE_BLOCKED_SITES_COUNT",
"FX_SESSION_RESTORE_NUMBER_OF_TABS_RESTORED", "FX_SESSION_RESTORE_NUMBER_OF_TABS_RESTORED",
"WEAVE_START_COUNT", "WEAVE_START_COUNT",