diff --git a/toolkit/components/aboutperformance/content/aboutPerformance.js b/toolkit/components/aboutperformance/content/aboutPerformance.js index e0d34128a39c..0693af318b11 100644 --- a/toolkit/components/aboutperformance/content/aboutPerformance.js +++ b/toolkit/components/aboutperformance/content/aboutPerformance.js @@ -14,8 +14,6 @@ const { PerformanceStats } = Cu.import("resource://gre/modules/PerformanceStats. const { Services } = Cu.import("resource://gre/modules/Services.jsm", {}); const { Task } = Cu.import("resource://gre/modules/Task.jsm", {}); const { ObjectUtils } = Cu.import("resource://gre/modules/ObjectUtils.jsm", {}); -const { Memory } = Cu.import("resource://gre/modules/Memory.jsm"); -const { DownloadUtils } = Cu.import("resource://gre/modules/DownloadUtils.jsm"); // about:performance observes notifications on this topic. // if a notification is sent, this causes the page to be updated immediately, @@ -944,123 +942,7 @@ var Control = { _displayMode: MODE_GLOBAL, }; -/** - * This functionality gets memory related information of sub-processes and - * updates the performance table regularly. - * If the page goes hidden, it also handles visibility change by not - * querying the content processes unnecessarily. - */ -var SubprocessMonitor = { - _timeout: null, - - /** - * Init will start the process of updating the table if the page is not hidden, - * and set up an event listener for handling visibility changes. - */ - init: function() { - if (!document.hidden) { - SubprocessMonitor.updateTable(); - } - document.addEventListener("visibilitychange", SubprocessMonitor.handleVisibilityChange); - }, - - /** - * This function updates the table after an interval if the page is visible - * and clears the interval otherwise. - */ - handleVisibilityChange: function() { - if (!document.hidden) { - SubprocessMonitor.queueUpdate(); - } else { - clearTimeout(this._timeout); - this._timeout = null; - } - }, - - /** - * This function queues a timer to request the next summary using updateTable - * after some delay. - */ - queueUpdate: function() { - this._timeout = setTimeout(() => this.updateTable(), UPDATE_INTERVAL_MS); - }, - - /** - * This is a helper function for updateTable, which updates a particular row. - * @param { node} row The row to be updated. - * @param {object} summaries The object with the updated RSS and USS values. - * @param {string} pid The pid represented by the row for which we update. - */ - updateRow: function(row, summaries, pid) { - row.cells[0].textContent = pid; - let RSSval = DownloadUtils.convertByteUnits(summaries[pid].rss); - row.cells[1].textContent = RSSval.join(" "); - let USSval = DownloadUtils.convertByteUnits(summaries[pid].uss); - row.cells[2].textContent = USSval.join(" "); - }, - - /** - * This function adds a row to the subprocess-performance table for every new pid - * and populates and regularly updates it with RSS/USS measurements. - */ - updateTable: function() { - if (!document.hidden) { - Memory.summary().then((summaries) => { - if (!(Object.keys(summaries).length)) { - // The summaries list was empty, which means we timed out getting - // the memory reports. We'll try again later. - SubprocessMonitor.queueUpdate(); - return; - } - let resultTable = document.getElementById("subprocess-reports"); - let recycle = []; - // We first iterate the table to check if summaries exist for rowPids, - // if yes, update them and delete the pid's summary or else hide the row - // for recycling it. Start at row 1 instead of 0 (to skip the header row). - for (let i = 1, row; row = resultTable.rows[i]; i++) { - let rowPid = row.dataset.pid; - let summary = summaries[rowPid]; - if (summary) { - // Now we update the values in the row, which is hardcoded for now, - // but we might want to make this more adaptable in the future. - SubprocessMonitor.updateRow(row, summaries, rowPid); - delete summaries[rowPid]; - } else { - // Take this unnecessary row, hide it and stash it for potential re-use. - row.hidden = true; - recycle.push(row); - } - } - // For the remaining pids in summaries, we choose from the recyclable - // (hidden) nodes, and if they get exhausted, append a row to the table. - for (let pid in summaries) { - let row = recycle.pop(); - if (row) { - row.hidden = false; - } else { - // We create a new row here, and set it to row - row = document.createElement("tr"); - // Insert cell for pid - row.insertCell(); - // Insert a cell for USS. - row.insertCell(); - // Insert another cell for RSS. - row.insertCell(); - } - row.dataset.pid = pid; - // Update the row and put it at the bottom - SubprocessMonitor.updateRow(row, summaries, pid); - resultTable.appendChild(row); - } - }); - SubprocessMonitor.queueUpdate(); - } - }, -}; - var go = Task.async(function*() { - - SubprocessMonitor.init(); Control.init(); // Setup a hook to allow tests to configure and control this page diff --git a/toolkit/components/aboutperformance/content/aboutPerformance.xhtml b/toolkit/components/aboutperformance/content/aboutPerformance.xhtml index 721320534b48..048b0905c106 100644 --- a/toolkit/components/aboutperformance/content/aboutPerformance.xhtml +++ b/toolkit/components/aboutperformance/content/aboutPerformance.xhtml @@ -7,21 +7,9 @@ about:performance - - -
-

Memory usage of Subprocesses

- - - - - - -
Process IDResident Set SizeUnique Set Size
-
diff --git a/toolkit/content/process-content.js b/toolkit/content/process-content.js index 2ff8f908a956..9262d0b7f90b 100644 --- a/toolkit/content/process-content.js +++ b/toolkit/content/process-content.js @@ -31,35 +31,15 @@ if (gInContentProcess) { init() { for (let topic of this.TOPICS) { Services.obs.addObserver(this, topic, false); - Services.cpmm.addMessageListener("Memory:GetSummary", this); } }, uninit() { for (let topic of this.TOPICS) { Services.obs.removeObserver(this, topic); - Services.cpmm.removeMessageListener("Memory:GetSummary", this); } }, - receiveMessage(msg) { - if (msg.name != "Memory:GetSummary") { - return; - } - let pid = Services.appinfo.processID; - let memMgr = Cc["@mozilla.org/memory-reporter-manager;1"] - .getService(Ci.nsIMemoryReporterManager); - let rss = memMgr.resident; - let uss = memMgr.residentUnique; - Services.cpmm.sendAsyncMessage("Memory:Summary", { - pid, - summary: { - uss, - rss, - } - }); - }, - observe(subject, topic, data) { switch (topic) { case "inner-window-destroyed": { diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build index 886a91f12dd3..677c80e7ea69 100644 --- a/toolkit/modules/moz.build +++ b/toolkit/modules/moz.build @@ -52,7 +52,6 @@ EXTRA_JS_MODULES += [ 'LoadContextInfo.jsm', 'Locale.jsm', 'Log.jsm', - 'Memory.jsm', 'NewTabUtils.jsm', 'NLP.jsm', 'ObjectUtils.jsm',