Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Dryice build #6

Merged
merged 14 commits into from
This page is out of date. Refresh to see the latest.
View
22 .gitignore
@@ -0,0 +1,22 @@
+
+# Build artifacts
+/release
+/ccdump.xpi
+
+# Junk that could exist anywhere:
+.DS_Store
+*.swp
+*.tmp
+.*.gz
+
+# Editor junk
+/.project
+/.pydevproject
+/.settings/
+/.settings.xml
+/.settings.xml.old
+/.idea/
+
+# Manually installed node packages should be ignored
+/node_modules/
+/.externalToolBuilders
View
95 build.js
@@ -0,0 +1,95 @@
+
+var copy = require('dryice').copy;
+var fs = require('fs');
+var os = require('os');
+var spawn = require('child_process').spawn;
+var shell = require('shelljs');
+
+var release = __dirname + '/release';
+
+shell.rm('-rf', 'release');
+
+copy.mkdirSync(release + '/content', 0755);
+copy({
+ source: {
+ root: __dirname + '/content',
+ include: [ /.*\.html$/ ]
+ },
+ dest: release + '/content'
+});
+
+copy({
+ source: [ copy.getMiniRequire() ],
+ dest: release + '/loader.js'
+});
+
+var project = copy.createCommonJsProject({
+ roots: [ __dirname + '/content' ]
+});
+
+/**
+ * Munge define lines to add module names
+ */
+function moduleDefines(input, source) {
+ input = (typeof input !== 'string') ? input.toString() : input;
+ var deps = source.deps ? Object.keys(source.deps) : [];
+ deps = deps.length ? (", '" + deps.join("', '") + "'") : "";
+ var module = source.isLocation ? source.path : source;
+ module = module.replace(/\.js$/, '');
+ return input.replace(/define\(\[/, 'define("' + module + '", [');
+};
+moduleDefines.onRead = true;
+
+copy({
+ source: [
+ copy.getMiniRequire(),
+ {
+ project: project,
+ require: [
+ 'lib/tabView', 'lib/lib', 'lib/trace', 'tabs/homeTab', 'tabs/aboutTab',
+ 'app/analyzer', 'app/tabNavigator', 'lib/options',
+ ]
+ },
+ __dirname + '/content/main.js'
+ ],
+ filter: moduleDefines,
+ dest: release + '/content/main.js'
+});
+console.log(project.report());
+
+copy.mkdirSync(release + '/skin', 0755);
+copy({
+ source: {
+ root: __dirname + '/skin',
+ include: [ /.*\.css$/, /.*\.gif$/, /.*\.png$/ ]
+ },
+ dest: release + '/skin'
+});
+
+copy({
+ source: [ 'bootstrap.js', 'license.txt', 'README.md', 'app.properties' ],
+ dest: release
+});
+
+var packageFile = fs.readFileSync(__dirname + '/package.json', 'utf8');
+var version = JSON.parse(packageFile).version;
+copy({
+ source: [ 'install.rdf' ],
+ filter: function(data) {
+ return data.toString().replace(/@VERSION@/, version);
+ },
+ dest: release
+});
+
+var zip;
+if (os.platform() === 'win32') {
+ var params = 'a -tzip ../ccdump.xpi skin content bootstrap.js license.txt README.md install.rdf app.properties';
+ zip = spawn('7z.exe', params.split(' '), { cwd: release });
+}
+else {
+ zip = spawn('zip', [ '-r', __dirname + '/ccdump.xpi', release ]);
+}
+
+zip.on("exit", function() {
+ //shell.rm('-rf', 'release');
+});
View
22 content/app/analyzer.js
@@ -171,8 +171,9 @@ Analyzer.prototype =
getDocuments: function()
{
var result = [];
- for each (var o in this.graph)
+ for (var i = 0; i < this.graph.length; i++)
{
+ var o = this.graph[i];
if (!o.garbage && o.name.indexOf("nsDocument ") >= 0)
result.push(o);
}
@@ -182,8 +183,9 @@ Analyzer.prototype =
getRoots: function()
{
var collectedRoots = {};
- for each (var o in this.roots)
+ for (var i = 0; i < this.roots.length; i++)
{
+ var o = this.roots[i];
var res = [];
this.getChildObjects(o, res, ++searchGeneration);
collectedRoots[o.address] = res;
@@ -209,8 +211,10 @@ Analyzer.prototype =
o._searchMark = searchGen;
res.push(o);
- for each (var edge in o.edges)
+ for (var i = 0; i < o.edges.length; i++) {
+ var edge = o.edges[i];
this.getChildObjects(edge.to, res, searchGen);
+ }
},
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -235,8 +239,10 @@ Analyzer.prototype =
if (o.root)
res.push(o);
- for each (var owner in o.owners)
+ for (var i = 0; i < o.owners.length; i++) {
+ var owner = o.owners[i];
this.getRootObjects(owner.from, res, searchGen);
+ }
},
findGraph: function(addr)
@@ -258,11 +264,15 @@ Analyzer.prototype =
o._searchMark = searchGen;
res.push(o);
- for each (var edge in o.edges)
+ for (var i = 0; i < o.edges.length; i++) {
+ var edge = o.edges[i];
this.getObjectGraph(edge.to, res, searchGen);
+ }
- for each (var owner in o.owners)
+ for (var i = 0; i < o.owners.length; i++) {
+ var owner = o.owners[i];
this.getObjectGraph(owner.from, res, searchGen);
+ }
return res;
}
View
37 content/app/graphSerializer.js
@@ -113,7 +113,7 @@ var GraphSerializer =
serializeGraph: function(graph)
{
var s = "";
- for each (var o in graph)
+ for (var o in graph)
s += this.serializeObject(o) + "\n" + this.getEdges(o);
return s;
},
@@ -121,8 +121,11 @@ var GraphSerializer =
getEdges: function(o)
{
var s = "";
- for each (var e in o.edges)
+ for (var i=0; i<o.edges.length; i++)
+ {
+ var e = o.edges[i];
s += " > " + e.to.address + " " + e.name + "\n";
+ }
return s;
},
@@ -133,7 +136,7 @@ var GraphSerializer =
{
var log = {};
log.graph = {};
- for each (var o in analyzer.graph)
+ for (var o in analyzer.graph)
{
var obj = o.clone();
log.graph[obj.address] = obj;
@@ -158,16 +161,23 @@ var GraphSerializer =
}
log.roots = [];
- for each (var o in analyzer.roots)
+ for (var i=0; i<analyzer.roots.length; i++)
+ {
+ var o = analyzer.roots[i];
log.roots.push(o.address);
+ }
log.garbage = [];
- for each (var o in analyzer.garbage)
+ for (var i=0; i<analyzer.garbage.length; i++)
+ {
+ var o = analyzer.garbage[i];
log.garbage.push(o.address);
+ }
log.edges = [];
- for each (var o in analyzer.edges)
+ for (var i=0; i<analyzer.edges.length; i++)
{
+ var o = analyzer.edges[i];
log.edges.push({
name: o.name,
from: o.from.address,
@@ -183,7 +193,7 @@ var GraphSerializer =
analyzer.clear();
var log = JSON.parse(jsonString);
- for each (var o in log.graph)
+ for (var o in log.graph)
{
var obj = analyzer.ensureObject(o.address);
for (p in o)
@@ -204,14 +214,21 @@ var GraphSerializer =
}
}
- for each (var o in log.roots)
+ for (var i=0; i<log.roots.length; i++)
+ {
+ var o = log.roots[i];
analyzer.roots.push(analyzer.ensureObject(o));
+ }
- for each (var o in log.garbage)
+ for (var i=0; i<log.garbage.length; i++)
+ {
+ var o = log.garbage[i];
analyzer.garbage.push(analyzer.ensureObject(o));
+ }
- for each (var o in log.edges)
+ for (var i=0; i<log.edges.length; i++)
{
+ var o = log.edges[i];
analyzer.edges.push({
name: o.name,
from: analyzer.ensureObject(o.from),
View
3  content/app/objectFinder.js
@@ -33,8 +33,9 @@ ObjectFinder.prototype =
var regex = new RegExp(text);
var result = [];
- for each (var o in this.graph)
+ for (var address in this.graph)
{
+ var o = this.graph[address];
var name = o.name;
var address = o.address;
View
10 content/app/objectGraphGenerator.js
@@ -47,11 +47,17 @@ ObjectGraphGenerator.prototype =
// Just counting number of objects in the sub-graph
this.counter++;
- for each (var owner in o.owners)
+ for (var i=0; i<o.owners.length; i++)
+ {
+ var owner = o.owners[i];
this.getObjectGraph(owner.from, owner.name ? owner.name : "<unknown-owner>", obj);
+ }
- for each (var edge in o.edges)
+ for (var i=0; i<o.edges.length; i++)
+ {
+ var edge = o.edges[i];
this.getObjectGraph(edge.to, edge.name ? edge.name : "<unknown-edge>", obj);
+ }
},
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
View
20 content/app/objectGraphPathFinder.js
@@ -142,11 +142,17 @@ ObjectGraphPathFinder.prototype =
{
var result = [];
- for each (var owner in o.owners)
+ for (var i=0; i<o.owners.length; i++)
+ {
+ var owner = o.owners[i];
result.push(owner.from);
+ }
- for each (var edge in o.edges)
+ for (var i=0; i<o.edges.length; i++)
+ {
+ var edge = o.edges[i];
result.push(edge.to);
+ }
return result;
},
@@ -167,11 +173,17 @@ ObjectGraphPathFinder.prototype =
o._distance = Infinity;
o._previous = null;
- for each (var owner in o.owners)
+ for (var i=0; i<o.owners.length; i++)
+ {
+ var owner = o.owners[i];
this.getAllNodes(owner.from, nodes);
+ }
- for each (var edge in o.edges)
+ for (var i=0; i<o.edges.length; i++)
+ {
+ var edge = o.edges[i];
this.getAllNodes(edge.to, nodes);
+ }
return nodes;
},
View
20 content/loader.js
@@ -3,7 +3,7 @@
// ********************************************************************************************* //
// Module Loader Implementation
-var require = (function() {
+var Loader = (function() {
// ********************************************************************************************* //
// Constants
@@ -17,8 +17,12 @@ Cu.import("resource://gre/modules/Services.jsm");
var Loader =
{
- config: null,
+ config: {
+ baseUrl: "resource://ccdump/content"
+ },
+
modules: {},
+ currentModule: [],
require: function(config, modules, callback)
{
@@ -36,8 +40,11 @@ var Loader =
define: function(modules, callback)
{
var args = [];
- for each (var id in modules)
+ for (var i=0; i<modules.length; i++)
+ {
+ var id = modules[i];
args.push(this.loadModule(id));
+ }
try
{
@@ -64,7 +71,7 @@ var Loader =
try
{
this.currentModule.push(module);
- var moduleUrl = config.baseUrl + "/" + moduleId + ".js";
+ var moduleUrl = this.config.baseUrl + "/" + moduleId + ".js";
Services.scriptloader.loadSubScript(moduleUrl, module.scope);
}
catch (err)
@@ -83,7 +90,10 @@ var Loader =
// ********************************************************************************************* //
-return Loader.require.bind(Loader);
+return Loader;
// ********************************************************************************************* //
})();
+
+var require = Loader.require.bind(Loader);
+var define = Loader.define.bind(Loader);
View
3  content/tabs/graphTab.js
@@ -207,8 +207,9 @@ GraphIterator.prototype =
this.callback(obj._o);
- for each (var child in obj)
+ for (var prop in obj)
{
+ var child = obj[prop];
if (child instanceof ObjectGraphGenerator.Object)
this._iterate(child);
}
View
3  content/tabs/homeTab.js
@@ -187,8 +187,9 @@ HomeTab.prototype = Lib.extend(BaseTab.prototype,
// Make sure the other tabs doesn't contain any references to the current graph.
// It would dramatically increase number of objects in the next CC graph.
- for each (var tab in this.tabView.tabs)
+ for (var i = 0; i < this.tabView.tabs.length; i++)
{
+ var tab = this.tabView.tabs[i];
if (tab != this)
tab.invalidate();
}
View
21 package.json
@@ -0,0 +1,21 @@
+{
+ "name": "ccdump",
+ "description": "The best Cycle Collector Analyzer Tool",
+ "version": "0.4.2",
+ "homepage" : "http://www.softwareishard.com/blog/ccdump",
+ "engines": {
+ "node": ">= 0.6.6"
+ },
+ "dependencies": {
+ "dryice": ">= 0.4.1",
+ "shelljs": ">= 0.0.2"
+ },
+ "author": "Jan Odvarko <odvarko@gmail.com>",
+ "repository" : {
+ "type" : "git",
+ "url" : "git://github.com/janodvarko/ccdump.git"
+ },
+ "licenses": [
+ { "type": "BSD", "url": "http://opensource.org/licenses/BSD-3-Clause" }
+ ]
+}
Something went wrong with that request. Please try again.