Skip to content

Commit

Permalink
Merge pull request #3 from autonome/newer-versions-support
Browse files Browse the repository at this point in the history
support fx>=5
  • Loading branch information
pcwalton committed Aug 10, 2011
2 parents 9febaaf + 3fe58d0 commit 9371009
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions data/widget.js
Expand Up @@ -58,8 +58,8 @@ on('message', function(data) {
}

let sample = {
alloc: data['heap-used'],
js: data['explicit/js/gc-heap'],
alloc: data['heap-used'] || data['malloc/allocated'] || data['resident'],
js: data['explicit/js/gc-heap'] || data['js/gc-heap'] || data['js-gc-heap'],
gc: gcOccurred
};
samples.push(sample);
Expand Down
11 changes: 9 additions & 2 deletions lib/main.js
Expand Up @@ -10,7 +10,14 @@ const tabs = require('tabs');
const data = require('self').data;
const { Cc, Ci, Cu } = require('chrome');

const MEMORY_PATHS = { 'heap-used': true, 'explicit/js/gc-heap': true };
const MEMORY_PATHS = {
// Fx4 ?
'heap-used': true, 'explicit/js/gc-heap': true,
// Fx5
'malloc/allocated': true, 'js/gc-heap': true,
// Fx>=5
'resident': true, 'js-gc-heap': true
};

Cu.import("resource://gre/modules/Services.jsm", this);

Expand All @@ -34,7 +41,7 @@ let widgetUpdater = {
while (iter.hasMoreElements()) {
let reporter = iter.getNext().QueryInterface(Ci.nsIMemoryReporter);
if (MEMORY_PATHS[reporter.path])
data[reporter.path] = reporter.memoryUsed;
data[reporter.path] = reporter.memoryUsed || reporter.amount;
}

w.postMessage(data);
Expand Down

0 comments on commit 9371009

Please sign in to comment.