Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mullvad Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Mullvad Browser
Commits
961b9be5
Commit
961b9be5
authored
14 years ago
by
Shawn Wilsher
Browse files
Options
Downloads
Patches
Plain Diff
Bug 615978 - Make about:memory handle multiple reporters for the same thing.
r=Mossop
parent
e32a08f4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
toolkit/components/aboutmemory/content/aboutMemory.js
+29
-11
29 additions, 11 deletions
toolkit/components/aboutmemory/content/aboutMemory.js
with
29 additions
and
11 deletions
toolkit/components/aboutmemory/content/aboutMemory.js
+
29
−
11
View file @
961b9be5
...
...
@@ -15,7 +15,7 @@
* The Original Code is about:memory
*
* The Initial Developer of the Original Code is
*
Mozilla
Corpor
ation
*
the
Mozilla
Found
ation
.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
...
...
@@ -36,6 +36,9 @@
*
* ***** END LICENSE BLOCK ***** */
const
Cc
=
Components
.
classes
;
const
Ci
=
Components
.
interfaces
;
var
gMemReporters
=
{
};
function
$
(
n
)
{
...
...
@@ -115,6 +118,9 @@ function formatNumber(n) {
return
s
;
}
/**
* Updates the content of the document with the most current memory information.
*/
function
updateMemoryStatus
()
{
// if we have the standard reporters for mapped/allocated, put
...
...
@@ -125,11 +131,11 @@ function updateMemoryStatus()
// committed is the total amount of memory that we've touched, that is that we have
// some kind of backing store for
setTextContent
(
$
(
"
memMappedValue
"
),
formatNumber
(
gMemReporters
[
"
malloc/mapped
"
].
memoryUsed
));
formatNumber
(
gMemReporters
[
"
malloc/mapped
"
]
[
0
]
.
memoryUsed
));
// allocated is the amount of committed memory that we're actively using (i.e., that isn't free)
setTextContent
(
$
(
"
memInUseValue
"
),
formatNumber
(
gMemReporters
[
"
malloc/allocated
"
].
memoryUsed
));
formatNumber
(
gMemReporters
[
"
malloc/allocated
"
]
[
0
]
.
memoryUsed
));
}
else
{
$
(
"
memOverview
"
).
style
.
display
=
"
none
"
;
}
...
...
@@ -140,9 +146,16 @@ function updateMemoryStatus()
var
otherCount
=
0
;
for
each
(
var
rep
in
gMemReporters
)
{
var
row
=
makeTableRow
([
rep
.
path
,
rep
.
description
],
makeTableCell
(
formatNumber
(
rep
.
memoryUsed
),
"
memValue
"
));
for
each
(
var
reporters
in
gMemReporters
)
{
// There may be more than one reporter for each path. We take the sum
// of them all for each description.
var
total
=
0
;
reporters
.
forEach
(
function
(
reporter
)
{
total
+=
reporter
.
memoryUsed
;
});
var
row
=
makeTableRow
([
reporters
[
0
].
path
,
reporters
[
0
].
description
],
makeTableCell
(
formatNumber
(
total
),
"
memValue
"
));
mo
.
appendChild
(
row
);
...
...
@@ -155,18 +168,23 @@ function updateMemoryStatus()
}
}
/**
* Updates gMemReporters to contain all the known memory reporters.
*/
function
updateMemoryReporters
()
{
gMemReporters
=
[];
var
mgr
=
Components
.
classes
[
"
@mozilla.org/memory-reporter-manager;1
"
]
.
getService
(
Components
.
interfaces
.
nsIMemoryReporterManager
);
var
mgr
=
Cc
[
"
@mozilla.org/memory-reporter-manager;1
"
].
getService
(
Ci
.
nsIMemoryReporterManager
);
var
e
=
mgr
.
enumerateReporters
();
while
(
e
.
hasMoreElements
())
{
var
mr
=
e
.
getNext
().
QueryInterface
(
Components
.
interfaces
.
nsIMemoryReporter
);
gMemReporters
[
mr
.
path
]
=
mr
;
var
reporter
=
e
.
getNext
().
QueryInterface
(
Ci
.
nsIMemoryReporter
);
if
(
!
gMemReporters
[
reporter
.
path
])
{
gMemReporters
[
reporter
.
path
]
=
[];
}
gMemReporters
[
reporter
.
path
].
push
(
reporter
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment