Compare commits

...
6 changed files with 10 additions and 12 deletions

No files matched your search

-2
View File
@@ -2300,13 +2300,11 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_UNLINK_END
#ifdef DEBUG
void void
nsGlobalWindow::RiskyUnlink() nsGlobalWindow::RiskyUnlink()
{ {
NS_CYCLE_COLLECTION_INNERNAME.Unlink(this); NS_CYCLE_COLLECTION_INNERNAME.Unlink(this);
} }
#endif
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGlobalWindow) NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGlobalWindow)
if (tmp->mCachedXBLPrototypeHandlers) { if (tmp->mCachedXBLPrototypeHandlers) {
-2
View File
@@ -597,11 +597,9 @@ public:
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindow, NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindow,
nsIDOMEventTarget) nsIDOMEventTarget)
#ifdef DEBUG
// Call Unlink on this window. This may cause bad things to happen, so use // Call Unlink on this window. This may cause bad things to happen, so use
// with caution. // with caution.
void RiskyUnlink(); void RiskyUnlink();
#endif
virtual JSObject* virtual JSObject*
GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey) override; GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey) override;
-2
View File
@@ -829,7 +829,6 @@ nsWindowMemoryReporter::KillCheckTimer()
} }
} }
#ifdef DEBUG
/* static */ void /* static */ void
nsWindowMemoryReporter::UnlinkGhostWindows() nsWindowMemoryReporter::UnlinkGhostWindows()
{ {
@@ -866,4 +865,3 @@ nsWindowMemoryReporter::UnlinkGhostWindows()
} }
} }
} }
#endif
-2
View File
@@ -150,13 +150,11 @@ public:
static void Init(); static void Init();
#ifdef DEBUG
/** /**
* Unlink all known ghost windows, to enable investigating what caused them * Unlink all known ghost windows, to enable investigating what caused them
* to become ghost windows in the first place. * to become ghost windows in the first place.
*/ */
static void UnlinkGhostWindows(); static void UnlinkGhostWindows();
#endif
static nsWindowMemoryReporter* Get(); static nsWindowMemoryReporter* Get();
void ObserveDOMWindowDetached(nsGlobalWindow* aWindow); void ObserveDOMWindowDetached(nsGlobalWindow* aWindow);
-4
View File
@@ -2664,12 +2664,8 @@ nsXPCComponents_Utils::SchedulePreciseShrinkingGC(ScheduledGCCallback* aCallback
NS_IMETHODIMP NS_IMETHODIMP
nsXPCComponents_Utils::UnlinkGhostWindows() nsXPCComponents_Utils::UnlinkGhostWindows()
{ {
#ifdef DEBUG
nsWindowMemoryReporter::UnlinkGhostWindows(); nsWindowMemoryReporter::UnlinkGhostWindows();
return NS_OK; return NS_OK;
#else
return NS_ERROR_NOT_IMPLEMENTED;
#endif
} }
NS_IMETHODIMP NS_IMETHODIMP
@@ -304,6 +304,9 @@ function onLoad()
"collection followed by a cycle collection, and causes the " + "collection followed by a cycle collection, and causes the " +
"process to reduce memory usage in other ways, e.g. by " + "process to reduce memory usage in other ways, e.g. by " +
"flushing various caches."; "flushing various caches.";
const UGDesc = "Unlink any known ghost windows, to enable investigating " +
"what caused them. This is only for debugging leaks, and " +
"can cause bad things to happen if called.";
const GCAndCCLogDesc = "Save garbage collection log and concise cycle " + const GCAndCCLogDesc = "Save garbage collection log and concise cycle " +
"collection log.\n" + "collection log.\n" +
@@ -357,6 +360,7 @@ function onLoad()
appendButton(row3, GCDesc, doGC, "GC"); appendButton(row3, GCDesc, doGC, "GC");
appendButton(row3, CCDesc, doCC, "CC"); appendButton(row3, CCDesc, doCC, "CC");
appendButton(row3, MMDesc, doMMU, "Minimize memory usage"); appendButton(row3, MMDesc, doMMU, "Minimize memory usage");
appendButton(row3, UGDesc, doUGW, "Unlink ghost windows");
let row4 = appendElement(ops, "div", "opsRow"); let row4 = appendElement(ops, "div", "opsRow");
@@ -429,6 +433,12 @@ function doMMU()
() => updateMainAndFooter("Memory minimization completed", HIDE_FOOTER)); () => updateMainAndFooter("Memory minimization completed", HIDE_FOOTER));
} }
function doUGW()
{
Cu.unlinkGhostWindows();
updateMainAndFooter("Unlink ghost windows completed", HIDE_FOOTER);
}
function doMeasure() function doMeasure()
{ {
updateAboutMemoryFromReporters(); updateAboutMemoryFromReporters();