Bug 597403 Remove nsILeakDetector leftovers r=Callek
This commit is contained in:
Родитель
cf4dec783d
Коммит
2dea8712c0
|
@ -39,18 +39,11 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
var gLeakDetector = null;
|
|
||||||
var gLeakDetectorVerbose = false;
|
|
||||||
|
|
||||||
// "about:bloat" is available only when
|
// "about:bloat" is available only when
|
||||||
// (the application is) compiled with |--enable-logrefcnt|.
|
// (the application is) compiled with |--enable-logrefcnt|.
|
||||||
if ("@mozilla.org/network/protocol/about;1?what=bloat" in Components.classes)
|
if ("@mozilla.org/network/protocol/about;1?what=bloat" in Components.classes)
|
||||||
window.addEventListener("load", onLoadBloat, false);
|
window.addEventListener("load", onLoadBloat, false);
|
||||||
|
|
||||||
// The Leak Detector (class) can be undefined in a given (application) build.
|
|
||||||
if ("@mozilla.org/xpcom/leakdetector;1" in Components.classes)
|
|
||||||
window.addEventListener("load", onLoadLeakDetector, false);
|
|
||||||
|
|
||||||
// Unhide (and enable) the Bloat menu and its associated (shared) separator.
|
// Unhide (and enable) the Bloat menu and its associated (shared) separator.
|
||||||
function onLoadBloat()
|
function onLoadBloat()
|
||||||
{
|
{
|
||||||
|
@ -72,50 +65,3 @@ function onLoadBloat()
|
||||||
document.getElementById("bloatAndLeakSeparator").hidden = false;
|
document.getElementById("bloatAndLeakSeparator").hidden = false;
|
||||||
document.getElementById("bloatMenu").hidden = false;
|
document.getElementById("bloatMenu").hidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the Leak Detector,
|
|
||||||
// and unhide its menu and its associated (shared) separator.
|
|
||||||
function onLoadLeakDetector()
|
|
||||||
{
|
|
||||||
window.removeEventListener("load", onLoadLeakDetector, false);
|
|
||||||
|
|
||||||
// Ignore windows which don't get the Debug menu, like 'View Source'.
|
|
||||||
if (!document.getElementById("debugMenu"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
gLeakDetector = Components.classes["@mozilla.org/xpcom/leakdetector;1"]
|
|
||||||
.createInstance(Components.interfaces.nsILeakDetector);
|
|
||||||
|
|
||||||
document.getElementById("bloatAndLeakSeparator").hidden = false;
|
|
||||||
document.getElementById("leakMenu").hidden = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dumps current set of memory leaks.
|
|
||||||
function dumpMemoryLeaks()
|
|
||||||
{
|
|
||||||
gLeakDetector.dumpLeaks();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Traces all objects reachable from the chrome document.
|
|
||||||
function traceChrome()
|
|
||||||
{
|
|
||||||
gLeakDetector.traceObject(document, gLeakDetectorVerbose);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Traces all objects reachable from the content document.
|
|
||||||
function traceDocument()
|
|
||||||
{
|
|
||||||
// keep the chrome document out of the dump.
|
|
||||||
gLeakDetector.markObject(document, true);
|
|
||||||
gLeakDetector.traceObject(content, gLeakDetectorVerbose);
|
|
||||||
gLeakDetector.markObject(document, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Controls whether or not we do verbose tracing.
|
|
||||||
* @param verbose Either |"true"| or |""|.
|
|
||||||
*/
|
|
||||||
function traceVerbose(verbose)
|
|
||||||
{
|
|
||||||
gLeakDetectorVerbose = (verbose == "true");
|
|
||||||
}
|
|
||||||
|
|
|
@ -183,15 +183,6 @@
|
||||||
</menupopup>
|
</menupopup>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
<menu id="leakMenu" label="Leak Detector" hidden="true">
|
|
||||||
<menupopup>
|
|
||||||
<menuitem label="Dump Memory Leaks" oncommand="dumpMemoryLeaks();"/>
|
|
||||||
<menuitem label="Trace Chrome" oncommand="traceChrome();"/>
|
|
||||||
<menuitem label="Trace Document" oncommand="traceDocument();"/>
|
|
||||||
<menuitem label="Verbose" checked="false" type="checkbox"
|
|
||||||
oncommand="traceVerbose(this.getAttribute('checked'))"/>
|
|
||||||
</menupopup>
|
|
||||||
</menu>
|
|
||||||
</menupopup>
|
</menupopup>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче