Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- omni_ja_bak/chrome/toolkit/content/global/aboutPerformance.js 2010-01-01 00:00:00.000000000 +0200
- +++ omni_ja/chrome/toolkit/content/global/aboutPerformance.js 2019-05-07 18:58:41.345993002 +0300
- @@ -492,6 +492,8 @@
- },
- };
- +let sort = '';
- +
- var Control = {
- _openItems: new Set(),
- _removeSubtree(row) {
- @@ -636,6 +638,38 @@
- this._openItems = new Set();
- let counters = this._sortCounters(State.getCounters());
- + counters = counters.sort((a, b) => {
- + let res = a.name > b.name;
- + switch (sort) {
- + case 'memory_asc':
- + res = a.memory > b.memory;
- + break;
- + case 'memory_desc':
- + res = a.memory < b.memory;
- + break;
- + case 'type_asc':
- + res = a.type > b.type;
- + break;
- + case 'type_desc':
- + res = a.type < b.type;
- + break;
- + case 'name_asc':
- + res = a.name.toLowerCase() > b.name.toLowerCase();
- + break;
- + case 'name_desc':
- + res = a.name.toLowerCase() < b.name.toLowerCase();
- + break;
- + case 'cpu_asc':
- + res = this._computeEnergyImpact(a.dispatchesSincePrevious, a.durationSincePrevious) >
- + this._computeEnergyImpact(b.dispatchesSincePrevious, b.durationSincePrevious)
- + break;
- + case 'cpu_desc':
- + res = this._computeEnergyImpact(a.dispatchesSincePrevious, a.durationSincePrevious) <
- + this._computeEnergyImpact(b.dispatchesSincePrevious, b.durationSincePrevious)
- + break;
- + }
- + return res;
- + });
- for (let {id, name, image, type, totalDispatches, dispatchesSincePrevious,
- memory, totalDuration, durationSincePrevious, children} of counters) {
- let row =
- @@ -745,6 +779,25 @@
- },
- };
- +document.addEventListener('DOMContentLoaded', () => {
- + document.querySelector('td[data-l10n-id=column-type]').addEventListener('click', async () => {
- + sort = sort === 'type_desc' ? 'type_asc' : 'type_desc';
- + await Control._updateDisplay(true);
- + });
- + document.querySelector('td[data-l10n-id=column-energy-impact]').addEventListener('click', async () => {
- + sort = sort === 'cpu_desc' ? 'cpu_asc' : 'cpu_desc';
- + await Control._updateDisplay(true);
- + });
- + document.querySelector('td[data-l10n-id=column-memory]').addEventListener('click', async () => {
- + sort = sort === 'memory_desc' ? 'memory_asc' : 'memory_desc';
- + await Control._updateDisplay(true);
- + });
- + document.querySelector('td[data-l10n-id=column-name]').addEventListener('click', async () => {
- + sort = sort === 'name_desc' ? 'name_asc' : 'name_desc';
- + await Control._updateDisplay(true);
- + });
- +});
- +
- var go = async function() {
- Control.init();
Advertisement
Add Comment
Please, Sign In to add comment