Closed
Bug 674158
Opened 13 years ago
Closed 13 years ago
OOify aboutMemory.js
Categories
(Toolkit :: about:memory, defect)
Toolkit
about:memory
Tracking
()
RESOLVED
FIXED
mozilla8
People
(Reporter: n.nethercote, Assigned: n.nethercote)
Details
Attachments
(1 file)
31.65 KB,
patch
|
Dolske
:
review+
|
Details | Diff | Splinter Review |
aboutMemory.js is written in a very imperative style. This makes it hard to read, particularly because there are three similar but different object types used to represent different kinds of memory reporters. This patch makes aboutMemory.js more object-oriented, which makes the object types clearer. This is preliminary work that will allow aboutMemory.js to be made simpler and consume less memory (which perturbs the measurements). This patch also increases the amount of sanity checking done, asserting (throwing exceptions) in more cases.
Attachment #548365 -
Flags: review?(dolske)
Assignee | ||
Comment 1•13 years ago
|
||
dolske: any idea when you'll have a chance to review?
Comment 2•13 years ago
|
||
Comment on attachment 548365 [details] [diff] [review] patch Review of attachment 548365 [details] [diff] [review]: ----------------------------------------------------------------- Sorry for the delay here. ::: toolkit/components/aboutmemory/content/aboutMemory.js @@ +156,5 @@ > + this._amount += r._amount; > + } else if (this._amount === kUnknown && r._amount !== kUnknown) { > + this._amount = r._amount; > + } > + this._nMerged = this._nMerged ? this._nMerged + 1 : 2; Can r._nMerged ever be nonzero? @@ +292,5 @@ > + > +TreeNode.prototype = { > + findKid: function(aName) { > + for (var i = 0; i < this._kids.length; i++) { > + if (this._kids[i]._name === aName) { I guess this is just rectoring, but why strict-equality here?
Attachment #548365 -
Flags: review?(dolske) → review+
Assignee | ||
Comment 3•13 years ago
|
||
(In reply to Justin Dolske [:Dolske] from comment #2) > ::: toolkit/components/aboutmemory/content/aboutMemory.js > @@ +156,5 @@ > > + this._amount += r._amount; > > + } else if (this._amount === kUnknown && r._amount !== kUnknown) { > > + this._amount = r._amount; > > + } > > + this._nMerged = this._nMerged ? this._nMerged + 1 : 2; > > Can r._nMerged ever be nonzero? Yes, if there are 3 or more reporters with the same path. > @@ +292,5 @@ > > + > > +TreeNode.prototype = { > > + findKid: function(aName) { > > + for (var i = 0; i < this._kids.length; i++) { > > + if (this._kids[i]._name === aName) { > > I guess this is just rectoring, but why strict-equality here? I use it everywhere because Crockford recommends it and I think he's right on this one.
Comment 4•13 years ago
|
||
(In reply to Nicholas Nethercote [:njn] from comment #3) > > > + this._nMerged = this._nMerged ? this._nMerged + 1 : 2; > > > > Can r._nMerged ever be nonzero? > > Yes, if there are 3 or more reporters with the same path. Hmm, this shouldn't this code take that into account? It's only looking at this._nMerged, not r._nMerged. Maybe just call it ._numReporters (or whatever), have each init to 1 by default, and then blindly add them together here?
Assignee | ||
Comment 5•13 years ago
|
||
(In reply to Justin Dolske [:Dolske] from comment #4) > (In reply to Nicholas Nethercote [:njn] from comment #3) > > > > > + this._nMerged = this._nMerged ? this._nMerged + 1 : 2; > > > > > > Can r._nMerged ever be nonzero? > > > > Yes, if there are 3 or more reporters with the same path. > > Hmm, this shouldn't this code take that into account? It's only looking at > this._nMerged, not r._nMerged. Oh, I see. Sorry, r._nMerged cannot be non-zero. I'll add an assertion to that effect.
Assignee | ||
Comment 6•13 years ago
|
||
http://hg.mozilla.org/integration/mozilla-inbound/rev/48c58d9cc3f3
Whiteboard: [inbound]
Comment 7•13 years ago
|
||
Merged: http://hg.mozilla.org/mozilla-central/rev/48c58d9cc3f3
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla8
Version: unspecified → Trunk
You need to log in
before you can comment on or make changes to this bug.
Description
•