forked from mirrors/gecko-dev
This removes all the code for add-on performance watching from the perfmonitoring component. This should mean that for add-on compartments, we no longer trigger jank or CPOW monitoring in the JS engine. This should result in minor performance improvements. As a result, about:performance no longer reports on add-on performance (but still reports on web page performance). It also removes the AddonWatchers.jsm module and the related Nightly- only UI (disabled in the parent commit) and strings. This UI wasn't ready for release, there wasn't sufficient data it was creating value for users, and there was some evidence that it didn't always correctly identify the cause of performance issues, thus potentially leading to user confusion or annoyance. Removing it therefore seemed the right thing to do. MozReview-Commit-ID: LsRwuaUtq6L --HG-- extra : rebase_source : 92d4b775a7a7cbb5793e74eea471be81be974dda
47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
"use strict";
|
|
|
|
/**
|
|
* An API for being informed of slow tabs (content process scripts).
|
|
*/
|
|
|
|
const { utils: Cu, classes: Cc, interfaces: Ci } = Components;
|
|
const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
|
|
|
/**
|
|
* `true` if this is a content process, `false` otherwise.
|
|
*/
|
|
let isContent = Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT;
|
|
|
|
if (isContent) {
|
|
|
|
const { PerformanceWatcher } = Cu.import("resource://gre/modules/PerformanceWatcher.jsm", {});
|
|
|
|
let toMsg = function(alerts) {
|
|
let result = [];
|
|
for (let {source, details} of alerts) {
|
|
// Convert xpcom values to serializable data.
|
|
let serializableSource = {};
|
|
for (let k of ["groupId", "name", "windowId", "isSystem", "processId", "isContentProcess"]) {
|
|
serializableSource[k] = source[k];
|
|
}
|
|
|
|
let serializableDetails = {};
|
|
for (let k of ["reason", "highestJank", "highestCPOW"]) {
|
|
serializableDetails[k] = details[k];
|
|
}
|
|
result.push({source: serializableSource, details: serializableDetails});
|
|
}
|
|
return result;
|
|
}
|
|
|
|
PerformanceWatcher.addPerformanceListener({windowId: 0}, alerts => {
|
|
Services.cpmm.sendAsyncMessage("performancewatcher-propagate-notifications",
|
|
{windows: toMsg(alerts)}
|
|
);
|
|
});
|
|
|
|
}
|